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
|
||||
# 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_WHITE='[1;37m'
|
||||
COL_BLACK='[0;30m'
|
||||
COL_BLUE='[0;34m'
|
||||
COL_LIGHT_BLUE='[1;34m'
|
||||
COL_GREEN='[0;32m'
|
||||
COL_LIGHT_GREEN='[1;32m'
|
||||
COL_CYAN='[0;36m'
|
||||
COL_LIGHT_CYAN='[1;36m'
|
||||
COL_RED='[0;31m'
|
||||
COL_LIGHT_RED='[1;31m'
|
||||
COL_URG_RED='[39;41m'
|
||||
COL_PURPLE='[0;35m'
|
||||
COL_LIGHT_PURPLE='[1;35m'
|
||||
COL_BROWN='[0;33m'
|
||||
COL_YELLOW='[1;33m'
|
||||
COL_GRAY='[0;30m'
|
||||
COL_LIGHT_GRAY='[0;37m'
|
||||
COL_DARK_GRAY='[1;30m'
|
||||
COL_GRAY='[90m'
|
||||
COL_RED='[91m'
|
||||
COL_GREEN='[32m'
|
||||
COL_YELLOW='[33m'
|
||||
COL_BLUE='[94m'
|
||||
COL_PURPLE='[95m'
|
||||
COL_CYAN='[96m'
|
||||
else
|
||||
# Provide empty variables for `set -u`
|
||||
COL_BOLD=""
|
||||
COL_ULINE=""
|
||||
|
||||
COL_NC=""
|
||||
COL_GRAY=""
|
||||
COL_RED=""
|
||||
COL_GREEN=""
|
||||
COL_YELLOW=""
|
||||
COL_BLUE=""
|
||||
COL_PURPLE=""
|
||||
COL_CYAN=""
|
||||
fi
|
||||
|
||||
TICK="[${COL_LIGHT_GREEN}✓${COL_NC}]"
|
||||
CROSS="[${COL_LIGHT_RED}✗${COL_NC}]"
|
||||
# Deprecated variables
|
||||
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]"
|
||||
QST="[?]"
|
||||
DONE="${COL_LIGHT_GREEN} done!${COL_NC}"
|
||||
OVER="\r\033[K"
|
||||
DONE="${COL_GREEN} done!${COL_NC}"
|
||||
OVER="\\r[K"
|
||||
|
|
|
@ -217,6 +217,10 @@ SetExcludeClients() {
|
|||
change_setting "API_EXCLUDE_CLIENTS" "${args[2]}"
|
||||
}
|
||||
|
||||
Poweroff(){
|
||||
nohup bash -c "sleep 5; poweroff" &> /dev/null </dev/null &
|
||||
}
|
||||
|
||||
Reboot() {
|
||||
nohup bash -c "sleep 5; reboot" &> /dev/null </dev/null &
|
||||
}
|
||||
|
@ -480,6 +484,7 @@ main() {
|
|||
"setdns" ) SetDNSServers;;
|
||||
"setexcludedomains" ) SetExcludeDomains;;
|
||||
"setexcludeclients" ) SetExcludeClients;;
|
||||
"poweroff" ) Poweroff;;
|
||||
"reboot" ) Reboot;;
|
||||
"restartdns" ) RestartDNS;;
|
||||
"setquerylog" ) SetQueryLogOptions;;
|
||||
|
|
|
@ -154,7 +154,12 @@ if command -v apt-get &> /dev/null; then
|
|||
# fall back on the php5 packages
|
||||
phpVer="php5"
|
||||
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
|
||||
# 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)
|
||||
|
@ -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)
|
||||
# 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
|
||||
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi)
|
||||
PIHOLE_WEB_DEPS=(lighttpd ${phpVer}-common ${phpVer}-cgi ${phpVer}-${phpSqlite})
|
||||
# The Web server user,
|
||||
LIGHTTPD_USER="www-data"
|
||||
# group,
|
||||
|
@ -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"
|
||||
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_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
|
||||
INSTALLER_DEPS=("${INSTALLER_DEPS[@]}" "epel-release");
|
||||
fi
|
||||
|
|
|
@ -180,7 +180,6 @@ removeNoPurge() {
|
|||
|
||||
${SUDO} rm -f /etc/init.d/pihole-FTL
|
||||
${SUDO} rm -f /usr/bin/pihole-FTL
|
||||
|
||||
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
||||
fi
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ piholeDir=/etc/${basename}
|
|||
adList=${piholeDir}/gravity.list
|
||||
blackList=${piholeDir}/black.list
|
||||
localList=${piholeDir}/local.list
|
||||
VPNList=/etc/openvpn/ipp.txt
|
||||
justDomainsExtension=domains
|
||||
matterAndLight=${basename}.0.matterandlight.txt
|
||||
supernova=${basename}.1.supernova.txt
|
||||
|
@ -296,7 +297,7 @@ gravity_unique() {
|
|||
local str="Removing duplicate domains"
|
||||
echo -ne " ${INFO} ${str}..."
|
||||
|
||||
sort -u ${piholeDir}/${supernova} > ${piholeDir}/${preEventHorizon}
|
||||
sort -u -f ${piholeDir}/${supernova} > ${piholeDir}/${preEventHorizon}
|
||||
|
||||
echo -e "${OVER} ${TICK} ${str}"
|
||||
numberOf=$(wc -l < ${piholeDir}/${preEventHorizon})
|
||||
|
@ -337,6 +338,11 @@ gravity_hostFormatLocal() {
|
|||
rm "${localList}"
|
||||
gravity_doHostFormat "${localList}.tmp" "${localList}"
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue