summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_comp
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2003-08-30 21:11:30 +0000
committerjmmv <jmmv@pkgsrc.org>2003-08-30 21:11:30 +0000
commitc51f629e843618295c0b281466274af9ad2a588b (patch)
tree392335ad867051cf320517d989dc8712ef465c16 /pkgtools/pkg_comp
parent981e0b0330d187e70f478176dd862aeb444634c1 (diff)
downloadpkgsrc-c51f629e843618295c0b281466274af9ad2a588b.tar.gz
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 (limited to 'pkgtools/pkg_comp')
-rw-r--r--pkgtools/pkg_comp/Makefile4
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.816
-rw-r--r--pkgtools/pkg_comp/files/pkg_comp.sh26
3 files changed, 38 insertions, 8 deletions
diff --git a/pkgtools/pkg_comp/Makefile b/pkgtools/pkg_comp/Makefile
index d0fd1f88cd4..f9a22e599e7 100644
--- a/pkgtools/pkg_comp/Makefile
+++ b/pkgtools/pkg_comp/Makefile
@@ -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 --git a/pkgtools/pkg_comp/files/pkg_comp.8 b/pkgtools/pkg_comp/files/pkg_comp.8
index 626beee52d3..273f9d17790 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.8
+++ b/pkgtools/pkg_comp/files/pkg_comp.8
@@ -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>
@@ -323,6 +323,20 @@ Defaults to
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 --git a/pkgtools/pkg_comp/files/pkg_comp.sh b/pkgtools/pkg_comp/files/pkg_comp.sh
index 5c153aebcd9..6d999b5725b 100644
--- a/pkgtools/pkg_comp/files/pkg_comp.sh
+++ b/pkgtools/pkg_comp/files/pkg_comp.sh
@@ -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>
@@ -47,7 +47,7 @@ _TEMPLATE_VARS="DESTDIR ROOTSHELL COPYROOTCFG BUILD_TARGET DISTRIBDIR SETS \
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 @@ env_setdefaults()
: ${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 @@ fsmount()
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 @@ fsumount()
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