From 2f0db789558974222acb6a01db71a2dbc0bcb9fc Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 7 Nov 2019 13:29:42 +0000 Subject: [PATCH] Added usage notes, handle default & known cases --- installers/raspbian.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index 5f1c81f7..92e22081 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -4,27 +4,35 @@ # author: @billz # license: GNU General Public License v3.0 # -# Command-line options: -y, --yes, --assume-yes +# Command-line options: +# -y, --yes, --assume-yes # Assume "yes" as answer to all prompts and run non-interactively +# +# c, --crt, --certficate +# Installs mkcert and generates an SSL certificate for lighttpd UPDATE_URL="https://raw.githubusercontent.com/billz/raspap-webgui/master/" VERSION=$(curl -s "https://api.github.com/repos/billz/raspap-webgui/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) -USAGE="Usage: -y, --yes, --assume-yes, -c --cert" +USAGE=$'Usage: raspbian.sh [OPTION] \n\n-y, --yes, --assume-yes\n\tAssumes "yes" as an answer to all prompts' +USAGE+=$'\n-c, --crt, --certficate\n\tInstalls an SSL certificate for lighttpd\n' + assume_yes=0 while :; do case $1 in - -y|--yes|--assume-yes) - assume_yes=1 - apt_option="-y" - echo "assume_yes" - ;; - -c|--cert) - install_cert=1 - echo "install_cert" - ;; - *) - #echo $USAGE + -y|--yes|--assume-yes) + assume_yes=1 + apt_option="-y" + ;; + -c|--crt|--certificate) + install_cert=1 + ;; + -*|--*) + echo "Unknown option: $1"; + echo "$USAGE" + exit 1 + ;; + *) break ;; esac