summaryrefslogtreecommitdiff
path: root/pkgtools/pbulk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-09-21 13:42:54 +0000
committerrillig <rillig@pkgsrc.org>2007-09-21 13:42:54 +0000
commit468f3fe28aa78574da3efce4163ed6fff333b8cc (patch)
tree1c5c5666097f6ac16ac3df766fcae288cd226b52 /pkgtools/pbulk
parenta51fc4af4ab62bffe27e1ee8d5aba01928855422 (diff)
downloadpkgsrc-468f3fe28aa78574da3efce4163ed6fff333b8cc.tar.gz
Removed code duplication by calling the client-clean script.
Before removing prefix, fix the permissions. Everything inside that directory must be writable and all directories must be searchable. NetBSD's chmod has an option -P which I would have liked to use, but POSIX requires only -R to be implemented. Therefore, it is possible that permissions of files outside the prefix are changed due to symlinks. The client-clean program promises to clean $prefix, so fail if that is not possible. A common cause for this is that some files inside have their flags set (see chflags(1) on NetBSD). When installing the bootstrap kit, the source may be either a regular file (which is then assumed to be a tar archive) or a directory (which is copied directly). The latter option is new and allows for easier changes of files once the bulk build has started.
Diffstat (limited to 'pkgtools/pbulk')
-rwxr-xr-xpkgtools/pbulk/files/pbulk/scripts/client-clean16
-rwxr-xr-xpkgtools/pbulk/files/pbulk/scripts/pkg-build7
-rwxr-xr-xpkgtools/pbulk/files/pbulk/scripts/pre-build7
3 files changed, 18 insertions, 12 deletions
diff --git a/pkgtools/pbulk/files/pbulk/scripts/client-clean b/pkgtools/pbulk/files/pbulk/scripts/client-clean
index c3c5cb88ace..997b19bc31e 100755
--- a/pkgtools/pbulk/files/pbulk/scripts/client-clean
+++ b/pkgtools/pbulk/files/pbulk/scripts/client-clean
@@ -1,11 +1,23 @@
#!@SH@
-# $NetBSD: client-clean,v 1.3 2007/08/15 21:10:55 joerg Exp $
+# $NetBSD: client-clean,v 1.4 2007/09/21 13:42:54 rillig Exp $
. @PBULK_CONFIG@
set -e
# Clean build system first
+chmod -R 700 ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
+if [ -d "${prefix}" ]; then
+ echo "ERROR: [client-clean] Could not remove $prefix" 1>&2
+ exit 1
+fi
+
# Install fresh bootstrap state
-[ -z "${bootstrapkit}" ] || ${tar} -xzf ${bootstrapkit} -C /
+if [ -f "${bootstrapkit}" ]; then
+ ${tar} -xzf ${bootstrapkit} -C /
+elif [ -d "${bootstrapkit}" ]; then
+ cp -R ${bootstrapkit} ${prefix}
+else
+ # Do nothing
+fi
diff --git a/pkgtools/pbulk/files/pbulk/scripts/pkg-build b/pkgtools/pbulk/files/pbulk/scripts/pkg-build
index ae6363489dc..03a8500b1f6 100755
--- a/pkgtools/pbulk/files/pbulk/scripts/pkg-build
+++ b/pkgtools/pbulk/files/pbulk/scripts/pkg-build
@@ -1,5 +1,5 @@
#!@SH@
-# $NetBSD: pkg-build,v 1.6 2007/09/21 13:34:52 rillig Exp $
+# $NetBSD: pkg-build,v 1.7 2007/09/21 13:42:54 rillig Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
@@ -73,10 +73,7 @@ ${pkg_up_to_date_script} ${pkgname} ${dependencies} && exit 0
set -e
-# Clean build system first
-rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
-# Install fresh bootstrap state
-[ -n "${bootstrapkit}" ] && ${tar} -xzf ${bootstrapkit} -C /
+@PREFIX@/libexec/pbulk/client-clean
# Create the output directory and clean it up
mkdir -p ${bulklog}/${pkgname}
diff --git a/pkgtools/pbulk/files/pbulk/scripts/pre-build b/pkgtools/pbulk/files/pbulk/scripts/pre-build
index 2284b1ecf52..2f653015cc9 100755
--- a/pkgtools/pbulk/files/pbulk/scripts/pre-build
+++ b/pkgtools/pbulk/files/pbulk/scripts/pre-build
@@ -1,5 +1,5 @@
#!@SH@
-# $NetBSD: pre-build,v 1.3 2007/08/15 21:10:55 joerg Exp $
+# $NetBSD: pre-build,v 1.4 2007/09/21 13:42:54 rillig Exp $
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
@@ -37,10 +37,7 @@ set -e
rm -rf "${bulklog}" || true
mkdir -p "${bulklog}" "${loc}"
-# Clean build system first
-rm -rf ${prefix} ${pkgdb} ${varbase}/qmail 2> /dev/null || true
-# Install fresh bootstrap state
-[ -n "${bootstrapkit}" ] && ${tar} -xzf ${bootstrapkit} -C /
+@PREFIX@/libexec/pbulk/client-clean
# Log common settings...
opsys=`cd ${pkgsrc}/pkgtools/pkg_install && ${make} show-var VARNAME=OPSYS`