mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Generalize installer
This commit is contained in:
parent
cf63968ca3
commit
de56289ca6
@ -9,36 +9,79 @@
|
||||
|
||||
UPDATE_URL="https://raw.githubusercontent.com/billz/raspap-webgui/master/"
|
||||
VERSION=$(curl -s https://api.github.com/repos/billz/raspap-webgui/releases/latest | jq -r .tag_name)
|
||||
wget -q ${UPDATE_URL}/installers/common.sh -O /tmp/raspapcommon.sh
|
||||
source /tmp/raspapcommon.sh && rm -f /tmp/raspapcommon.sh
|
||||
|
||||
USAGE="Usage: -y, --yes, --assume-yes, -c --cert"
|
||||
assume_yes=0
|
||||
positional=()
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-y|--yes|--assume-yes)
|
||||
assume_yes=1
|
||||
apt_option="-y"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
*) # unknown option
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
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
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Outputs a welcome message
|
||||
function display_welcome() {
|
||||
raspberry='\033[0;35m'
|
||||
green='\033[1;32m'
|
||||
|
||||
echo -e "${raspberry}\n"
|
||||
echo -e " 888888ba .d888888 888888ba"
|
||||
echo -e " 88 8b d8 88 88 8b"
|
||||
echo -e "a88aaaa8P' .d8888b. .d8888b. 88d888b. 88aaaaa88a a88aaaa8P"
|
||||
echo -e " 88 8b. 88 88 Y8ooooo. 88 88 88 88 88"
|
||||
echo -e " 88 88 88. .88 88 88. .88 88 88 88"
|
||||
echo -e " dP dP 88888P8 88888P 88Y888P 88 88 dP"
|
||||
echo -e " 88"
|
||||
echo -e " dP version ${VERSION}"
|
||||
echo -e "${green}"
|
||||
echo -e "The Quick Installer will guide you through a few easy steps\n\n"
|
||||
}
|
||||
|
||||
# Outputs a RaspAP Install log line
|
||||
function install_log() {
|
||||
echo -e "\033[1;32mRaspAP Install: $*\033[m"
|
||||
}
|
||||
|
||||
# Outputs a RaspAP Install Error log line and exits with status code 1
|
||||
function install_error() {
|
||||
echo -e "\033[1;37;41mRaspAP Install Error: $*\033[m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Outputs a RaspAP Warning line
|
||||
function install_warning() {
|
||||
echo -e "\033[1;33mWarning: $*\033[m"
|
||||
}
|
||||
|
||||
function update_system_packages() {
|
||||
install_log "Updating sources"
|
||||
sudo apt-get update || install_error "Unable to update package list"
|
||||
}
|
||||
|
||||
function install_dependencies() {
|
||||
install_log "Installing required packages"
|
||||
sudo apt-get install $apt_option lighttpd $php_package git hostapd dnsmasq vnstat || install_error "Unable to install dependencies"
|
||||
}
|
||||
if [ "${install_cert:-}" = 1 ]; then
|
||||
source="mkcert"
|
||||
#wget -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}
|
||||
echo "${UPDATE_URL}installers/${source}.sh -O /tmp/raspap_${source}"
|
||||
source /var/www/html/installers/${source}.sh
|
||||
install_certificate
|
||||
else
|
||||
source="common"
|
||||
#wget -q ${UPDATE_URL}installers/${source}.sh -O /tmp/raspap$_{source}
|
||||
echo "${UPDATE_URL}installers/${source}.sh -O /tmp/raspap$_{source}"
|
||||
source /var/www/html/installers/${source}.sh
|
||||
install_raspap
|
||||
fi
|
||||
|
||||
|
||||
install_raspap
|
||||
|
Loading…
Reference in New Issue
Block a user