mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Merge pull request #124 from billz/new-php-pa
Installs php7.0-cgi for Stretch. Maintains backward compatibility with Jessie. Resolves #118 #109
This commit is contained in:
commit
6e2c6de8a6
@ -2,13 +2,19 @@ raspap_dir="/etc/raspap"
|
|||||||
raspap_user="www-data"
|
raspap_user="www-data"
|
||||||
version=`sed 's/\..*//' /etc/debian_version`
|
version=`sed 's/\..*//' /etc/debian_version`
|
||||||
|
|
||||||
# Determine version and set default home location for lighttpd
|
# Determine version, set default home location for lighttpd and
|
||||||
if [ $version -ge 8 ]; then
|
# php package to install
|
||||||
version_msg="Raspian version 8.0 or later"
|
|
||||||
webroot_dir="/var/www/html"
|
webroot_dir="/var/www/html"
|
||||||
|
if [ $version -eq 9 ]; then
|
||||||
|
version_msg="Raspian 9.0 (Stretch)"
|
||||||
|
php_package="php7.0-cgi"
|
||||||
|
elif [ $version -eq 8 ]; then
|
||||||
|
version_msg="Raspian 8.0 (Jessie)"
|
||||||
|
php_package="php5-cgi"
|
||||||
else
|
else
|
||||||
version_msg="Raspian version earlier than 8.0"
|
version_msg="Raspian earlier than 8.0 (Wheezy)"
|
||||||
webroot_dir="/var/www"
|
webroot_dir="/var/www"
|
||||||
|
php_package="php5-cgi"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Outputs a RaspAP Install log line
|
# Outputs a RaspAP Install log line
|
||||||
@ -72,15 +78,8 @@ function install_dependencies() {
|
|||||||
function enable_php_lighttpd() {
|
function enable_php_lighttpd() {
|
||||||
install_log "Enabling PHP for lighttpd"
|
install_log "Enabling PHP for lighttpd"
|
||||||
|
|
||||||
sudo lighty-enable-mod fastcgi-php
|
sudo lighttpd-enable-mod fastcgi-php
|
||||||
ERR=$?
|
sudo service lighttpd force-reload
|
||||||
if [ $ERR -eq 2 ]
|
|
||||||
then
|
|
||||||
echo ' [already enabled]'
|
|
||||||
elif [ $ERR -ne 0 ]
|
|
||||||
then
|
|
||||||
install_error "Cannot enable fastcgi-php for lighttpd"
|
|
||||||
fi
|
|
||||||
sudo /etc/init.d/lighttpd restart || install_error "Unable to restart lighttpd"
|
sudo /etc/init.d/lighttpd restart || install_error "Unable to restart lighttpd"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +110,12 @@ function create_logging_scripts() {
|
|||||||
sudo mv /var/www/html/installers/*log.sh /etc/raspap/hostapd
|
sudo mv /var/www/html/installers/*log.sh /etc/raspap/hostapd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate logging enable/disable files for hostapd
|
||||||
|
function create_logging_scripts() {
|
||||||
|
sudo mkdir /etc/raspap/hostapd
|
||||||
|
sudo mv /var/www/html/installers/*log.sh /etc/raspap/hostapd
|
||||||
|
}
|
||||||
|
|
||||||
# Fetches latest files from github to webroot
|
# Fetches latest files from github to webroot
|
||||||
function download_latest_files() {
|
function download_latest_files() {
|
||||||
if [ -d "$webroot_dir" ]; then
|
if [ -d "$webroot_dir" ]; then
|
||||||
@ -181,15 +186,14 @@ function default_configuration() {
|
|||||||
sudo mv $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || install_error "Unable to move hostapd configuration file"
|
sudo mv $webroot_dir/config/hostapd.conf /etc/hostapd/hostapd.conf || install_error "Unable to move hostapd configuration file"
|
||||||
sudo mv $webroot_dir/config/dnsmasq.conf /etc/dnsmasq.conf || install_error "Unable to move dnsmasq configuration file"
|
sudo mv $webroot_dir/config/dnsmasq.conf /etc/dnsmasq.conf || install_error "Unable to move dnsmasq configuration file"
|
||||||
sudo mv $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || install_error "Unable to move dhcpcd configuration file"
|
sudo mv $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || install_error "Unable to move dhcpcd configuration file"
|
||||||
|
|
||||||
# Generate required lines for Rasp AP to place into rc.local file.
|
# Generate required lines for Rasp AP to place into rc.local file.
|
||||||
# #RASPAP is for removal script
|
# #RASPAP is for removal script
|
||||||
|
|
||||||
lines=(
|
lines=(
|
||||||
'echo 1 > /proc/sys/net/ipv4/ip_forward #RASPAP'
|
'echo 1 > /proc/sys/net/ipv4/ip_forward #RASPAP'
|
||||||
'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP'
|
'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for line in "${lines[@]}"; do
|
for line in "${lines[@]}"; do
|
||||||
if grep "$line" /etc/rc.local > /dev/null; then
|
if grep "$line" /etc/rc.local > /dev/null; then
|
||||||
echo "$line: Line already added"
|
echo "$line: Line already added"
|
||||||
|
2
installers/raspbian.sh
Normal file → Executable file
2
installers/raspbian.sh
Normal file → Executable file
@ -9,7 +9,7 @@ function update_system_packages() {
|
|||||||
|
|
||||||
function install_dependencies() {
|
function install_dependencies() {
|
||||||
install_log "Installing required packages"
|
install_log "Installing required packages"
|
||||||
sudo apt-get install lighttpd php5-cgi git hostapd dnsmasq || install_error "Unable to install dependencies"
|
sudo apt-get install lighttpd $php_package git hostapd dnsmasq || install_error "Unable to install dependencies"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_raspap
|
install_raspap
|
||||||
|
0
installers/uninstall.sh
Normal file → Executable file
0
installers/uninstall.sh
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user