From bfe62fb2c94f9005d7758c8adec1c1df6ad62522 Mon Sep 17 00:00:00 2001 From: billz Date: Wed, 15 Nov 2023 18:13:56 +0000 Subject: [PATCH] Replace comment block with usage() --- installers/raspbian.sh | 105 +++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 63 deletions(-) diff --git a/installers/raspbian.sh b/installers/raspbian.sh index c88987cd..21008be0 100755 --- a/installers/raspbian.sh +++ b/installers/raspbian.sh @@ -10,26 +10,6 @@ # # Installs an instance of RaspAP. # -# OPTIONS: -# -y, --yes, --assume-yes Assume "yes" as answer to all prompts and run non-interactively -# -c, --cert, --certficate Installs mkcert and generates an SSL certificate for lighttpd -# -o, --openvpn Used with -y, --yes, sets OpenVPN install option (0=no install) -# -a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) -# -w, --wireguard Used with -y, --yes, sets WireGuard install option (0=no install) -# -c, --cert, --certificate Installs an SSL certificate with mkcert and configures lighttpd for HTTPS -# -r, --repo, --repository Overrides the default GitHub repo (RaspAP/raspap-webgui) -# -b, --branch Overrides the default git branch (master) -# -t, --token Specify a GitHub token to access a private repository -# -n, --name Specify a GitHub username to access a private repository -# -u, --upgrade Upgrades an existing installation to the latest release version -# -d, --update Updates an existing installation to the latest release version -# -p, --path Used with -d, --update, sets the existing install path -# -i, --insiders Installs from the Insiders Edition (RaspAP/raspap-insiders) -# -m, --minwrite Configures a microSD card for minimum write operation -# -v, --version Outputs release info and exits -# -n, --uninstall Loads and executes the uninstaller -# -h, --help Outputs usage notes and exits -# # NOTE # Depending on options passed to the installer, ONE of the following # additional shell scripts will be downloaded and sourced: @@ -45,6 +25,48 @@ # You are not obligated to bundle the LICENSE file with your RaspAP projects as long # as you leave these references intact in the header comments of your source files. +function _usage() { + cat << EOF +Usage: raspbian.sh options + +Installs an instance of RaspAP or a helper component. + +OPTIONS: +-y, --yes, --assume-yes Assumes "yes" as an answer to all prompts +-c, --cert, --certificate Installs an SSL certificate for lighttpd +-o, --openvpn Used with -y, --yes, sets OpenVPN install option (0=no install) +-a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) +-w, --wireguard Used with -y, --yes, sets WireGuard install option (0=no install) +-r, --repo, --repository Overrides the default GitHub repo (RaspAP/raspap-webgui) +-b, --branch Overrides the default git branch (latest release) +-t, --token Specify a GitHub token to access a private repository +-n, --name Specify a GitHub username to access a private repository +-u, --upgrade Upgrades an existing installation to the latest release version +-d, --update Updates an existing installation to the latest release version +-p, --path Used with -d, --update, sets the existing install path +-i, --insiders Installs from the Insiders Edition (RaspAP/raspap-insiders) +-m, --minwrite Configures a microSD card for minimum write operation +-v, --version Outputs release info and exits +-n, --uninstall Loads and executes the uninstaller +-h, --help Outputs usage notes and exits + +Examples: + Run locally specifying GitHub repo and branch: + raspbian.sh --repo foo/bar --branch my/branch + + Run locally requesting release info: + raspbian.sh --version + + Invoke installer remotely, run non-interactively with option flags: + curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --adblock 0 + + Invoke remotely, uprgrade an existing install to the Insiders Edition: + curl -sL https://install.raspap.com | bash -s -- --upgrade --insiders + +EOF + exit +} + set -eo pipefail function _main() { @@ -161,49 +183,6 @@ function _log_output() { exec 2>&1 } -function _usage() { - cat << EOF -Usage: raspbian.sh options - -Installs an instance of RaspAP or a helper component. - -OPTIONS: --y, --yes, --assume-yes Assumes "yes" as an answer to all prompts --c, --cert, --certificate Installs an SSL certificate for lighttpd --o, --openvpn Used with -y, --yes, sets OpenVPN install option (0=no install) --a, --adblock Used with -y, --yes, sets Adblock install option (0=no install) --w, --wireguard Used with -y, --yes, sets WireGuard install option (0=no install) --c, --cert, --certificate Installs an SSL certificate with mkcert and configures lighttpd for HTTPS --r, --repo, --repository Overrides the default GitHub repo (RaspAP/raspap-webgui) --b, --branch Overrides the default git branch (latest release) --t, --token Specify a GitHub token to access a private repository --n, --name Specify a GitHub username to access a private repository --u, --upgrade Upgrades an existing installation to the latest release version --d, --update Updates an existing installation to the latest release version --p, --path Used with -d, --update, sets the existing install path --i, --insiders Installs from the Insiders Edition (RaspAP/raspap-insiders) --m, --minwrite Configures a microSD card for minimum write operation --v, --version Outputs release info and exits --n, --uninstall Loads and executes the uninstaller --h, --help Outputs usage notes and exits - -Examples: - Run locally specifying GitHub repo and branch: - raspbian.sh --repo foo/bar --branch my/branch - - Run locally requesting release info: - raspbian.sh --version - - Invoke installer remotely, run non-interactively with option flags: - curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --adblock 0 - - Invoke remotely, uprgrade an existing install to the Insiders Edition: - curl -sL https://install.raspap.com | bash -s -- --upgrade --insiders - -EOF - exit -} - function _version() { _get_release echo -e "RaspAP v${RASPAP_RELEASE} - Simple wireless AP setup & management for Debian-based devices"