diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 13:12:35 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 13:12:35 +0200 |
commit | 4ddb96394a4657d2444018385be79d65c6fbad60 (patch) | |
tree | 662411af7827835b6d1b0ca04296ae742ec297bb | |
parent | 9cdb911f9d234e3a3022bc7aafb1959f07829465 (diff) | |
download | alpine-conf-4ddb96394a4657d2444018385be79d65c6fbad60.zip |
setup-proxy: fix usage
print usage help text to stderr on invalid option
-rw-r--r-- | setup-proxy.in | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/setup-proxy.in b/setup-proxy.in index 532ec65..8829ac8 100644 --- a/setup-proxy.in +++ b/setup-proxy.in @@ -1,9 +1,8 @@ #!/bin/sh PREFIX=@PREFIX@ -for i in ./libalpine.sh $PREFIX/lib/libalpine.sh; do - [ -e $i ] && . $i && break -done +: ${LIBDIR=$PREFIX/lib} +. "$LIBDIR/libalpine.sh" usage() { cat <<-__EOF__ @@ -17,19 +16,17 @@ usage() { If PROXYURL is not specified user will be prompted. __EOF__ - exit 1 + exit $1 } - - while getopts "hp:q" opt; do case "$opt" in - q) quiet=1;; - h) usage;; - p) ROOT=$OPTARG;; + q) quiet=1;; + h) usage 0;; + p) ROOT=$OPTARG;; + '?') usage "1" >&2;; esac done - shift $(( $OPTIND - 1)) proxyurl="$1" |