Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/advanced/lighttpd.conf.gentoo b/advanced/lighttpd.conf.gentoo
- index e69de29..df382a9 100644
- --- a/advanced/lighttpd.conf.gentoo
- +++ b/advanced/lighttpd.conf.gentoo
- @@ -0,0 +1,104 @@
- +# Pi-hole: A black hole for Internet advertisements
- +# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
- +# Network-wide ad blocking via your own hardware.
- +#
- +# lighttpd config for Pi-hole
- +#
- +# This file is copyright under the latest version of the EUPL.
- +# Please see LICENSE file for your rights under this license.
- +
- +
- +
- +###############################################################################
- +# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
- +# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
- +# #
- +# CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE: #
- +# /etc/lighttpd/external.conf #
- +###############################################################################
- +
- +server.modules = (
- + "mod_access",
- + "mod_auth",
- + "mod_fastcgi",
- + "mod_accesslog",
- + "mod_expire",
- + "mod_compress",
- + "mod_redirect",
- + "mod_setenv",
- + "mod_rewrite"
- +)
- +
- +server.document-root = "/var/www/html"
- +server.error-handler-404 = "pihole/index.php"
- +server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
- +server.errorlog = "/var/log/lighttpd/error.log"
- +server.pid-file = "/var/run/lighttpd.pid"
- +server.username = "lighttpd"
- +server.groupname = "lighttpd"
- +server.port = 80
- +accesslog.filename = "/var/log/lighttpd/access.log"
- +accesslog.format = "%{%s}t|%V|%r|%s|%b"
- +
- +
- +index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
- +url.access-deny = ( "~", ".inc" )
- +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
- +
- +compress.cache-dir = "/var/cache/lighttpd/compress/"
- +compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
- +
- +mimetype.assign = ( ".png" => "image/png",
- + ".jpg" => "image/jpeg",
- + ".jpeg" => "image/jpeg",
- + ".html" => "text/html",
- + ".css" => "text/css; charset=utf-8",
- + ".js" => "application/javascript",
- + ".json" => "application/json",
- + ".txt" => "text/plain",
- + ".svg" => "image/svg+xml" )
- +
- +# default listening port for IPv6 falls back to the IPv4 port
- +#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
- +#include_shell "/usr/share/lighttpd/create-mime.assign.pl"
- +#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
- +
- +fastcgi.server = ( ".php" =>
- + ( "localhost" =>
- + (
- + "socket" => "/run/lighttpd/php-fastcgi.socket",
- + "bin-path" => "/usr/bin/php-cgi",
- + "max-procs" => 1,
- + "bin-environment" => (
- + "PHP_FCGI_CHILDREN" => "16",
- + "PHP_FCGI_MAX_REQUESTS" => "10000"
- + ),
- + "broken-scriptfilename" => "enable"
- + )
- + )
- + )
- +
- +# If the URL starts with /admin, it is the Web interface
- +$HTTP["url"] =~ "^/admin/" {
- + # Create a response header for debugging using curl -I
- + setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!" )
- +}
- +
- +# Rewite js requests, must be out of $HTTP block due to bug #2526
- +url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" )
- +
- +# If the URL does not start with /admin, then it is a query for an ad domain
- +$HTTP["url"] =~ "^(?!/admin)/.*" {
- + # Create a response header for debugging using curl -I
- + setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." )
- +}
- +
- +# Entering just "pi.hole" into a browser redirects to "pi.hole/admin/"
- +$HTTP["host"] == "pi.hole" {
- + $HTTP["url"] == "/" {
- + url.redirect = ( "" => "/admin/" )
- + }
- +}
- +
- +# Add user chosen options held in external file
- +include_shell "cat external.conf 2>/dev/null"
- diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh
- index 832fd77..d6a3991 100755
- --- a/automated install/basic-install.sh
- +++ b/automated install/basic-install.sh
- @@ -218,7 +218,36 @@ elif command -v rpm &> /dev/null; then
- LIGHTTPD_CFG="lighttpd.conf.fedora"
- DNSMASQ_USER="nobody"
- -# If neither apt-get or rmp/dnf are found
- +# If neither apt-get or rmp/dnf are found, check for emerge to see if it's gentoo family OS
- +elif command -v emerge -get &> /dev/null; then
- + #Gentoo
- + #############################################
- + PKG_MANAGER="emerge"
- + UPDATE_PKG_CACHE=":" # don't execute eix-sync
- + PKG_INSTALL=(${PKG_MANAGER})
- + PKG_COUNT="echo 0 || true" # Do not check for outdated packages in gentoo
- + # #########################################
- + # fixes for dependency differences
- + # gentoo uses sys-apps/iproute2
- + iproute_pkg="sys-apps/iproute2"
- +
- + # USE for dev-lang/php: +sqlite +fpm +sockets
- + phpVer="dev-lang/php"
- +
- + # Select dhcp
- + dhcp_pkg="net-misc/dhcp"
- + # Select your cron implementation
- + cron_pkg="virtual/cron"
- + # #########################################
- + INSTALLER_DEPS=(dev-util/dialog ${iproute_pkg} dev-vcs/git ${dhcp_pkg} sys-apps/net-tools dev-libs/newt sys-process/procps)
- + PIHOLE_DEPS=(sys-devel/bc ${cron_pkg} net-misc/curl sys-apps/findutils net-dns/dnsmasq net-misc/iputils sys-process/lsof net-analyzer/netcat app-admin/sudo app-arch/unzip net-misc/wget net-dns/libidn2)
- + PIHOLE_WEB_DEPS=(www-servers/lighttpd ${phpVer})
- + LIGHTTPD_USER="lighttpd"
- + LIGHTTPD_GROUP="lighttpd"
- + # Reuse the fedora config file
- + LIGHTTPD_CFG="lighttpd.conf.gentoo"
- + DNSMASQ_USER="dnsmasq"
- +# If neither apt-get, emerge, or rmp/dnf are found
- else
- # it's not an OS we can support,
- echo -e " ${CROSS} OS distribution not supported"
- @@ -1115,8 +1144,10 @@ stop_service() {
- echo -ne " ${INFO} ${str}..."
- if command -v systemctl &> /dev/null; then
- systemctl stop "${1}" &> /dev/null || true
- - else
- + elif command -v service &> /dev/null; then
- service "${1}" stop &> /dev/null || true
- + elif command -v rc-service &> /dev/null; then
- + rc-service "${1}" stop &> /dev/null || true
- fi
- echo -e "${OVER} ${TICK} ${str}..."
- }
- @@ -1131,10 +1162,16 @@ start_service() {
- if command -v systemctl &> /dev/null; then
- # use that to restart the service
- systemctl restart "${1}" &> /dev/null
- - # Otherwise,
- - else
- - # fall back to the service command
- + # Otherwise, test if service command exists
- + elif command -v service &> /dev/null; then
- + # use it to restart the service
- service "${1}" restart &> /dev/null
- + # otherwise, test if rc-service exists
- + elif command -v rc-service &> /dev/null; then
- + # use it to restart the service
- + rc-service "${1}" restart &> /dev/null || true
- + else
- + echo "Please manually restart ${1}."
- fi
- echo -e "${OVER} ${TICK} ${str}"
- }
- @@ -1149,6 +1186,10 @@ enable_service() {
- if command -v systemctl &> /dev/null; then
- # use that to enable the service
- systemctl enable "${1}" &> /dev/null
- + # If systemctrl is not existent, check if rc-update is available
- + elif command -v rc-update &> /dev/null; then
- + # use rc-update and add the service to the runlevel 'default'
- + rc-update add "${1}" default
- # Othwerwise,
- else
- # use update-rc.d to accomplish this
- @@ -1261,6 +1302,22 @@ install_dependent_packages() {
- return 0
- fi
- + if command -v eix &> /dev/null; then
- + for i in "${argArray1[@]}"; do
- + echo -n "::: Checking for $i..."
- + if eix "${i}" | grep \\[I\\] &> /dev/null; then
- + echo " installed!"
- + else
- + echo " added to install list!"
- + installArray+=("${i}")
- + fi
- + done
- + if [[ ${#installArray[@]} -gt 0 ]]; then
- + echo "Please install the following dependencies before continuing: " "${installArray[@]}"
- + exit 1
- + fi
- + return 0
- + fi
- # Install Fedora/CentOS packages
- for i in "${argArray1[@]}"; do
- echo -ne " ${INFO} Checking for $i..."
- @@ -2024,6 +2081,9 @@ main() {
- if [[ -x "$(command -v systemctl)" ]]; then
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
- + elif [[ -x "$(command -v rc-status)" ]]; then
- + # Value will either be 1, if true, or 0
- + LIGHTTPD_ENABLED=$(rc-status | grep lighttpd | grep -c 'started' || true)
- else
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
- @@ -2052,6 +2112,9 @@ main() {
- if [[ -x "$(command -v systemctl)" ]]; then
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(systemctl is-enabled lighttpd | grep -c 'enabled' || true)
- + elif [[ -x "$(command -v rc-status)" ]]; then
- + # Value will either be 1, if true, or 0
- + LIGHTTPD_ENABLED=$(rc-status | grep lighttpd | grep -c 'started' || true)
- else
- # Value will either be 1, if true, or 0
- LIGHTTPD_ENABLED=$(service lighttpd status | awk '/Loaded:/ {print $0}' | grep -c 'enabled' || true)
- diff --git a/pihole b/pihole
- index e4d6215..4fd5823 100755
- --- a/pihole
- +++ b/pihole
- @@ -343,7 +343,13 @@ restartDNS() {
- else
- svcOption="start"
- fi
- - svc="service dnsmasq ${svcOption}"
- + # Test if service command is available
- + if [[ -x "$(command -v service)" ]]; then
- + svcCmd="service dnsmasq"
- + else
- + svcCmd="/etc/init.d/dnsmasq"
- + fi
- + svc="${svcCmd} ${svcOption}"
- fi
- # Print output to Terminal, but not to Web Admin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement