Create configure_networking

This commit is contained in:
billz 2020-03-21 08:07:40 +00:00
parent 0b135fb231
commit 15d829c0b1
1 changed files with 32 additions and 35 deletions

View File

@ -28,31 +28,23 @@ else
install_error "Unsupported Linux distribution" install_error "Unsupported Linux distribution"
fi fi
# Set default home for lighttpd, dhcpcd5 and php package option # Set php package option based on Linux release version,
# based on Linux OS, version # abort if unsupported distro
if [ "$RELEASE" = "18.04" ]; then case $RELEASE in
php_package="php7.4-cgi" "18.04") # Ubuntu 18.04 LTS
elif [ "$RELEASE" -eq "10" ]; then php_package="php7.4-cgi"
php_package="php7.3-cgi" phpcgiconf="/etc/php/7.4/cgi/php.ini" ;;
elif [ "$RELEASE" -eq "9" ]; then "10")
php_package="php7.0-cgi" php_package="php7.3-cgi"
elif [ "$RELEASE" -eq "8" ]; then phpcgiconf="/etc/php/7.3/cgi/php.ini" ;;
install_error "${DESC} and php5 are not supported. Please upgrade." "9")
elif [ "$RELEASE" -lt "8" ]; then php_package="php7.0-cgi"
install_error "${DESC} is unsupported. Please install on a supported distro." phpcgiconf="/etc/php/7.0/cgi/php.ini" ;;
fi "8")
install_error "${DESC} and php5 are not supported. Please upgrade." ;;
if [ ${OS,,} = "debian" ] || [ ${OS,,} = "ubuntu" ]; then *)
dhcpcd_package="dhcpcd5" install_error "${DESC} is unsupported. Please install on a supported distro." ;;
fi esac
if [ "$php_package" = "php7.4-cgi" ]; then
phpcgiconf="/etc/php/7.4/cgi/php.ini"
elif [ "$php_package" = "php7.3-cgi" ]; then
phpcgiconf="/etc/php/7.3/cgi/php.ini"
elif [ "$php_package" = "php7.0-cgi" ]; then
phpcgiconf="/etc/php/7.0/cgi/php.ini"
fi
### NOTE: all the below functions are overloadable for system-specific installs ### NOTE: all the below functions are overloadable for system-specific installs
@ -280,7 +272,20 @@ function default_configuration() {
if [ ! -f "$webroot_dir/includes/config.php" ]; then if [ ! -f "$webroot_dir/includes/config.php" ]; then
sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php" sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php"
fi fi
}
# Install and enable RaspAP daemon
function enable_raspap_daemon() {
install_log "Enabling RaspAP daemon"
echo "Disable with: sudo systemctl disable raspap.service"
sudo cp $webroot_dir/installers/raspap.service /etc/systemd/system/ || install_error "Unable to move raspap.service file"
sudo systemctl daemon-reload
sudo systemctl enable raspap.service || install_error "Failed to enable raspap.service"
}
# Configure IP forwarding, IP tables rules and RaspAP daemon
function configure_networking() {
install_log "Configuring networking"
# Enable IP forwarding in /etc/sysctl.d/90_raspap.conf # Enable IP forwarding in /etc/sysctl.d/90_raspap.conf
if [ ! -f $raspap_sysctl ]; then if [ ! -f $raspap_sysctl ]; then
echo "Enabling IP forwarding" echo "Enabling IP forwarding"
@ -316,16 +321,7 @@ function default_configuration() {
echo -e echo -e
enable_raspap_daemon enable_raspap_daemon
fi fi
} }
# Install and enable RaspAP daemon
function enable_raspap_daemon() {
install_log "Enabling RaspAP daemon"
echo "Disable with: sudo systemctl disable raspap.service"
sudo cp $webroot_dir/installers/raspap.service /etc/systemd/system/ || install_error "Unable to move raspap.service file"
sudo systemctl daemon-reload
sudo systemctl enable raspap.service || install_error "Failed to enable raspap.service"
}
# Add sudoers file to /etc/sudoers.d/ and set file permissions # Add sudoers file to /etc/sudoers.d/ and set file permissions
function patch_system_files() { function patch_system_files() {
@ -435,6 +431,7 @@ function install_raspap() {
create_lighttpd_scripts create_lighttpd_scripts
move_config_file move_config_file
default_configuration default_configuration
configure_networking
prompt_install_openvpn prompt_install_openvpn
patch_system_files patch_system_files
install_complete install_complete