mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Merge branch 'development' into new/UninstallCleanup
Signed-off-by: Adam Warner <adamw@rner.email> # Conflicts: # automated install/uninstall.sh
This commit is contained in:
commit
774c6e8ac0
5 changed files with 82 additions and 46 deletions
|
@ -1,28 +1,49 @@
|
||||||
|
# Determine if terminal is capable of showing colours
|
||||||
if [[ -t 1 ]] && [[ $(tput colors) -ge 8 ]]; then
|
if [[ -t 1 ]] && [[ $(tput colors) -ge 8 ]]; then
|
||||||
|
# Bold and underline may not show up on all clients
|
||||||
|
# If something MUST be emphasised, use both
|
||||||
|
COL_BOLD='[1m'
|
||||||
|
COL_ULINE='[4m'
|
||||||
|
|
||||||
COL_NC='[0m'
|
COL_NC='[0m'
|
||||||
COL_WHITE='[1;37m'
|
COL_GRAY='[90m'
|
||||||
COL_BLACK='[0;30m'
|
COL_RED='[91m'
|
||||||
COL_BLUE='[0;34m'
|
COL_GREEN='[32m'
|
||||||
COL_LIGHT_BLUE='[1;34m'
|
COL_YELLOW='[33m'
|
||||||
COL_GREEN='[0;32m'
|
COL_BLUE='[94m'
|
||||||
COL_LIGHT_GREEN='[1;32m'
|
COL_PURPLE='[95m'
|
||||||
COL_CYAN='[0;36m'
|
COL_CYAN='[96m'
|
||||||
COL_LIGHT_CYAN='[1;36m'
|
else
|
||||||
COL_RED='[0;31m'
|
# Provide empty variables for `set -u`
|
||||||
COL_LIGHT_RED='[1;31m'
|
COL_BOLD=""
|
||||||
COL_URG_RED='[39;41m'
|
COL_ULINE=""
|
||||||
COL_PURPLE='[0;35m'
|
|
||||||
COL_LIGHT_PURPLE='[1;35m'
|
COL_NC=""
|
||||||
COL_BROWN='[0;33m'
|
COL_GRAY=""
|
||||||
COL_YELLOW='[1;33m'
|
COL_RED=""
|
||||||
COL_GRAY='[0;30m'
|
COL_GREEN=""
|
||||||
COL_LIGHT_GRAY='[0;37m'
|
COL_YELLOW=""
|
||||||
COL_DARK_GRAY='[1;30m'
|
COL_BLUE=""
|
||||||
|
COL_PURPLE=""
|
||||||
|
COL_CYAN=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TICK="[${COL_LIGHT_GREEN}✓${COL_NC}]"
|
# Deprecated variables
|
||||||
CROSS="[${COL_LIGHT_RED}✗${COL_NC}]"
|
COL_WHITE="${COL_BOLD}"
|
||||||
|
COL_BLACK="${COL_NC}"
|
||||||
|
COL_LIGHT_BLUE="${COL_BLUE}"
|
||||||
|
COL_LIGHT_GREEN="${COL_GREEN}"
|
||||||
|
COL_LIGHT_CYAN="${COL_CYAN}"
|
||||||
|
COL_LIGHT_RED="${COL_RED}"
|
||||||
|
COL_URG_RED="${COL_RED}${COL_BOLD}${COL_ULINE}"
|
||||||
|
COL_LIGHT_PURPLE="${COL_PURPLE}"
|
||||||
|
COL_BROWN="${COL_YELLOW}"
|
||||||
|
COL_LIGHT_GRAY="${COL_GRAY}"
|
||||||
|
COL_DARK_GRAY="${COL_GRAY}"
|
||||||
|
|
||||||
|
TICK="[${COL_GREEN}✓${COL_NC}]"
|
||||||
|
CROSS="[${COL_RED}✗${COL_NC}]"
|
||||||
INFO="[i]"
|
INFO="[i]"
|
||||||
QST="[?]"
|
QST="[?]"
|
||||||
DONE="${COL_LIGHT_GREEN} done!${COL_NC}"
|
DONE="${COL_GREEN} done!${COL_NC}"
|
||||||
OVER="\r\033[K"
|
OVER="\\r[K"
|
||||||
|
|
|
@ -217,6 +217,10 @@ SetExcludeClients() {
|
||||||
change_setting "API_EXCLUDE_CLIENTS" "${args[2]}"
|
change_setting "API_EXCLUDE_CLIENTS" "${args[2]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Poweroff(){
|
||||||
|
nohup bash -c "sleep 5; poweroff" &> /dev/null </dev/null &
|
||||||
|
}
|
||||||
|
|
||||||
Reboot() {
|
Reboot() {
|
||||||
nohup bash -c "sleep 5; reboot" &> /dev/null </dev/null &
|
nohup bash -c "sleep 5; reboot" &> /dev/null </dev/null &
|
||||||
}
|
}
|
||||||
|
@ -480,6 +484,7 @@ main() {
|
||||||
"setdns" ) SetDNSServers;;
|
"setdns" ) SetDNSServers;;
|
||||||
"setexcludedomains" ) SetExcludeDomains;;
|
"setexcludedomains" ) SetExcludeDomains;;
|
||||||
"setexcludeclients" ) SetExcludeClients;;
|
"setexcludeclients" ) SetExcludeClients;;
|
||||||
|
"poweroff" ) Poweroff;;
|
||||||
"reboot" ) Reboot;;
|
"reboot" ) Reboot;;
|
||||||
"restartdns" ) RestartDNS;;
|
"restartdns" ) RestartDNS;;
|
||||||
"setquerylog" ) SetQueryLogOptions;;
|
"setquerylog" ) SetQueryLogOptions;;
|
||||||
|
|
|
@ -154,7 +154,12 @@ if command -v apt-get &> /dev/null; then
|
||||||
# fall back on the php5 packages
|
# fall back on the php5 packages
|
||||||
phpVer="php5"
|
phpVer="php5"
|
||||||
fi
|
fi
|
||||||
|
# We also need the correct version for `php-sqlite` (which differs across distros)
|
||||||
|
if ${PKG_MANAGER} install --dry-run ${phpVer}-sqlite3 > /dev/null 2>&1; then
|
||||||
|
phpSqlite="sqlite3"
|
||||||
|
else
|
||||||
|
phpSqlite="sqlite"
|
||||||
|
fi
|
||||||
# Since our install script is so large, we need several other programs to successfuly get a machine provisioned
|
# Since our install script is so large, we need several other programs to successfuly get a machine provisioned
|
||||||
# These programs are stored in an array so they can be looped through later
|
# These programs are stored in an array so they can be looped through later
|
||||||
INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
|
INSTALLER_DEPS=(apt-utils dialog debconf dhcpcd5 git ${iproute_pkg} whiptail)
|
||||||
|
@ -162,7 +167,7 @@ if command -v apt-get &> /dev/null; then
|
||||||
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget)
|
PIHOLE_DEPS=(bc cron curl dnsmasq dnsutils iputils-ping lsof netcat sudo unzip wget)
|
||||||
# The Web dashboard has some that also need to be installed
|
# The Web dashboard has some that also need to be installed
|
||||||
# It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
|
# It's useful to separate the two since our repos are also setup as "Core" code and "Web" code
|
||||||
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi)
|
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi ${phpVer}-${phpSqlite})
|
||||||
# The Web server user,
|
# The Web server user,
|
||||||
LIGHTTPD_USER="www-data"
|
LIGHTTPD_USER="www-data"
|
||||||
# group,
|
# group,
|
||||||
|
@ -172,8 +177,8 @@ if command -v apt-get &> /dev/null; then
|
||||||
# The DNS server user
|
# The DNS server user
|
||||||
DNSMASQ_USER="dnsmasq"
|
DNSMASQ_USER="dnsmasq"
|
||||||
|
|
||||||
# A function to check...
|
# A function to check...
|
||||||
test_dpkg_lock() {
|
test_dpkg_lock() {
|
||||||
# An iterator used for counting loop iterations
|
# An iterator used for counting loop iterations
|
||||||
i=0
|
i=0
|
||||||
# fuser is a program to show which processes use the named files, sockets, or filesystems
|
# fuser is a program to show which processes use the named files, sockets, or filesystems
|
||||||
|
@ -204,7 +209,7 @@ elif command -v rpm &> /dev/null; then
|
||||||
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
PKG_COUNT="${PKG_MANAGER} check-update | egrep '(.i686|.x86|.noarch|.arm|.src)' | wc -l"
|
||||||
INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng)
|
INSTALLER_DEPS=(dialog git iproute net-tools newt procps-ng)
|
||||||
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget)
|
PIHOLE_DEPS=(bc bind-utils cronie curl dnsmasq findutils nmap-ncat sudo unzip wget)
|
||||||
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli)
|
PIHOLE_WEB_DEPS=(lighttpd lighttpd-fastcgi php php-common php-cli php-pdo)
|
||||||
if ! grep -q 'Fedora' /etc/redhat-release; then
|
if ! grep -q 'Fedora' /etc/redhat-release; then
|
||||||
INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release");
|
INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release");
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -180,7 +180,6 @@ removeNoPurge() {
|
||||||
|
|
||||||
${SUDO} rm -f /etc/init.d/pihole-FTL
|
${SUDO} rm -f /etc/init.d/pihole-FTL
|
||||||
${SUDO} rm -f /usr/bin/pihole-FTL
|
${SUDO} rm -f /usr/bin/pihole-FTL
|
||||||
|
|
||||||
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ piholeDir=/etc/${basename}
|
||||||
adList=${piholeDir}/gravity.list
|
adList=${piholeDir}/gravity.list
|
||||||
blackList=${piholeDir}/black.list
|
blackList=${piholeDir}/black.list
|
||||||
localList=${piholeDir}/local.list
|
localList=${piholeDir}/local.list
|
||||||
|
VPNList=/etc/openvpn/ipp.txt
|
||||||
justDomainsExtension=domains
|
justDomainsExtension=domains
|
||||||
matterAndLight=${basename}.0.matterandlight.txt
|
matterAndLight=${basename}.0.matterandlight.txt
|
||||||
supernova=${basename}.1.supernova.txt
|
supernova=${basename}.1.supernova.txt
|
||||||
|
@ -296,7 +297,7 @@ gravity_unique() {
|
||||||
local str="Removing duplicate domains"
|
local str="Removing duplicate domains"
|
||||||
echo -ne " ${INFO} ${str}..."
|
echo -ne " ${INFO} ${str}..."
|
||||||
|
|
||||||
sort -u ${piholeDir}/${supernova} > ${piholeDir}/${preEventHorizon}
|
sort -u -f ${piholeDir}/${supernova} > ${piholeDir}/${preEventHorizon}
|
||||||
|
|
||||||
echo -e "${OVER} ${TICK} ${str}"
|
echo -e "${OVER} ${TICK} ${str}"
|
||||||
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
||||||
|
@ -337,6 +338,11 @@ gravity_hostFormatLocal() {
|
||||||
rm "${localList}"
|
rm "${localList}"
|
||||||
gravity_doHostFormat "${localList}.tmp" "${localList}"
|
gravity_doHostFormat "${localList}.tmp" "${localList}"
|
||||||
rm "${localList}.tmp"
|
rm "${localList}.tmp"
|
||||||
|
|
||||||
|
# Generate local HOSTS list with information obtained from OpenVPN (if available)
|
||||||
|
if [[ -f ${VPNList} ]]; then
|
||||||
|
awk -F, '{printf $2"\t"$1"\n"}' "${VPNList}" >> "${localList}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
gravity_hostFormatGravity() {
|
gravity_hostFormatGravity() {
|
||||||
|
|
Loading…
Reference in a new issue