summaryrefslogtreecommitdiffstats
path: root/usr.sbin/portsnap
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2005-08-13 16:27:13 +0000
committercperciva <cperciva@FreeBSD.org>2005-08-13 16:27:13 +0000
commit15d7ec1545d80050592625217668f88499e9ac97 (patch)
tree50cfe3f52a3e6ad24e9ce490f0ad463ad18a946c /usr.sbin/portsnap
parentd7c6f147cb721cf5c23b029b3d3bdaffb3909af4 (diff)
downloadFreeBSD-src-15d7ec1545d80050592625217668f88499e9ac97.zip
FreeBSD-src-15d7ec1545d80050592625217668f88499e9ac97.tar.gz
Allow multiple commands to be specified on a single command line, e.g.,
"portsnap fetch update" or "portsnap -I cron update". They will be executed in the order that they appear, and duplicates are not removed (so "portsnap fetch fetch fetch fetch" is meaningful, albeit rather silly). Requested by: Roman Divacky
Diffstat (limited to 'usr.sbin/portsnap')
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.82
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.sh16
2 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.8 b/usr.sbin/portsnap/portsnap/portsnap.8
index 9e1aa0f..7d2226d 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.8
+++ b/usr.sbin/portsnap/portsnap/portsnap.8
@@ -39,7 +39,7 @@
.Op Fl k Ar KEY
.Op Fl p Ar portsdir
.Op Fl s Ar server
-.Cm command
+.Cm command ...
.Op Ar path
.Sh DESCRIPTION
The
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh
index 47e7d46..a7731e9 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.sh
+++ b/usr.sbin/portsnap/portsnap/portsnap.sh
@@ -34,7 +34,7 @@
# --no-stats -- don't show progress statistics while fetching files
usage() {
cat <<EOF
-usage: `basename $0` [options] command [path]
+usage: `basename $0` [options] command ... [path]
Options:
-d workdir -- Store working files in workdir
@@ -72,6 +72,7 @@ init_params() {
PORTSDIR=""
CONFFILE=""
COMMAND=""
+ COMMANDS=""
QUIETREDIR=""
QUIETFLAG=""
STATSREDIR=""
@@ -132,19 +133,20 @@ parse_cmdline() {
shift; SERVERNAME="$1"
;;
cron | extract | fetch | update)
- if [ ! -z "${COMMAND}" ]; then usage; fi
- COMMAND="$1"
+ COMMANDS="${COMMANDS} $1"
;;
*)
if [ $# -gt 1 ]; then usage; fi
- if [ "${COMMAND}" = "extract" ]; then usage; fi
+ if echo ${COMMANDS} | grep -vq extract; then
+ usage
+ fi
EXTRACTPATH="$1"
;;
esac
shift
done
- if [ -z "${COMMAND}" ]; then
+ if [ -z "${COMMANDS}" ]; then
usage
fi
}
@@ -906,4 +908,6 @@ cmd_update() {
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${PATH}
get_params $@
-cmd_${COMMAND}
+for COMMAND in ${COMMANDS}; do
+ cmd_${COMMAND}
+done
OpenPOWER on IntegriCloud