mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Add --uninstall option to loader
This commit is contained in:
		@@ -21,6 +21,7 @@
 | 
				
			|||||||
# -u, --upgrade                     Upgrades an existing installation to the latest release version
 | 
					# -u, --upgrade                     Upgrades an existing installation to the latest release version
 | 
				
			||||||
# -i, --insiders                    Installs from the Insiders Edition (RaspAP/raspap-insiders)
 | 
					# -i, --insiders                    Installs from the Insiders Edition (RaspAP/raspap-insiders)
 | 
				
			||||||
# -v, --version                     Outputs release info and exits
 | 
					# -v, --version                     Outputs release info and exits
 | 
				
			||||||
 | 
					# -n, --uninstall		    Loads and executes the uninstaller
 | 
				
			||||||
# -h, --help                        Outputs usage notes and exits
 | 
					# -h, --help                        Outputs usage notes and exits
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Depending on options passed to the installer, ONE of the following
 | 
					# Depending on options passed to the installer, ONE of the following
 | 
				
			||||||
@@ -29,6 +30,8 @@
 | 
				
			|||||||
# https://raw.githubusercontent.com/raspap/raspap-webgui/master/installers/common.sh
 | 
					# https://raw.githubusercontent.com/raspap/raspap-webgui/master/installers/common.sh
 | 
				
			||||||
# - or -
 | 
					# - or -
 | 
				
			||||||
# https://raw.githubusercontent.com/raspap/raspap-webgui/master/installers/mkcert.sh
 | 
					# https://raw.githubusercontent.com/raspap/raspap-webgui/master/installers/mkcert.sh
 | 
				
			||||||
 | 
					# - or -
 | 
				
			||||||
 | 
					# https://raw.githubusercontent.com/raspap/raspap-webgui/master/installers/uninstall.sh
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# You are not obligated to bundle the LICENSE file with your RaspAP projects as long
 | 
					# 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.
 | 
					# as you leave these references intact in the header comments of your source files.
 | 
				
			||||||
@@ -96,6 +99,9 @@ function _parse_params() {
 | 
				
			|||||||
            -v|--version)
 | 
					            -v|--version)
 | 
				
			||||||
            _version
 | 
					            _version
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
 | 
					            -n|--uninstall)
 | 
				
			||||||
 | 
					            uninstall=1
 | 
				
			||||||
 | 
					            ;;
 | 
				
			||||||
            -*|--*)
 | 
					            -*|--*)
 | 
				
			||||||
            echo "Unknown option: $1"
 | 
					            echo "Unknown option: $1"
 | 
				
			||||||
            _usage
 | 
					            _usage
 | 
				
			||||||
@@ -141,6 +147,7 @@ OPTIONS:
 | 
				
			|||||||
-u, --upgrade                       Upgrades an existing installation to the latest release version
 | 
					-u, --upgrade                       Upgrades an existing installation to the latest release version
 | 
				
			||||||
-i, --insiders                      Installs from the Insiders Edition (RaspAP/raspap-insiders)
 | 
					-i, --insiders                      Installs from the Insiders Edition (RaspAP/raspap-insiders)
 | 
				
			||||||
-v, --version                       Outputs release info and exits
 | 
					-v, --version                       Outputs release info and exits
 | 
				
			||||||
 | 
					-n, --uninstall                     Loads and executes the uninstaller
 | 
				
			||||||
-h, --help                          Outputs usage notes and exits
 | 
					-h, --help                          Outputs usage notes and exits
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Examples:
 | 
					Examples:
 | 
				
			||||||
@@ -245,11 +252,17 @@ function _load_installer() {
 | 
				
			|||||||
    if [[ ! -z "$acctoken" ]]; then
 | 
					    if [[ ! -z "$acctoken" ]]; then
 | 
				
			||||||
        header=(--header "Authorization: token $acctoken")
 | 
					        header=(--header "Authorization: token $acctoken")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ "${install_cert:-}" = 1 ]; then
 | 
					    if [ "${install_cert:-}" = 1 ]; then
 | 
				
			||||||
        source="mkcert"
 | 
					        source="mkcert"
 | 
				
			||||||
        wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh
 | 
					        wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh
 | 
				
			||||||
        source /tmp/raspap_${source}.sh && rm -f /tmp/raspap_${source}.sh
 | 
					        source /tmp/raspap_${source}.sh && rm -f /tmp/raspap_${source}.sh
 | 
				
			||||||
        _install_certificate || _install_status 1 "Unable to install certificate"
 | 
					        _install_certificate || _install_status 1 "Unable to install certificate"
 | 
				
			||||||
 | 
					    elif [ "${uninstall}" = 1 ]; then
 | 
				
			||||||
 | 
					        source="uninstall"
 | 
				
			||||||
 | 
					        wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh
 | 
				
			||||||
 | 
					        source /tmp/raspap_${source}.sh && rm -f /tmp/raspap_${source}.sh
 | 
				
			||||||
 | 
					        _remove_raspap || _install_status 1 "Unable to uninstall RaspAP"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        source="common"
 | 
					        source="common"
 | 
				
			||||||
        wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh
 | 
					        wget "${header[@]}" -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}.sh
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user