From ace05c780bc48b033754a2a3a6d082324fa316ba Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 23 Apr 2014 13:40:48 +0200 Subject: setup-hostname: remove -n option but accept it for compat reasons --- setup-hostname.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup-hostname.in b/setup-hostname.in index c551de7..c699d54 100644 --- a/setup-hostname.in +++ b/setup-hostname.in @@ -7,13 +7,14 @@ PREFIX= usage() { cat <<__EOF__ -usage: setup-hostname [-h] [-n hostname] +usage: setup-hostname [-h] [HOSTNAME] Sets the system hostname. options: -h Show this help - -n Specify the hostname to set + +Sets hostname to HOSTNAME or prompt if unspecified. __EOF__ exit 1 } @@ -44,7 +45,10 @@ while getopts "hn:" opt; do n) HOSTNAME="$OPTARG";; esac done - +shift $(( $OPTIND - 1 )) +if [ -z "$HOSTNAME" ] && [ $# -eq 1 ]; then + HOSTNAME="$1" +fi while true; do if [ -n "$HOSTNAME" ]; then -- cgit v1.2.3