aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDubiousjim <dubiousjim@gmail.com>2013-07-01 17:14:16 -0400
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-03 07:56:05 +0000
commit63198c22087474306f38e7158b701f673da6ea8e (patch)
treeb5c816f2b4c1400ab6e9febf9ab6def2b5e466c7
parentbc9e98b98e1b54a359eacc1e7426901165b51a4b (diff)
downloadalpine-conf-63198c22087474306f38e7158b701f673da6ea8e.tar.bz2
alpine-conf-63198c22087474306f38e7158b701f673da6ea8e.tar.xz
update-conf: accept long options
-rw-r--r--update-conf.in40
1 files changed, 25 insertions, 15 deletions
diff --git a/update-conf.in b/update-conf.in
index 6a8ab16..c3ba366 100644
--- a/update-conf.in
+++ b/update-conf.in
@@ -10,14 +10,16 @@ init_tmpdir TMPD
LBUCACHE="$TMPD/lbucache"
usage() {
- echo "$PROGRAM $VERSION
-Usage: $PROGAM [-aihl]
+ cat >&2 << __EOF__
+$PROGRAM $VERSION
+Usage: $PROGRAM [-a|--all] [-i|--initd] [-l|--list] [-h|--help]
+Options:
+ -a, --all Select all updated files
+ -i, --initd Use all new init.d scripts
+ -l, --list List updated files
+ -h, --help Show this help
- -a Select all updated files.
- -h Show this help.
- -i Use all new init.d scripts.
- -l List updated files.
-"
+__EOF__
}
@@ -31,15 +33,23 @@ is_initd() {
echo "$1" | grep etc/init.d/ > /dev/null
}
-while getopts "alih" opt ; do
- case "$opt" in
- a) aflag="-a" ;;
- i) iflag="-i" ;;
- l) lflag="-l" ;;
- h|*) usage;;
- esac
+args=`getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@"`
+if [ $? -ne 0 ]; then
+ usage
+ exit 2
+fi
+eval set -- "$args"
+while true; do
+ case $1 in
+ -a|--all) aflag="-a";;
+ -i|--initd) iflag="-i";;
+ -l|--list) lflag="-l";;
+ -h|--help) usage; exit;;
+ --) shift; break;;
+ *) exit 1;; # getopt error
+ esac
+ shift
done
-shift `expr $OPTIND - 1`
for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
p="${apknew%.apk-new}"