mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Merge pull request #1442 from RaspAP/maint/script-updates
Updates to support latest Debian distros
This commit is contained in:
commit
b24c0ff862
@ -286,11 +286,12 @@ function _create_hostapd_scripts() {
|
|||||||
_install_log "Creating hostapd logging & control scripts"
|
_install_log "Creating hostapd logging & control scripts"
|
||||||
sudo mkdir $raspap_dir/hostapd || _install_status 1 "Unable to create directory '$raspap_dir/hostapd'"
|
sudo mkdir $raspap_dir/hostapd || _install_status 1 "Unable to create directory '$raspap_dir/hostapd'"
|
||||||
|
|
||||||
# Move logging shell scripts
|
# Copy logging shell scripts
|
||||||
sudo cp "$webroot_dir/installers/"*log.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts"
|
sudo cp "$webroot_dir/installers/"enablelog.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts"
|
||||||
# Move service control shell scripts
|
sudo cp "$webroot_dir/installers/"disablelog.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move logging scripts"
|
||||||
sudo cp "$webroot_dir/installers/"service*.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move service control scripts"
|
# Copy service control shell scripts
|
||||||
# Make enablelog.sh and disablelog.sh not writable by www-data group.
|
sudo cp "$webroot_dir/installers/"servicestart.sh "$raspap_dir/hostapd" || _install_status 1 "Unable to move service control scripts"
|
||||||
|
# Change ownership and permissions of hostapd control scripts
|
||||||
sudo chown -c root:root "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable change owner and/or group"
|
sudo chown -c root:root "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable change owner and/or group"
|
||||||
sudo chmod 750 "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable to change file permissions"
|
sudo chmod 750 "$raspap_dir/hostapd/"*.sh || _install_status 1 "Unable to change file permissions"
|
||||||
_install_status 0
|
_install_status 0
|
||||||
@ -301,10 +302,10 @@ function _create_lighttpd_scripts() {
|
|||||||
_install_log "Creating lighttpd control scripts"
|
_install_log "Creating lighttpd control scripts"
|
||||||
sudo mkdir $raspap_dir/lighttpd || _install_status 1 "Unable to create directory '$raspap_dir/lighttpd"
|
sudo mkdir $raspap_dir/lighttpd || _install_status 1 "Unable to create directory '$raspap_dir/lighttpd"
|
||||||
|
|
||||||
# Move service control shell scripts
|
# Copy service control shell scripts
|
||||||
echo "Copying configport.sh to $raspap_dir/lighttpd"
|
echo "Copying configport.sh to $raspap_dir/lighttpd"
|
||||||
sudo cp "$webroot_dir/installers/"configport.sh "$raspap_dir/lighttpd" || _install_status 1 "Unable to move service control scripts"
|
sudo cp "$webroot_dir/installers/"configport.sh "$raspap_dir/lighttpd" || _install_status 1 "Unable to move service control scripts"
|
||||||
# Make configport.sh writable by www-data group
|
# Change ownership and permissions of lighttpd scripts
|
||||||
echo "Changing file ownership"
|
echo "Changing file ownership"
|
||||||
sudo chown -c root:root "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable change owner and/or group"
|
sudo chown -c root:root "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable change owner and/or group"
|
||||||
sudo chmod 750 "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable to change file permissions"
|
sudo chmod 750 "$raspap_dir/lighttpd/"*.sh || _install_status 1 "Unable to change file permissions"
|
||||||
@ -539,18 +540,12 @@ function _create_openvpn_scripts() {
|
|||||||
_install_log "Creating OpenVPN control scripts"
|
_install_log "Creating OpenVPN control scripts"
|
||||||
sudo mkdir $raspap_dir/openvpn || _install_status 1 "Unable to create directory '$raspap_dir/openvpn'"
|
sudo mkdir $raspap_dir/openvpn || _install_status 1 "Unable to create directory '$raspap_dir/openvpn'"
|
||||||
|
|
||||||
_install_log "Creating RaspAP debug log control script"
|
# Copy service auth control and logging scripts
|
||||||
sudo mkdir $raspap_dir/system || _install_status 1 "Unable to create directory '$raspap_dir/system'"
|
|
||||||
|
|
||||||
# Move service auth control, logging and debug shell scripts
|
|
||||||
sudo cp "$webroot_dir/installers/"configauth.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move auth control script"
|
sudo cp "$webroot_dir/installers/"configauth.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move auth control script"
|
||||||
sudo cp "$webroot_dir/installers/"openvpnlog.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move logging script"
|
sudo cp "$webroot_dir/installers/"openvpnlog.sh "$raspap_dir/openvpn" || _install_status 1 "Unable to move logging script"
|
||||||
sudo cp "$webroot_dir/installers/"debuglog.sh "$raspap_dir/system" || _install_status 1 "Unable to move debug logging script"
|
|
||||||
# Restrict script execution to root user
|
# Restrict script execution to root user
|
||||||
sudo chown -c root:root "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable change owner and/or group"
|
sudo chown -c root:root "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable change owner and/or group"
|
||||||
sudo chmod 750 "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable to change file permissions"
|
sudo chmod 750 "$raspap_dir/openvpn/"*.sh || _install_status 1 "Unable to change file permissions"
|
||||||
sudo chown -c root:root "$raspap_dir/system/"*.sh || _install_status 1 "Unable change owner and/or group"
|
|
||||||
sudo chmod 750 "$raspap_dir/system/"*.sh || _install_status 1 "Unable to change file permissions"
|
|
||||||
|
|
||||||
_install_status 0
|
_install_status 0
|
||||||
}
|
}
|
||||||
@ -750,6 +745,16 @@ function _patch_system_files() {
|
|||||||
sudo cp "$webroot_dir/installers/raspap.sudoers" $raspap_sudoers || _install_status 1 "Unable to apply raspap.sudoers to $raspap_sudoers"
|
sudo cp "$webroot_dir/installers/raspap.sudoers" $raspap_sudoers || _install_status 1 "Unable to apply raspap.sudoers to $raspap_sudoers"
|
||||||
sudo chmod 0440 $raspap_sudoers || _install_status 1 "Unable to change file permissions for $raspap_sudoers"
|
sudo chmod 0440 $raspap_sudoers || _install_status 1 "Unable to change file permissions for $raspap_sudoers"
|
||||||
|
|
||||||
|
install_log "Creating RaspAP debug log control script"
|
||||||
|
sudo mkdir $raspap_dir/system || _install_status 1 "Unable to create directory '$raspap_dir/system'"
|
||||||
|
|
||||||
|
# Copy debug shell script
|
||||||
|
sudo cp "$webroot_dir/installers/"debuglog.sh "$raspap_dir/system" || _install_status 1 "Unable to move debug logging script"
|
||||||
|
|
||||||
|
# Set ownership and permissions
|
||||||
|
sudo chown -c root:root "$raspap_dir/system/"*.sh || _install_status 1 "Unable change owner and/or group"
|
||||||
|
sudo chmod 750 "$raspap_dir/system/"*.sh || _install_status 1 "Unable to change file permissions"
|
||||||
|
|
||||||
# Add symlink to prevent wpa_cli cmds from breaking with multiple wlan interfaces
|
# Add symlink to prevent wpa_cli cmds from breaking with multiple wlan interfaces
|
||||||
_install_log "Symlinked wpa_supplicant hooks for multiple wlan interfaces"
|
_install_log "Symlinked wpa_supplicant hooks for multiple wlan interfaces"
|
||||||
if [ ! -f /usr/share/dhcpcd/hooks/10-wpa_supplicant ]; then
|
if [ ! -f /usr/share/dhcpcd/hooks/10-wpa_supplicant ]; then
|
||||||
|
@ -108,6 +108,7 @@ function _generate_log() {
|
|||||||
_usb_info
|
_usb_info
|
||||||
_wpa_info
|
_wpa_info
|
||||||
_dnsmasq_info
|
_dnsmasq_info
|
||||||
|
_dhcpcd_info
|
||||||
_interface_info
|
_interface_info
|
||||||
_routing_info
|
_routing_info
|
||||||
_iw_dev_info
|
_iw_dev_info
|
||||||
@ -218,6 +219,17 @@ function _dnsmasq_info() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _dhcpcd_info() {
|
||||||
|
_log_separator "Dhcpcd Contents"
|
||||||
|
if [ -f "${RASPAP_DHCDPCD}" ]; then
|
||||||
|
local stdout=$(cat ${RASPAP_DHCDPCD});
|
||||||
|
_log_write "${stdout}"
|
||||||
|
|
||||||
|
else
|
||||||
|
_log_write "${RASPAP_DHCDPCD} not present"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function _interface_info() {
|
function _interface_info() {
|
||||||
local stdout=$(ip a)
|
local stdout=$(ip a)
|
||||||
_log_separator "Interfaces"
|
_log_separator "Interfaces"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# License: GNU General Public License v3.0
|
# License: GNU General Public License v3.0
|
||||||
# License URI: https://github.com/raspap/raspap-webgui/blob/master/LICENSE
|
# License URI: https://github.com/raspap/raspap-webgui/blob/master/LICENSE
|
||||||
#
|
#
|
||||||
# Usage: raspbian.sh options
|
# Usage: raspbian.sh [options]
|
||||||
#
|
#
|
||||||
# Installs an instance of RaspAP.
|
# Installs an instance of RaspAP.
|
||||||
#
|
#
|
||||||
@ -15,6 +15,7 @@
|
|||||||
# -c, --cert, --certficate Installs mkcert and generates an SSL certificate for lighttpd
|
# -c, --cert, --certficate Installs mkcert and generates an SSL certificate for lighttpd
|
||||||
# -o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
# -o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
||||||
# -a, --adblock <flag> Used with -y, --yes, sets Adblock install option (0=no install)
|
# -a, --adblock <flag> Used with -y, --yes, sets Adblock install option (0=no install)
|
||||||
|
# -w, --wireguard <flag> 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
|
# -c, --cert, --certificate Installs an SSL certificate with mkcert and configures lighttpd for HTTPS
|
||||||
# -r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
# -r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
||||||
# -b, --branch <name> Overrides the default git branch (master)
|
# -b, --branch <name> Overrides the default git branch (master)
|
||||||
@ -59,6 +60,7 @@ function _parse_params() {
|
|||||||
upgrade=0
|
upgrade=0
|
||||||
ovpn_option=1
|
ovpn_option=1
|
||||||
adblock_option=1
|
adblock_option=1
|
||||||
|
wg_option=1
|
||||||
insiders=0
|
insiders=0
|
||||||
minwrite=0
|
minwrite=0
|
||||||
acctoken=""
|
acctoken=""
|
||||||
@ -77,6 +79,10 @@ function _parse_params() {
|
|||||||
adblock_option="$2"
|
adblock_option="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-w|--wireguard)
|
||||||
|
wg_option="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-c|--cert|--certificate)
|
-c|--cert|--certificate)
|
||||||
install_cert=1
|
install_cert=1
|
||||||
;;
|
;;
|
||||||
@ -150,6 +156,7 @@ OPTIONS:
|
|||||||
-c, --cert, --certificate Installs an SSL certificate for lighttpd
|
-c, --cert, --certificate Installs an SSL certificate for lighttpd
|
||||||
-o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
-o, --openvpn <flag> Used with -y, --yes, sets OpenVPN install option (0=no install)
|
||||||
-a, --adblock <flag> Used with -y, --yes, sets Adblock install option (0=no install)
|
-a, --adblock <flag> Used with -y, --yes, sets Adblock install option (0=no install)
|
||||||
|
-w, --wireguard <flag> 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
|
-c, --cert, --certificate Installs an SSL certificate with mkcert and configures lighttpd for HTTPS
|
||||||
-r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
-r, --repo, --repository <name> Overrides the default GitHub repo (RaspAP/raspap-webgui)
|
||||||
-b, --branch <name> Overrides the default git branch (latest release)
|
-b, --branch <name> Overrides the default git branch (latest release)
|
||||||
|
@ -26,13 +26,14 @@ readonly raspap_network="/etc/systemd/network/"
|
|||||||
readonly rulesv4="/etc/iptables/rules.v4"
|
readonly rulesv4="/etc/iptables/rules.v4"
|
||||||
webroot_dir="/var/www/html"
|
webroot_dir="/var/www/html"
|
||||||
|
|
||||||
# Determines host Linux distrubtion details
|
# Determines host Linux distribution details
|
||||||
function _get_linux_distro() {
|
function _get_linux_distro() {
|
||||||
if type lsb_release >/dev/null 2>&1; then # linuxbase.org
|
if type lsb_release >/dev/null 2>&1; then # linuxbase.org
|
||||||
OS=$(lsb_release -si)
|
OS=$(lsb_release -si)
|
||||||
RELEASE=$(lsb_release -sr)
|
RELEASE=$(lsb_release -sr)
|
||||||
CODENAME=$(lsb_release -sc)
|
CODENAME=$(lsb_release -sc)
|
||||||
DESC=$(lsb_release -sd)
|
DESC=$(lsb_release -sd)
|
||||||
|
LONG_BIT=$(getconf LONG_BIT)
|
||||||
elif [ -f /etc/os-release ]; then # freedesktop.org
|
elif [ -f /etc/os-release ]; then # freedesktop.org
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
OS=$ID
|
OS=$ID
|
||||||
@ -47,15 +48,27 @@ function _get_linux_distro() {
|
|||||||
# Sets php package option based on Linux version, abort if unsupported distro
|
# Sets php package option based on Linux version, abort if unsupported distro
|
||||||
function _set_php_package() {
|
function _set_php_package() {
|
||||||
case $RELEASE in
|
case $RELEASE in
|
||||||
18.04|19.10) # Ubuntu Server
|
23.05|12*) # Debian 12 & Armbian 23.05
|
||||||
|
php_package="php8.2-cgi"
|
||||||
|
phpcgiconf="/etc/php/8.2/cgi/php.ini" ;;
|
||||||
|
23.04) # Ubuntu Server 23.04
|
||||||
|
php_package="php8.1-cgi"
|
||||||
|
phpcgiconf="/etc/php/8.1/cgi/php.ini" ;;
|
||||||
|
22.04|20.04|18.04|19.10|11*) # Previous Ubuntu Server, Debian & Armbian distros
|
||||||
php_package="php7.4-cgi"
|
php_package="php7.4-cgi"
|
||||||
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
|
phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
|
||||||
10*)
|
10*|11*)
|
||||||
php_package="php7.3-cgi"
|
php_package="php7.3-cgi"
|
||||||
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
|
phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
|
||||||
9*)
|
9*)
|
||||||
php_package="php7.0-cgi"
|
php_package="php7.0-cgi"
|
||||||
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
|
phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
|
||||||
|
8)
|
||||||
|
_install_error "${DESC} and php5 are unsupported."
|
||||||
|
exit 1 ;;
|
||||||
|
*)
|
||||||
|
_install_error "${DESC} is unsupported."
|
||||||
|
exit 1 ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +87,7 @@ function _install_error() {
|
|||||||
function _config_uninstallation() {
|
function _config_uninstallation() {
|
||||||
_install_log "Configure uninstall of RaspAP"
|
_install_log "Configure uninstall of RaspAP"
|
||||||
_get_linux_distro
|
_get_linux_distro
|
||||||
echo "Detected ${DESC}"
|
echo "Detected OS: ${DESC} ${LONG_BIT}-bit"
|
||||||
echo "RaspAP install directory: ${raspap_dir}"
|
echo "RaspAP install directory: ${raspap_dir}"
|
||||||
echo -n "Lighttpd install directory: ${webroot_dir}? [Y/n]: "
|
echo -n "Lighttpd install directory: ${webroot_dir}? [Y/n]: "
|
||||||
read answer
|
read answer
|
||||||
@ -195,16 +208,23 @@ function _restore_networking() {
|
|||||||
function _remove_installed_packages() {
|
function _remove_installed_packages() {
|
||||||
_install_log "Removing installed packages"
|
_install_log "Removing installed packages"
|
||||||
_set_php_package
|
_set_php_package
|
||||||
|
|
||||||
|
# Set default
|
||||||
|
dhcpcd_package="dnsmasq"
|
||||||
|
|
||||||
if [ ${OS,,} = "debian" ] || [ ${OS,,} = "ubuntu" ]; then
|
if [ ${OS,,} = "debian" ] || [ ${OS,,} = "ubuntu" ]; then
|
||||||
dhcpcd_package="dhcpcd5"
|
dhcpcd_package="dhcpcd5"
|
||||||
else
|
iw_package="iw"
|
||||||
dhcpcd_package="dnsmasq"
|
|
||||||
fi
|
fi
|
||||||
echo -n "Remove the following installed packages? lighttpd hostapd iptables-persistent $php_package $dhcpcd_package vnstat qrencode [y/N]: "
|
if [ ${OS,,} = "raspbian" ] && [[ ${RELEASE} =~ ^(12) ]]; then
|
||||||
|
dhcpcd_package="dhcpcd dhcpcd-base"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Remove the following installed packages? lighttpd hostapd iptables-persistent $php_package $dhcpcd_package $iw_package vnstat qrencode jq [y/N]: "
|
||||||
read answer
|
read answer
|
||||||
if [ "$answer" == 'y' ] || [ "$answer" == 'Y' ]; then
|
if [ "$answer" == 'y' ] || [ "$answer" == 'Y' ]; then
|
||||||
echo "Removing packages."
|
echo "Removing packages."
|
||||||
sudo apt-get remove lighttpd hostapd iptables-persistent $php_package $dhcpcd_package vnstat qrencode || _install_error "Unable to remove installed packages"
|
sudo apt-get remove lighttpd hostapd iptables-persistent $php_package $dhcpcd_package $iw_package vnstat qrencode jq || _install_error "Unable to remove installed packages"
|
||||||
sudo apt-get autoremove || _install_error "Unable to run apt autoremove"
|
sudo apt-get autoremove || _install_error "Unable to run apt autoremove"
|
||||||
else
|
else
|
||||||
echo "Leaving packages installed."
|
echo "Leaving packages installed."
|
||||||
@ -230,7 +250,7 @@ function _remove_lighttpd_config() {
|
|||||||
|
|
||||||
function _uninstall_complete() {
|
function _uninstall_complete() {
|
||||||
_install_log "Uninstall completed"
|
_install_log "Uninstall completed"
|
||||||
echo "It is recommended that you reboot your system as a final step."
|
echo "Check your network configuration before rebooting to ensure access."
|
||||||
}
|
}
|
||||||
|
|
||||||
function _remove_raspap() {
|
function _remove_raspap() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user