summaryrefslogtreecommitdiff
path: root/mk/bulk/upload
diff options
context:
space:
mode:
authoradrianp <adrianp@pkgsrc.org>2007-07-25 12:00:21 +0000
committeradrianp <adrianp@pkgsrc.org>2007-07-25 12:00:21 +0000
commitb3d1cd26ebd1e0ade3bd6c218177bdd161205cad (patch)
tree178a33f3e065070f68b9209dae65b860cb6ac364 /mk/bulk/upload
parent54ec3ea29e936056d01da2a54a6018fa532abf3c (diff)
downloadpkgsrc-b3d1cd26ebd1e0ade3bd6c218177bdd161205cad.tar.gz
Add --config <file> from build script
Diffstat (limited to 'mk/bulk/upload')
-rw-r--r--mk/bulk/upload42
1 files changed, 35 insertions, 7 deletions
diff --git a/mk/bulk/upload b/mk/bulk/upload
index 21b7f5f2009..256d51c777e 100644
--- a/mk/bulk/upload
+++ b/mk/bulk/upload
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: upload,v 1.39 2007/07/25 10:57:44 adrianp Exp $
+# $NetBSD: upload,v 1.40 2007/07/25 12:00:21 adrianp Exp $
#
# Upload non-restricted binary pkgs to ftp server
@@ -23,10 +23,14 @@ cat << EOF
$prog: Uploads binary packages.
-Usage: $prog [-n|--no-upload] [-d|--debug] [-v|--verbose]
+Usage: $prog [-c|--config <file>] [-n|--no-upload] [-d|--debug] [-v|--verbose]
$prog -h|--help
$prog -V|--version
+ -c | --config <file>
+ Load the following configuration file instead of
+ the default one.
+
-d|--debug Preserves some intermediate files to help
debug any problems.
@@ -58,6 +62,15 @@ Files:
EOF
}
+# print out error message and exit 1
+die () {
+ echo "$0: error:" 1>&2
+ for i in "$@"; do
+ echo " $i" 1>&2
+ done
+ exit 1
+}
+
prog=$0
debug=no
do_upload=yes
@@ -65,6 +78,11 @@ do_install=yes
verbose=no
while test $# -gt 0; do
case "$1" in
+ -c|--config)
+ shift
+ BULK_BUILD_CONF=$1; shift
+ ;;
+
-d|--debug)
debug=yes
shift
@@ -161,14 +179,24 @@ DEPENDS_TARGET=bulk-install
export BATCH DEPENDS_TARGET
#
+# Find the configuration file.
+#
+BULK_BUILD_CONF="${BULK_BUILD_CONF-${scriptdir}/build.conf}"
+case $BULK_BUILD_CONF in
+ /*) ;;
+ *) BULK_BUILD_CONF="${PWD}/${BULK_BUILD_CONF}"
+esac
+
+#
# Get the variables MAKECONF, RSYNC_DST, RSYNC_OPTS from the bulk build
# configuration file.
#
-: ${BULK_BUILD_CONF="${scriptdir}/build.conf"} #"
-. "${BULK_BUILD_CONF}"
-. "${scriptdir}/post-build-conf"
-check_config_vars
-export_config_vars
+{ test -f "${BULK_BUILD_CONF}" \
+ && . "${BULK_BUILD_CONF}" \
+ && . "${scriptdir}/post-build-conf" \
+ && check_config_vars \
+ && export_config_vars
+} || die "Cannot load config file ${BULK_BUILD_CONF}, aborting."
cd $USR_PKGSRC