@ -1,34 +1,40 @@
raspap_dir = "/etc/raspap"
raspap_user = "www-data"
webroot_dir = "/var/www/html"
version = ` sed 's/\..*//' /etc/debian_version`
version = $( lsb_release -sc)
# Determine version, set default home location for lighttpd and
# php package to install
if [ $version -eq 11 ] ; then
if [ $version = "bullseye" ] ; then
version_msg = "11.0 (Bullseye)"
sudo apt update --allow-releaseinfo-change
# sudo apt update --allow-releaseinfo-change
php_package = "php7.4-cgi"
elif [ $version -eq 10 ] ; then
elif [ $version = "buster" ] ; then
version_msg = "10.0 (Buster)"
php_package = "php7.3-cgi"
elif [ $version -eq 9 ] ; then
elif [ $version = "stretch" ] ; then
version_msg = "9.0 (Stretch)"
php_package = "php7.0-cgi"
elif [ $version = "focal" ] ; then
version_msg = "20.02 (Focal)"
php_package = "php7.4-cgi"
elif [ $version = "jammy" ] ; then
version_msg = "22.04 (Jammy)"
php_package = "php8.1-cgi"
else
version_msg = "Unmatched version use php7.4"
php_package = "php7.4-cgi"
fi
phpcgiconf = ""
if [ " $php_package " = "php7.4-cgi" ] ; then
if [ " $php_package " = "php8.1-cgi" ] ; then
phpcgiconf = "/etc/php/8.1/cgi/php.ini"
elif [ " $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"
elif [ " $php_package " = "php5.6-cgi" ] ; then
phpcgiconf = "/etc/php5/cgi/php.ini"
fi
# Outputs a RaspAP Install log line
@ -96,15 +102,18 @@ function install_dependencies() {
function common_interfaces( ) {
if [ -f /boot/armbianEnv.txt ] ; then
sudo sed -i '1i extraargs=net.ifnames=0' /boot/armbianEnv.txt && install_log "armbianEnv patched"
sudo sed -i "1i extraargs=net.ifnames=0" /boot/armbianEnv.txt
install_log "armbianEnv patched"
else install_log "Armbian undetected no patching required"
fi
}
# This section no longer used but may retain value for patching service
function stop_lokinet( ) {
install_log "stop lokinet and patch hostapd restart to service"
sudo systemctl stop lokinet.service
#Set sed lokinet.service for Hostapd to restart everytime after Lokinet restarts
sed -i '/^ExecStartPost=+/usr/sbin/lokinet-resolvconf add /var/lib/lokinet/lokinet.ini.*/a ExecStartPost=+systemctl restart hostapd' /usr/lib/systemd/system/lokinet.service
sed -i "/ExecStartPost=+\/usr\/sbin\/lokinet-resolvconf add \/var\/lib\/lokinet\/lokinet.ini/a ExecStartPost=+systemctl restart hostapd" /usr/lib/systemd/system/lokinet.service
sudo systemctl daemon-reload
}
@ -230,7 +239,7 @@ function move_config_file() {
function network_tables( ) {
install_log "Selecting iptables or nftable rules"
if [ $version -lt 12 ] ; then
if [ $version != "future_requirement" ] ; then
install_log "Use iptables"
sudo apt-get -y install iptables
tablerouteA = 'iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP'
@ -390,13 +399,8 @@ function optimize_php() {
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]: "
read answer
if [ " $answer " != 'n' ] && [ " $answer " != 'N' ] ; then
echo "Php-cgi enabling session.cookie_httponly."
echo -n "Enabling HttpOnly for session cookies "
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.0-cgi" ] ; then
echo -n "Enable PHP OPCache? [Y/n]: "
read answer
@ -406,6 +410,7 @@ function optimize_php() {
# Make sure opcache extension is turned on.
if [ -f "/usr/sbin/phpenmod" ] ; then
sudo phpenmod opcache
echo -n "PHP OPCache enabled"
else
install_warning "phpenmod not found."
fi
@ -429,16 +434,17 @@ function install_complete() {
}
function install_raspap( ) {
test_root_user
display_welcome
config_installation
update_system_packages
install_dependencies
patch_lokinet_service
create_raspap_directories
common_interfaces
stop_lokinet
check_for_networkmananger
optimize_php
enable_php_lighttpd
create_raspap_directories
check_for_old_configs
download_latest_files
change_file_ownership