mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge billz/raspap-webgui master
This commit is contained in:
@@ -30,12 +30,17 @@ git_source_url="https://github.com/$repo" # $repo from install.raspap.com
|
||||
|
||||
# Prompts user to set installation options
|
||||
function _config_installation() {
|
||||
_install_log "Configure installation"
|
||||
if [ "$upgrade" == 1 ]; then
|
||||
opt=(Upgrade Upgrading upgrade)
|
||||
else
|
||||
opt=(Install Installing installation)
|
||||
fi
|
||||
_install_log "Configure ${opt[2]}"
|
||||
_get_linux_distro
|
||||
echo "Detected OS: ${DESC}"
|
||||
echo "Using GitHub repository: ${repo} ${branch} branch"
|
||||
echo "Install directory: ${raspap_dir}"
|
||||
echo -n "Install to lighttpd root: ${webroot_dir}? [Y/n]: "
|
||||
echo "Configuration directory: ${raspap_dir}"
|
||||
echo -n "lighttpd root: ${webroot_dir}? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
@@ -44,8 +49,12 @@ function _config_installation() {
|
||||
else
|
||||
echo -e
|
||||
fi
|
||||
echo "Installing to lighttpd directory: ${webroot_dir}"
|
||||
echo -n "Complete installation with these values? [Y/n]: "
|
||||
echo "${opt[1]} lighttpd directory: ${webroot_dir}"
|
||||
if [ "$upgrade" == 1 ]; then
|
||||
echo "This will upgrade your existing install to version ${RASPAP_LATEST}"
|
||||
echo "Your configuration will NOT be changed"
|
||||
fi
|
||||
echo -n "Complete ${opt[2]} with these values? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
@@ -57,7 +66,7 @@ function _config_installation() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Determines host Linux distrubtion details
|
||||
# Determines host Linux distribution details
|
||||
function _get_linux_distro() {
|
||||
if type lsb_release >/dev/null 2>&1; then # linuxbase.org
|
||||
OS=$(lsb_release -si)
|
||||
@@ -78,16 +87,16 @@ function _get_linux_distro() {
|
||||
# Sets php package option based on Linux version, abort if unsupported distro
|
||||
function _set_php_package() {
|
||||
case $RELEASE in
|
||||
"18.04"|"19.10") # Ubuntu Server
|
||||
18.04|19.10) # Ubuntu Server
|
||||
php_package="php7.4-cgi"
|
||||
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
|
||||
"10")
|
||||
10*)
|
||||
php_package="php7.3-cgi"
|
||||
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
|
||||
"9")
|
||||
9*)
|
||||
php_package="php7.0-cgi"
|
||||
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
|
||||
"8")
|
||||
8)
|
||||
_install_status 1 "${DESC} and php5 are not supported. Please upgrade." ;;
|
||||
*)
|
||||
_install_status 1 "${DESC} is unsupported. Please install on a supported distro." ;;
|
||||
@@ -327,6 +336,11 @@ function _download_latest_files() {
|
||||
git clone --branch $branch --depth 1 $git_source_url /tmp/raspap-webgui || _install_status 1 "Unable to download files from github"
|
||||
|
||||
sudo mv /tmp/raspap-webgui $webroot_dir || _install_status 1 "Unable to move raspap-webgui to web root"
|
||||
if [ "$upgrade" == 1 ]; then
|
||||
_install_log "Applying existing configuration to ${webroot_dir}/includes"
|
||||
sudo mv /tmp/config.php $webroot_dir/includes || _install_status 1 "Unable to move config.php to ${webroot_dir}/includes"
|
||||
fi
|
||||
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
@@ -342,33 +356,39 @@ function _change_file_ownership() {
|
||||
|
||||
# Check for existing configuration files
|
||||
function _check_for_old_configs() {
|
||||
if [ -f /etc/network/interfaces ]; then
|
||||
sudo cp /etc/network/interfaces "$raspap_dir/backups/interfaces.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/interfaces.`date +%F-%R`" "$raspap_dir/backups/interfaces"
|
||||
fi
|
||||
|
||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||
sudo cp /etc/hostapd/hostapd.conf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" "$raspap_dir/backups/hostapd.conf"
|
||||
fi
|
||||
|
||||
if [ -f $raspap_dnsmasq ]; then
|
||||
sudo cp $raspap_dnsmasq "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.conf"
|
||||
fi
|
||||
|
||||
if [ -f /etc/dhcpcd.conf ]; then
|
||||
sudo cp /etc/dhcpcd.conf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" "$raspap_dir/backups/dhcpcd.conf"
|
||||
fi
|
||||
|
||||
for file in /etc/systemd/network/raspap-*.net*; do
|
||||
if [ -f "${file}" ]; then
|
||||
filename=$(basename $file)
|
||||
sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`"
|
||||
sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}"
|
||||
if [ "$upgrade" == 1 ]; then
|
||||
_install_log "Moving existing configuration to /tmp"
|
||||
sudo mv $webroot_dir/includes/config.php /tmp || _install_status 1 "Unable to move config.php to /tmp"
|
||||
else
|
||||
_install_log "Backing up existing configs to ${raspap_dir}/backups"
|
||||
if [ -f /etc/network/interfaces ]; then
|
||||
sudo cp /etc/network/interfaces "$raspap_dir/backups/interfaces.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/interfaces.`date +%F-%R`" "$raspap_dir/backups/interfaces"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||
sudo cp /etc/hostapd/hostapd.conf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/hostapd.conf.`date +%F-%R`" "$raspap_dir/backups/hostapd.conf"
|
||||
fi
|
||||
|
||||
if [ -f $raspap_dnsmasq ]; then
|
||||
sudo cp $raspap_dnsmasq "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/dnsmasq.conf.`date +%F-%R`" "$raspap_dir/backups/dnsmasq.conf"
|
||||
fi
|
||||
|
||||
if [ -f /etc/dhcpcd.conf ]; then
|
||||
sudo cp /etc/dhcpcd.conf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`"
|
||||
sudo ln -sf "$raspap_dir/backups/dhcpcd.conf.`date +%F-%R`" "$raspap_dir/backups/dhcpcd.conf"
|
||||
fi
|
||||
|
||||
for file in /etc/systemd/network/raspap-*.net*; do
|
||||
if [ -f "${file}" ]; then
|
||||
filename=$(basename $file)
|
||||
sudo cp "$file" "${raspap_dir}/backups/${filename}.`date +%F-%R`"
|
||||
sudo ln -sf "${raspap_dir}/backups/${filename}.`date +%F-%R`" "${raspap_dir}/backups/${filename}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
@@ -385,29 +405,31 @@ function _move_config_file() {
|
||||
|
||||
# Set up default configuration
|
||||
function _default_configuration() {
|
||||
_install_log "Applying default configuration to installed services"
|
||||
if [ -f /etc/default/hostapd ]; then
|
||||
sudo mv /etc/default/hostapd /tmp/default_hostapd.old || _install_status 1 "Unable to remove old /etc/default/hostapd file"
|
||||
if [ "$upgrade" == 0 ]; then
|
||||
_install_log "Applying default configuration to installed services"
|
||||
if [ -f /etc/default/hostapd ]; then
|
||||
sudo mv /etc/default/hostapd /tmp/default_hostapd.old || _install_status 1 "Unable to remove old /etc/default/hostapd file"
|
||||
fi
|
||||
sudo cp $webroot_dir/config/default_hostapd /etc/default/hostapd || _install_status 1 "Unable to move hostapd defaults file"
|
||||
sudo cp $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || _install_status 1 "Unable to move hostapd configuration file"
|
||||
sudo cp $webroot_dir/config/dnsmasq.conf $raspap_dnsmasq || _install_status 1 "Unable to move dnsmasq configuration file"
|
||||
sudo cp $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || _install_status 1 "Unable to move dhcpcd configuration file"
|
||||
|
||||
echo "Checking for existence of /etc/dnsmasq.d"
|
||||
[ -d /etc/dnsmasq.d ] || sudo mkdir /etc/dnsmasq.d
|
||||
|
||||
echo "Copying bridged AP config to /etc/systemd/network"
|
||||
sudo systemctl stop systemd-networkd
|
||||
sudo systemctl disable systemd-networkd
|
||||
sudo cp $webroot_dir/config/raspap-bridge-br0.netdev /etc/systemd/network/raspap-bridge-br0.netdev || _install_status 1 "Unable to move br0 netdev file"
|
||||
sudo cp $webroot_dir/config/raspap-br0-member-eth0.network /etc/systemd/network/raspap-br0-member-eth0.network || _install_status 1 "Unable to move br0 member file"
|
||||
|
||||
echo "Copying primary RaspAP config to includes/config.php"
|
||||
if [ ! -f "$webroot_dir/includes/config.php" ]; then
|
||||
sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php"
|
||||
fi
|
||||
_install_status 0
|
||||
fi
|
||||
sudo cp $webroot_dir/config/default_hostapd /etc/default/hostapd || _install_status 1 "Unable to move hostapd defaults file"
|
||||
sudo cp $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || _install_status 1 "Unable to move hostapd configuration file"
|
||||
sudo cp $webroot_dir/config/dnsmasq.conf $raspap_dnsmasq || _install_status 1 "Unable to move dnsmasq configuration file"
|
||||
sudo cp $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || _install_status 1 "Unable to move dhcpcd configuration file"
|
||||
|
||||
echo "Checking for existence of /etc/dnsmasq.d"
|
||||
[ -d /etc/dnsmasq.d ] || sudo mkdir /etc/dnsmasq.d
|
||||
|
||||
echo "Copying bridged AP config to /etc/systemd/network"
|
||||
sudo systemctl stop systemd-networkd
|
||||
sudo systemctl disable systemd-networkd
|
||||
sudo cp $webroot_dir/config/raspap-bridge-br0.netdev /etc/systemd/network/raspap-bridge-br0.netdev || _install_status 1 "Unable to move br0 netdev file"
|
||||
sudo cp $webroot_dir/config/raspap-br0-member-eth0.network /etc/systemd/network/raspap-br0-member-eth0.network || _install_status 1 "Unable to move br0 member file"
|
||||
|
||||
echo "Copying primary RaspAP config to includes/config.php"
|
||||
if [ ! -f "$webroot_dir/includes/config.php" ]; then
|
||||
sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php"
|
||||
fi
|
||||
_install_status 0
|
||||
}
|
||||
|
||||
# Install and enable RaspAP daemon
|
||||
@@ -490,58 +512,65 @@ function _patch_system_files() {
|
||||
|
||||
# Optimize configuration of php-cgi.
|
||||
function _optimize_php() {
|
||||
_install_log "Optimize PHP configuration"
|
||||
if [ ! -f "$phpcgiconf" ]; then
|
||||
_install_warning "PHP configuration could not be found."
|
||||
return
|
||||
fi
|
||||
|
||||
# Backup php.ini and create symlink for restoring.
|
||||
datetimephpconf=$(date +%F-%R)
|
||||
sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf"
|
||||
sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini"
|
||||
|
||||
echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
echo -e
|
||||
else
|
||||
php_session_cookie=1;
|
||||
if [ "$upgrade" == 0 ]; then
|
||||
_install_log "Optimize PHP configuration"
|
||||
if [ ! -f "$phpcgiconf" ]; then
|
||||
_install_warning "PHP configuration could not be found."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$assume_yes" == 1 ] || [ "$php_session_cookie" == 1 ]; then
|
||||
echo "Php-cgi enabling session.cookie_httponly."
|
||||
sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf"
|
||||
fi
|
||||
# Backup php.ini and create symlink for restoring.
|
||||
datetimephpconf=$(date +%F-%R)
|
||||
sudo cp "$phpcgiconf" "$raspap_dir/backups/php.ini.$datetimephpconf"
|
||||
sudo ln -sf "$raspap_dir/backups/php.ini.$datetimephpconf" "$raspap_dir/backups/php.ini"
|
||||
|
||||
if [ "$php_package" = "php7.1-cgi" ]; then
|
||||
echo -n "Enable PHP OPCache (Recommended)? [Y/n]: "
|
||||
echo -n "Enable HttpOnly for session cookies (Recommended)? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
echo -e
|
||||
else
|
||||
php_opcache=1;
|
||||
php_session_cookie=1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$assume_yes" == 1 ] || [ "$phpopcache" == 1 ]; then
|
||||
echo -e "Php-cgi enabling opcache.enable."
|
||||
sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf"
|
||||
# Make sure opcache extension is turned on.
|
||||
if [ -f "/usr/sbin/phpenmod" ]; then
|
||||
sudo phpenmod opcache
|
||||
else
|
||||
_install_status 2 "phpenmod not found."
|
||||
if [ "$assume_yes" == 1 ] || [ "$php_session_cookie" == 1 ]; then
|
||||
echo "Php-cgi enabling session.cookie_httponly."
|
||||
sudo sed -i -E 's/^session\.cookie_httponly\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/session.cookie_httponly = 1/' "$phpcgiconf"
|
||||
fi
|
||||
|
||||
if [ "$php_package" = "php7.1-cgi" ]; then
|
||||
echo -n "Enable PHP OPCache (Recommended)? [Y/n]: "
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
read answer < /dev/tty
|
||||
if [ "$answer" != "${answer#[Nn]}" ]; then
|
||||
echo -e
|
||||
else
|
||||
php_opcache=1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$assume_yes" == 1 ] || [ "$phpopcache" == 1 ]; then
|
||||
echo -e "Php-cgi enabling opcache.enable."
|
||||
sudo sed -i -E 's/^;?opcache\.enable\s*=\s*(0|([O|o]ff)|([F|f]alse)|([N|n]o))\s*$/opcache.enable = 1/' "$phpcgiconf"
|
||||
# Make sure opcache extension is turned on.
|
||||
if [ -f "/usr/sbin/phpenmod" ]; then
|
||||
sudo phpenmod opcache
|
||||
else
|
||||
_install_status 2 "phpenmod not found."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _install_complete() {
|
||||
_install_log "Installation completed!"
|
||||
_install_log "Installation completed"
|
||||
echo "This project needs your help! Please consider supporting RaspAP on Open Collective or GitHub:"
|
||||
echo -e "${ANSI_RASPBERRY}"
|
||||
echo "> https://opencollective.com/raspap"
|
||||
echo "> https://github.com/sponsors/billz"
|
||||
echo -e "${ANSI_RESET}"
|
||||
if [ "$assume_yes" == 0 ]; then
|
||||
# Prompt to reboot if wired ethernet (eth0) is connected.
|
||||
# With default_configuration this will create an active AP on restart.
|
||||
|
@@ -1,12 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Updates lighttpd server.port and restarts the service
|
||||
# Updates lighttpd config settings and restarts the service
|
||||
# @author billz
|
||||
# license: GNU General Public License v3.0
|
||||
|
||||
# Exit on error
|
||||
set -o errexit
|
||||
# Exit on error inside functions
|
||||
set -o errtrace
|
||||
# Turn on traces, disabled by default
|
||||
#set -o xtrace
|
||||
|
||||
server_port=$1
|
||||
lighttpd_conf=$2
|
||||
host=$3
|
||||
server_bind=$2
|
||||
lighttpd_conf=$3
|
||||
host=$4
|
||||
restart_service=0
|
||||
|
||||
while :; do
|
||||
@@ -25,11 +33,22 @@ if [ "$restart_service" = 1 ]; then
|
||||
echo "Restarting lighttpd in 3 seconds..."
|
||||
sleep 3
|
||||
systemctl restart lighttpd.service
|
||||
else
|
||||
echo "Changing lighttpd server.port to $server_port..."
|
||||
fi
|
||||
if [ -n "$server_port" ]; then
|
||||
echo "Changing lighttpd server.port to $server_port ..."
|
||||
sed -i "s/^\(server\.port *= *\)[0-9]*/\1$server_port/g" "$lighttpd_conf"
|
||||
|
||||
echo "RaspAP will now be available at $host:$server_port"
|
||||
echo "Restart lighttpd for new setting to take effect"
|
||||
echo "RaspAP will now be available at port $server_port"
|
||||
conf_change=1
|
||||
fi
|
||||
if [ -n "$server_bind" ]; then
|
||||
echo "Changing lighttpd server.bind to $server_bind ..."
|
||||
grep -q 'server.bind' "$lighttpd_conf" && \
|
||||
sed -i "s/^\(server\.bind.*= \)\".*\"*/\1\"$server_bind\"/g" "$lighttpd_conf" || \
|
||||
printf "server.bind \t\t\t\t = \"$server_bind\"\n" >> "$lighttpd_conf"
|
||||
echo "RaspAP will now be available at address $server_bind"
|
||||
conf_change=1
|
||||
fi
|
||||
if [ "$conf_change" == 1 ]; then
|
||||
echo "Restart lighttpd for new settings to take effect"
|
||||
fi
|
||||
|
||||
|
@@ -7,7 +7,7 @@ www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_suppli
|
||||
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan_results
|
||||
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan
|
||||
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] reconfigure
|
||||
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] select_network
|
||||
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] select_network [0-9]*
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/hostapddata /etc/hostapd/hostapd.conf
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/systemctl start hostapd.service
|
||||
www-data ALL=(ALL) NOPASSWD:/bin/systemctl stop hostapd.service
|
||||
|
@@ -22,6 +22,8 @@
|
||||
# Overrides the default git branch (master)
|
||||
# -h, --help
|
||||
# Outputs usage notes and exits
|
||||
# -u, --upgrade
|
||||
# Upgrades an existing installation to the latest release version
|
||||
# -v, --version
|
||||
# Outputs release info and exits
|
||||
#
|
||||
@@ -39,6 +41,7 @@
|
||||
repo="billz/raspap-webgui"
|
||||
branch="master"
|
||||
assume_yes=0
|
||||
upgrade=0
|
||||
ovpn_option=1
|
||||
adblock_option=1
|
||||
wg_option=1
|
||||
@@ -65,6 +68,7 @@ Usage: raspbian.sh [OPTION]\n
|
||||
-r, --repo, --repository <name>\n\tOverrides the default GitHub repo (billz/raspap-webgui)
|
||||
-b, --branch <name>\n\tOverrides the default git branch (master)
|
||||
-h, --help\n\tOutputs usage notes and exits
|
||||
-u, --upgrade\n\tUpgrades an existing installation to the latest release version
|
||||
-v, --version\n\tOutputs release info and exits\n
|
||||
EOF
|
||||
)
|
||||
@@ -103,6 +107,9 @@ while :; do
|
||||
printf "$usage"
|
||||
exit 1
|
||||
;;
|
||||
-u|--upgrade)
|
||||
upgrade=1
|
||||
;;
|
||||
-v|--version)
|
||||
printf "RaspAP v${RASPAP_LATEST} - Simple AP setup & WiFi management for Debian-based devices\n"
|
||||
exit 1
|
||||
@@ -141,6 +148,11 @@ function _install_log() {
|
||||
echo -e "${ANSI_GREEN}RaspAP Install: $1${ANSI_RESET}"
|
||||
}
|
||||
|
||||
# Outputs a RaspAP divider
|
||||
function _install_divider() {
|
||||
echo -e "\033[1;32m***************************************************************$*\033[m"
|
||||
}
|
||||
|
||||
# Outputs a RaspAP status indicator
|
||||
function _install_status() {
|
||||
case $1 in
|
||||
|
@@ -20,6 +20,7 @@ readonly raspap_user="www-data"
|
||||
readonly raspap_sudoers="/etc/sudoers.d/090_raspap"
|
||||
readonly raspap_dnsmasq="/etc/dnsmasq.d/090_raspap.conf"
|
||||
readonly raspap_sysctl="/etc/sysctl.d/90_raspap.conf"
|
||||
readonly raspap_network="/etc/systemd/network/"
|
||||
readonly rulesv4="/etc/iptables/rules.v4"
|
||||
webroot_dir="/var/www/html"
|
||||
|
||||
@@ -44,13 +45,13 @@ function _get_linux_distro() {
|
||||
# Sets php package option based on Linux version, abort if unsupported distro
|
||||
function _set_php_package() {
|
||||
case $RELEASE in
|
||||
"18.04"|"19.10") # Ubuntu Server
|
||||
18.04|19.10) # Ubuntu Server
|
||||
php_package="php7.4-cgi"
|
||||
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
|
||||
"10")
|
||||
10*)
|
||||
php_package="php7.3-cgi"
|
||||
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
|
||||
"9")
|
||||
9*)
|
||||
php_package="php7.0-cgi"
|
||||
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
|
||||
esac
|
||||
@@ -148,7 +149,7 @@ function _remove_raspap_service() {
|
||||
function _restore_networking() {
|
||||
_install_log "Restoring networking config to pre-install defaults"
|
||||
echo "Disabling IP forwarding in $raspap_sysctl"
|
||||
sudo rm $raspap_sysctl || _install_error "Unable to remove $raspap_sysctl"
|
||||
sudo rm "$raspap_sysctl" || _install_error "Unable to remove $raspap_sysctl"
|
||||
sudo /etc/init.d/procps restart || _install_error "Unable to execute procps"
|
||||
echo "Checking iptables rules"
|
||||
rules=(
|
||||
@@ -169,6 +170,11 @@ function _restore_networking() {
|
||||
sudo iptables-save | sudo tee $rulesv4 > /dev/null || _install_error "Unable to execute iptables-save"
|
||||
fi
|
||||
echo "Done."
|
||||
# Remove dnsmasq and bridge configs
|
||||
echo "Removing 090_raspap.conf from dnsmasq"
|
||||
sudo rm "$raspap_dnsmasq" || _install_error "Unable to remove $raspap_dnsmasq"
|
||||
echo "Removing raspap bridge configurations"
|
||||
sudo rm "$raspap_network"/raspap* || _install_error "Unable to remove bridge config"
|
||||
}
|
||||
|
||||
# Removes installed packages
|
||||
|
Reference in New Issue
Block a user