diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 11:55:58 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 11:55:58 +0200 |
commit | 00be253c557270a5d13e6efcab4b5532888da93f (patch) | |
tree | 9833088e4ccf605eb5fa024e3c967b197b0e69b2 /setup-interfaces.in | |
parent | 1e67d5135cdcc2dab89fa7f440b01b8ac2751172 (diff) | |
download | alpine-conf-00be253c557270a5d13e6efcab4b5532888da93f.zip |
setup-inerfaces: fix usage, make testable
exit with success with -h
send usage text to stderr when invalid option is passed
Diffstat (limited to 'setup-interfaces.in')
-rw-r--r-- | setup-interfaces.in | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in index 9933759..dce8975 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -2,13 +2,11 @@ PROGRAM=setup-interfaces PREFIX=@PREFIX@ +: ${LIBDIR=$PREFIX/lib} +. "$LIBDIR/libalpine.sh" PKGS= -for i in ./libalpine.sh $PREFIX/lib/libalpine.sh; do - [ -e $i ] && . $i && break -done - unconfigured_add() { touch $1.noconf } @@ -421,7 +419,7 @@ usage() { -p Set the system root to operate in -r Restart the networking service after the setup __EOF__ - exit 1 + exit $1 } iface_help() { @@ -563,10 +561,11 @@ while getopts "abhip:r" opt; do case $opt in a) auto=1;; b) ask_bridge=1;; - h) usage;; + h) usage 0;; i) STDINPUT=1;; p) ROOT=$OPTARG;; r) restart=1;; + '?') usage "1" >&2;; esac done |