summaryrefslogtreecommitdiff
path: root/update-conf.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-13 15:48:53 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-13 15:52:55 +0200
commit21bf3a448786eac26544c2802abe5a0b30409463 (patch)
tree6cb174b6546fa5766e9fe6c5f61430b4b23b5bee /update-conf.in
parent69cd0086825ed1ca360a2a62f7d8fe097cfec53f (diff)
downloadalpine-conf-21bf3a448786eac26544c2802abe5a0b30409463.zip
update-conf: fix -h usage message
Diffstat (limited to 'update-conf.in')
-rw-r--r--update-conf.in23
1 files changed, 11 insertions, 12 deletions
diff --git a/update-conf.in b/update-conf.in
index 63cf2b5..72604f2 100644
--- a/update-conf.in
+++ b/update-conf.in
@@ -1,9 +1,9 @@
#!/bin/sh
-PREFIX=@PREFIX@
VERSION=@VERSION@
-
-. $PREFIX/lib/libalpine.sh
+PREFIX=@PREFIX@
+: ${LIBDIR=$PREFIX/lib}
+. "$LIBDIR/libalpine.sh"
# set up temp dir
init_tmpdir TMPD
@@ -11,33 +11,32 @@ init_tmpdir TMPD
LBUCACHE="$TMPD/lbucache"
usage() {
- cat >&2 <<-__EOF__
+ cat <<-__EOF__
$PROGRAM $VERSION
- Usage: $PROGRAM [-a|--all] [-i|--initd] [-l|--list] [-h|--help]
- Options:
+ 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
__EOF__
+ exit $1
}
-
is_modified() {
[ -f "$LBUCACHE" ] || lbu status -a | awk '{print $2}' > "$LBUCACHE"
test -n "$( ( echo "$1" ; cat "$LBUCACHE" ) | sort | uniq -d)"
}
-
is_initd() {
echo "$1" | grep etc/init.d/ > /dev/null
}
args=$(getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@")
if [ $? -ne 0 ]; then
- usage
- exit 2
+ usage "1" >&2
fi
eval set -- "$args"
while true; do
@@ -45,9 +44,9 @@ while true; do
-a|--all) aflag="-a";;
-i|--initd) iflag="-i";;
-l|--list) lflag="-l";;
- -h|--help) usage; exit;;
+ -h|--help) usage 0;;
--) shift; break;;
- *) exit 1;; # getopt error
+ '?') usage "1" >&2;;
esac
shift
done