1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Added repo & branch command line options

This commit is contained in:
billz 2019-11-11 08:51:45 +00:00
parent a00a3d5915
commit a08005dca7

View File

@ -7,15 +7,20 @@
# Command-line options: # Command-line options:
# -y, --yes, --assume-yes # -y, --yes, --assume-yes
# Assume "yes" as answer to all prompts and run non-interactively # Assume "yes" as answer to all prompts and run non-interactively
#
# c, --cert, --certficate # c, --cert, --certficate
# Installs mkcert and generates an SSL certificate for lighttpd # Installs mkcert and generates an SSL certificate for lighttpd
# -r, --repo, --repository
# Overrides the default GitHub repo (billz/raspap-webgui)
# -b, --branch
# Overrides the default git branch (master)
UPDATE_URL="https://raw.githubusercontent.com/billz/raspap-webgui/master/" repo="billz/raspap-webgui"
VERSION=$(curl -s "https://api.github.com/repos/billz/raspap-webgui/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' ) branch="master"
USAGE=$'Usage: raspbian.sh [OPTION] \n\n-y, --yes, --assume-yes\n\tAssumes "yes" as an answer to all prompts' USAGE=$'Usage: raspbian.sh [OPTION] \n\n'
USAGE+=$'\n-c, --cert, --certficate\n\tInstalls an SSL certificate for lighttpd\n' USAGE+=$'-y, --yes, --assume-yes\n\tAssumes "yes" as an answer to all prompts\n'
USAGE+=$'-c, --cert, --certficate\n\tInstalls an SSL certificate for lighttpd\n'
USAGE+=$'-r, --repo, --repository\n\tOverrides the default GitHub repo (billz/raspap-webgui)\n'
USAGE+=$'-b, --branch\n\tOverrides the default git branch (master)\n'
assume_yes=0 assume_yes=0
while :; do while :; do
@ -27,8 +32,15 @@ while :; do
-c|--cert|--certificate) -c|--cert|--certificate)
install_cert=1 install_cert=1
;; ;;
-r|--repo|--repository)
repo="$2"
shift
;;
-b|--branch)
branch="$2"
;;
-*|--*) -*|--*)
echo "Unknown option: $1"; echo "Unknown option: $1"
echo "$USAGE" echo "$USAGE"
exit 1 exit 1
;; ;;
@ -39,6 +51,9 @@ while :; do
shift shift
done done
VERSION=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' )
UPDATE_URL="https://raw.githubusercontent.com/$repo/$branch/"
# Outputs a welcome message # Outputs a welcome message
function display_welcome() { function display_welcome() {
raspberry='\033[0;35m' raspberry='\033[0;35m'