pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_comp Update to 1.9:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fb93bedc496e
branches:  trunk
changeset: 460472:fb93bedc496e
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Sat Aug 30 21:11:30 2003 +0000

description:
Update to 1.9:
- Introduce two new variables, MOUNT_SCRIPT and UMOUNT_SCRIPT, that let the
  user specify a script file run after mounting known filesystems and before
  unmounting them, respectively.  Patch by seb@, thanks!

diffstat:

 pkgtools/pkg_comp/Makefile          |   4 ++--
 pkgtools/pkg_comp/files/pkg_comp.8  |  16 +++++++++++++++-
 pkgtools/pkg_comp/files/pkg_comp.sh |  26 +++++++++++++++++++++-----
 3 files changed, 38 insertions(+), 8 deletions(-)

diffs (113 lines):

diff -r a7ba19291d47 -r fb93bedc496e pkgtools/pkg_comp/Makefile
--- a/pkgtools/pkg_comp/Makefile        Sat Aug 30 21:10:11 2003 +0000
+++ b/pkgtools/pkg_comp/Makefile        Sat Aug 30 21:11:30 2003 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.12 2003/07/20 15:54:46 jmmv Exp $
+# $NetBSD: Makefile,v 1.13 2003/08/30 21:11:30 jmmv Exp $
 
-DISTNAME=      pkg_comp-1.8
+DISTNAME=      pkg_comp-1.9
 WRKSRC=                ${WRKDIR}
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
diff -r a7ba19291d47 -r fb93bedc496e pkgtools/pkg_comp/files/pkg_comp.8
--- a/pkgtools/pkg_comp/files/pkg_comp.8        Sat Aug 30 21:10:11 2003 +0000
+++ b/pkgtools/pkg_comp/files/pkg_comp.8        Sat Aug 30 21:11:30 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_comp.8,v 1.10 2003/07/20 16:05:04 jmmv Exp $
+.\" $NetBSD: pkg_comp.8,v 1.11 2003/08/30 21:11:30 jmmv Exp $
 .\"
 .\" pkg_comp - Build packages inside a clean chroot environment
 .\" Copyright (c) 2002, 2003, Julio Merino <jmmv%netbsd.org@localhost>
@@ -323,6 +323,20 @@
 Mount options.
 Defaults to
 .Sy -t null -o ro .
+.It MOUNT_SCRIPT
+Pathname to a script to run after the file systems are mounted.
+Two arguments are given to it: 
+.Ar $DESTDIR ,
+and the word
+.Ar mount .
+Defaults to the empty value i.e. no script is to be run.
+.It UMOUNT_SCRIPT
+Pathname to a script to run before the file systems are unmounted.
+Two arguments are given to it: 
+.Ar $DESTDIR ,
+and the word
+.Ar umount .
+Defaults to the empty value i.e. no script is to be run.
 .El
 .Sh TARGETS
 A target specifies what
diff -r a7ba19291d47 -r fb93bedc496e pkgtools/pkg_comp/files/pkg_comp.sh
--- a/pkgtools/pkg_comp/files/pkg_comp.sh       Sat Aug 30 21:10:11 2003 +0000
+++ b/pkgtools/pkg_comp/files/pkg_comp.sh       Sat Aug 30 21:11:30 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: pkg_comp.sh,v 1.9 2003/07/20 16:05:04 jmmv Exp $
+# $NetBSD: pkg_comp.sh,v 1.10 2003/08/30 21:11:31 jmmv Exp $
 #
 # pkg_comp - Build packages inside a clean chroot environment
 # Copyright (c) 2002, 2003, Julio Merino <jmmv%netbsd.org@localhost>
@@ -47,7 +47,7 @@
                 SETS_X11 USE_XPKGWEDGE REAL_SRC REAL_SRC_OPTS REAL_PKGSRC \
                 REAL_PKGSRC_OPTS REAL_DISTFILES REAL_DISTFILES_OPTS \
                 REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \
-                NETBSD_RELEASE"
+                NETBSD_RELEASE MOUNT_SCRIPT UMOUNT_SCRIPT"
 
 env_clean()
 {
@@ -99,6 +99,9 @@
     : ${REAL_PACKAGES:=/usr/pkgsrc/packages}
     : ${REAL_PACKAGES_OPTS:=-t null -o rw}
     : ${REAL_PKGVULNDIR:=/usr/pkgsrc/distfiles}
+    : ${NETBSD_RELEASE:=no}
+    : ${MOUNT_SCRIPT:=}
+    : ${UMOUNT_SCRIPT:=}
 }
 
 # ----------------------------------------------------------------------
@@ -185,13 +188,19 @@
 
     touch $fsstate
     echo " done."
+
+    if [ -n "$MOUNT_SCRIPT" -a -x "$MOUNT_SCRIPT" ]; then
+        echo "PKG_COMP ==> Executing mount script."
+        $MOUNT_SCRIPT $DESTDIR mount
+    fi
 }
 
 fsumount()
 {
-    printf "PKG_COMP ==> Unmounting chroot filesystems:"
+    msg="PKG_COMP ==> Unmounting chroot filesystems:"
+
     if [ ! -f $fsstate ]; then
-        echo " none mounted."
+        echo "$msg none mounted."
         return
     fi
 
@@ -199,10 +208,17 @@
     if [ $count -gt 1 ]; then
         count=$(($count - 1))
         echo "$count" > $fsstate
-        echo " still in use."
+        echo "$msg still in use."
         return
     fi
 
+    if [ -n "$UMOUNT_SCRIPT" -a -x "$UMOUNT_SCRIPT" ]; then
+        echo "PKG_COMP ==> Executing umount script."
+        $UMOUNT_SCRIPT $DESTDIR umount
+    fi
+
+    printf "$msg"
+
     fsfailed=no
 
     if [ -n "$REAL_SRC" -a -d "$REAL_SRC" ]; then



Home | Main Index | Thread Index | Old Index