From: Ian Kelling Date: Wed, 7 Sep 2016 08:20:14 +0000 (-0700) Subject: cleanup docs, getopt arg parsing X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=bf19e9969f50a637c8fabf724eb9e292da472e01;p=automated-distro-installer cleanup docs, getopt arg parsing --- diff --git a/arch-init-remote b/arch-init-remote index 770e332..5bcfc3b 100755 --- a/arch-init-remote +++ b/arch-init-remote @@ -15,6 +15,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +usage() { + cat <&2' ERR if [[ ! $1 ]]; then echo "error: expect a hostname in \$1 " - exit 1 + usage 1 fi host=$1 diff --git a/chboot b/chboot index 925becc..426fd9a 100755 --- a/chboot +++ b/chboot @@ -15,25 +15,41 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# Set grub to boot into a different distro, and reboot unless -r -# $0 [DISTRO_NAME] -# with no argument, print available distros - -# DISTRO_NAME is based on the partition names in /boot. eg boot_debianjessie set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR [[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@" +usage() { + cat <&2' ERR