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

Update w/ OS, version detect & install dhcpcd5

This commit is contained in:
billz 2020-03-17 11:55:40 +00:00
parent e5c60ec0c1
commit 8e148e683b

View File

@ -7,24 +7,33 @@
raspap_dir="/etc/raspap" raspap_dir="/etc/raspap"
raspap_user="www-data" raspap_user="www-data"
webroot_dir="/var/www/html" webroot_dir="/var/www/html"
version=`sed 's/\..*//' /etc/debian_version`
git_source_url="https://github.com/$repo" # $repo from install.raspap.com git_source_url="https://github.com/$repo" # $repo from install.raspap.com
# Determine Raspbian version, set default home location for lighttpd and if type lsb_release >/dev/null 2>&1; then # linuxbase.org
# php package to install OS=$(lsb_release -si)
if [ "$version" -eq "10" ]; then VERSION=$(lsb_release -sr)
version_msg="Raspbian 10.0 (Buster)" CODENAME=$(lsb_release -sc)
php_package="php7.3-cgi" DESC=$(lsb_release -sd)
elif [ "$version" -eq "9" ]; then else
version_msg="Raspbian 9.0 (Stretch)" install_error "Unsupported Linux distribution"
php_package="php7.0-cgi" fi
elif [ "$version" -eq "8" ]; then
install_error "Raspbian 8.0 (Jessie) and php5 are deprecated. Please upgrade." # Set default home for lighttpd, dhcpcd5 and php package option
elif [ "$version" -lt "8" ]; then # based on Linux OS, version
install_error "Raspbian ${version} is unsupported. Please upgrade." if [ "$VERSION" -eq "10" ]; then
php_package="php7.3-cgi"
elif [ "$VERSION" -eq "9" ]; then
php_package="php7.0-cgi"
elif [ "$VERSION" -eq "8" ]; then
install_error "${DESC} and php5 are not supported. Please upgrade."
elif [ "$VERSION" -lt "8" ]; then
install_error "${DESC} is unsupported. Please install on a supported distro."
fi
if [ "$OS" -eq "Debian" ]; then
dhcpcd_package="dhcpcd5"
fi fi
phpcgiconf=""
if [ "$php_package" = "php7.3-cgi" ]; then if [ "$php_package" = "php7.3-cgi" ]; then
phpcgiconf="/etc/php/7.3/cgi/php.ini" phpcgiconf="/etc/php/7.3/cgi/php.ini"
elif [ "$php_package" = "php7.0-cgi" ]; then elif [ "$php_package" = "php7.0-cgi" ]; then
@ -36,7 +45,7 @@ fi
# Prompts user to set options for installation # Prompts user to set options for installation
function config_installation() { function config_installation() {
install_log "Configure installation" install_log "Configure installation"
echo "Detected ${version_msg}" echo "Detected ${DESC}"
echo "Install directory: ${raspap_dir}" echo "Install directory: ${raspap_dir}"
echo -n "Install to Lighttpd root directory: ${webroot_dir}? [Y/n]: " echo -n "Install to Lighttpd root directory: ${webroot_dir}? [Y/n]: "
if [ "$assume_yes" == 0 ]; then if [ "$assume_yes" == 0 ]; then
@ -64,7 +73,7 @@ function config_installation() {
# Runs a system software update to make sure we're using all fresh packages # Runs a system software update to make sure we're using all fresh packages
function install_dependencies() { function install_dependencies() {
install_log "Installing required packages" install_log "Installing required packages"
sudo apt-get install $apt_option lighttpd $php_package git hostapd dnsmasq dhcpcd5 vnstat qrencode || install_error "Unable to install dependencies" sudo apt-get install $apt_option lighttpd git hostapd dnsmasq $php_package $dhcpcd_package vnstat qrencode || install_error "Unable to install dependencies"
} }
# Enables PHP for lighttpd and restarts service for settings to take effect # Enables PHP for lighttpd and restarts service for settings to take effect