mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-28 17:13:17 +00:00
Allow user to choose between lighttpd or manually configuring their own web server.
This commit is contained in:
parent
3a46e7fc0a
commit
9322a778a7
1 changed files with 54 additions and 13 deletions
|
@ -23,7 +23,7 @@ tmpLog=/tmp/pihole-install.log
|
||||||
instalLogLoc=/etc/pihole/install.log
|
instalLogLoc=/etc/pihole/install.log
|
||||||
|
|
||||||
webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git"
|
webInterfaceGitUrl="https://github.com/pi-hole/AdminLTE.git"
|
||||||
webInterfaceDir="/var/www/html/admin"
|
|
||||||
piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
|
piholeGitUrl="https://github.com/pi-hole/pi-hole.git"
|
||||||
piholeFilesDir="/etc/.pihole"
|
piholeFilesDir="/etc/.pihole"
|
||||||
|
|
||||||
|
@ -304,6 +304,24 @@ setStaticIPv4() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function chooseWebServer() {
|
||||||
|
chooseWebServerCmd=(whiptail --separate-output --radiolist "pi-hole can automatically configure the lighttpd web server for you. Alternatively you can manually configure a web server yourself." $r $c 2)
|
||||||
|
chooseWebServerOptions=(lighttpd "" on
|
||||||
|
Manual "" off)
|
||||||
|
webServer=$("${chooseWebServerCmd[@]}" "${chooseWebServerOptions[@]}" 2>&1 >/dev/tty)
|
||||||
|
case $webServer in
|
||||||
|
lighttpd)
|
||||||
|
echo "::: Using lighttpd web server."
|
||||||
|
webRoot="/var/www/html"
|
||||||
|
;;
|
||||||
|
Manual)
|
||||||
|
echo "::: Using manual web server configuration."
|
||||||
|
webRoot=$(whiptail --backtitle "Web Root" --title "Web Root" --inputbox "Enter your website root path." $r $c "/var/www/html" 3>&1 1>&2 2>&3)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
webInterfaceDir="${webRoot}/admin"
|
||||||
|
}
|
||||||
|
|
||||||
function valid_ip()
|
function valid_ip()
|
||||||
{
|
{
|
||||||
local ip=$1
|
local ip=$1
|
||||||
|
@ -486,8 +504,11 @@ installConfigs() {
|
||||||
$SUDO echo ":::"
|
$SUDO echo ":::"
|
||||||
$SUDO echo "::: Installing configs..."
|
$SUDO echo "::: Installing configs..."
|
||||||
versionCheckDNSmasq
|
versionCheckDNSmasq
|
||||||
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
if [[ "$webServer" = "lighttpd" ]]
|
||||||
$SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf
|
then
|
||||||
|
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
||||||
|
$SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stopServices() {
|
stopServices() {
|
||||||
|
@ -495,8 +516,11 @@ stopServices() {
|
||||||
$SUDO echo ":::"
|
$SUDO echo ":::"
|
||||||
$SUDO echo -n "::: Stopping services..."
|
$SUDO echo -n "::: Stopping services..."
|
||||||
#$SUDO service dnsmasq stop & spinner $! || true
|
#$SUDO service dnsmasq stop & spinner $! || true
|
||||||
$SUDO service lighttpd stop & spinner $! || true
|
if [[ "$webServer" = "lighttpd" ]]
|
||||||
$SUDO echo " done."
|
then
|
||||||
|
$SUDO service lighttpd stop & spinner $! || true
|
||||||
|
$SUDO echo " done."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForDependencies() {
|
checkForDependencies() {
|
||||||
|
@ -534,7 +558,11 @@ checkForDependencies() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Checking dependencies:"
|
echo "::: Checking dependencies:"
|
||||||
|
|
||||||
dependencies=( dnsutils bc toilet figlet dnsmasq lighttpd php5-common php5-cgi php5 git curl unzip wget )
|
dependencies=( dnsutils bc toilet figlet dnsmasq php5-common php5-cgi php5 git curl unzip wget )
|
||||||
|
if [[ "$webServer" = "lighttpd" ]]
|
||||||
|
then
|
||||||
|
dependencies=( "${dependencies[@]}" "lighttpd" )
|
||||||
|
fi
|
||||||
for i in "${dependencies[@]}"
|
for i in "${dependencies[@]}"
|
||||||
do
|
do
|
||||||
:
|
:
|
||||||
|
@ -614,12 +642,15 @@ installPiholeWeb() {
|
||||||
# Install the web interface
|
# Install the web interface
|
||||||
$SUDO echo ":::"
|
$SUDO echo ":::"
|
||||||
$SUDO echo -n "::: Installing pihole custom index page..."
|
$SUDO echo -n "::: Installing pihole custom index page..."
|
||||||
if [ -d "/var/www/html/pihole" ]; then
|
if [ -d "${webRoot}/pihole" ]; then
|
||||||
$SUDO echo " Existing page detected, not overwriting"
|
$SUDO echo " Existing page detected, not overwriting"
|
||||||
else
|
else
|
||||||
$SUDO mkdir /var/www/html/pihole
|
$SUDO mkdir "${webRoot}/pihole"
|
||||||
$SUDO mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
if [[ "$webServer" = "lighttpd" ]]
|
||||||
$SUDO cp /etc/.pihole/advanced/index.html /var/www/html/pihole/index.html
|
then
|
||||||
|
$SUDO mv "${webRoot}/index.lighttpd.html" "${webRoot}/index.lighttpd.orig"
|
||||||
|
fi
|
||||||
|
$SUDO cp /etc/.pihole/advanced/index.html "${webRoot}/pihole/index.html"
|
||||||
$SUDO echo " done!"
|
$SUDO echo " done!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -664,10 +695,17 @@ installPihole() {
|
||||||
stopServices
|
stopServices
|
||||||
setUser
|
setUser
|
||||||
$SUDO mkdir -p /etc/pihole/
|
$SUDO mkdir -p /etc/pihole/
|
||||||
$SUDO chown www-data:www-data /var/www/html
|
if [[ ! ( -d "$webRoot") ]]
|
||||||
$SUDO chmod 775 /var/www/html
|
then
|
||||||
|
$SUDO mkdir -p "${webRoot}/pihole"
|
||||||
|
fi
|
||||||
|
$SUDO chown www-data:www-data "${webRoot}"
|
||||||
|
$SUDO chmod 775 "${webRoot}"
|
||||||
$SUDO usermod -a -G www-data pihole
|
$SUDO usermod -a -G www-data pihole
|
||||||
$SUDO lighty-enable-mod fastcgi fastcgi-php > /dev/null
|
if [[ "$webServer" = "lighttpd" ]]
|
||||||
|
then
|
||||||
|
$SUDO lighty-enable-mod fastcgi fastcgi-php > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
getGitFiles
|
getGitFiles
|
||||||
installScripts
|
installScripts
|
||||||
|
@ -705,6 +743,9 @@ chooseInterface
|
||||||
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
# Let the user decide if they want to block ads over IPv4 and/or IPv6
|
||||||
use4andor6
|
use4andor6
|
||||||
|
|
||||||
|
# Let the user decide if they want to use lighttpd or manually configure their web server.
|
||||||
|
chooseWebServer
|
||||||
|
|
||||||
# Decide what upstream DNS Servers to use
|
# Decide what upstream DNS Servers to use
|
||||||
setDNS
|
setDNS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue