From 8646bb465582652dfe0f84f7dbec93979fa83170 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 11 May 2022 23:48:18 +0200 Subject: 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. --- setup-hostname.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'setup-hostname.in') 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 -- cgit v1.2.3