diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-11 23:48:18 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-11 23:48:18 +0200 |
commit | 8646bb465582652dfe0f84f7dbec93979fa83170 (patch) | |
tree | 4dc7b850eaee01042e4c52b3036b215084095d87 /setup-hostname.in | |
parent | e6a59acd289efaa21d04274b75aa3073df61ef7a (diff) | |
download | alpine-conf-8646bb465582652dfe0f84f7dbec93979fa83170.zip |
setup-hostname: -h does not return error
running -h should return success
Hide -n from help test, as it is not encouraged, but we keep it for
backwards compat.
Diffstat (limited to 'setup-hostname.in')
-rw-r--r-- | setup-hostname.in | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/setup-hostname.in b/setup-hostname.in index c49e5ce..6a03457 100644 --- a/setup-hostname.in +++ b/setup-hostname.in @@ -2,22 +2,21 @@ PROGRAM=setup-hostname PREFIX=@PREFIX@ - -. $PREFIX/lib/libalpine.sh +: ${LIBDIR=$PREFIX/lib} +. "$LIBDIR/libalpine.sh" usage() { cat <<-__EOF__ - usage: setup-hostname [-h] [-n HOSTNAME] + usage: setup-hostname [-h] [HOSTNAME] Sets the system hostname. options: -h Show this help - -n Hostname to set non-interactively Sets hostname to HOSTNAME or prompt if unspecified. __EOF__ - exit 1 + exit $1 } @@ -43,7 +42,7 @@ valid_hostname() { while getopts "hn:" opt; do case $opt in - h) usage;; + h) usage 0;; n) name="$OPTARG";; esac done |