mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Added uninstall option to pihole
command. Minor fixes
This commit is contained in:
parent
3dff7e80fc
commit
1a2046a7eb
3 changed files with 23 additions and 9 deletions
|
@ -35,7 +35,7 @@ function CalcBlockedDomains(){
|
||||||
|
|
||||||
function CalcQueriesToday(){
|
function CalcQueriesToday(){
|
||||||
if [ -e "$piLog" ];then
|
if [ -e "$piLog" ];then
|
||||||
queriesToday=$("$piLog" | grep "$today" | awk '/query/ {print $6}' | wc -l)
|
queriesToday=$(cat "$piLog" | grep "$today" | awk '/query/ {print $6}' | wc -l)
|
||||||
else
|
else
|
||||||
queriesToday="Err."
|
queriesToday="Err."
|
||||||
fi
|
fi
|
||||||
|
@ -43,7 +43,7 @@ function CalcQueriesToday(){
|
||||||
|
|
||||||
function CalcblockedToday(){
|
function CalcblockedToday(){
|
||||||
if [ -e "$piLog" ] && [ -e "$gravity" ];then
|
if [ -e "$piLog" ] && [ -e "$gravity" ];then
|
||||||
blockedToday=$($piLog | awk '/\/etc\/pihole\/gravity.list/ && !/address/ {print $6}' | wc -l)
|
blockedToday=$(cat $piLog | awk '/\/etc\/pihole\/gravity.list/ && !/address/ {print $6}' | wc -l)
|
||||||
else
|
else
|
||||||
blockedToday="Err."
|
blockedToday="Err."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -118,9 +118,9 @@ verifyFreeDiskSpace() {
|
||||||
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
|
# 50MB is the minimum space needed (45MB install (includes web admin bootstrap/jquery libraries etc) + 5MB one day of logs.)
|
||||||
requiredFreeBytes=51200
|
requiredFreeBytes=51200
|
||||||
|
|
||||||
existingFreeBytes=`df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1`
|
existingFreeBytes=$(df -lk / 2>&1 | awk '{print $4}' | head -2 | tail -1)
|
||||||
if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then
|
if ! [[ "$existingFreeBytes" =~ ^([0-9])+$ ]]; then
|
||||||
existingFreeBytes=`df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1`
|
existingFreeBytes=$(df -lk /dev 2>&1 | awk '{print $4}' | head -2 | tail -1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then
|
if [[ $existingFreeBytes -lt $requiredFreeBytes ]]; then
|
||||||
|
@ -487,6 +487,7 @@ installScripts() {
|
||||||
$SUDO cp /etc/.pihole/pihole /usr/local/bin/pihole
|
$SUDO cp /etc/.pihole/pihole /usr/local/bin/pihole
|
||||||
$SUDO chmod 755 /usr/local/bin/pihole
|
$SUDO chmod 755 /usr/local/bin/pihole
|
||||||
$SUDO cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole
|
$SUDO cp /etc/.pihole/advanced/bash-completion/pihole /etc/bash_completion.d/pihole
|
||||||
|
$SUDO . /etc/bsah_completion.d/pihole
|
||||||
$SUDO echo " done."
|
$SUDO echo " done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
23
pihole
23
pihole
|
@ -52,6 +52,11 @@ function updateDashboardFunc {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateGravityFunc {
|
||||||
|
$SUDO /opt/pihole/gravish.sh
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
function setupLCDFunction {
|
function setupLCDFunction {
|
||||||
$SUDO /opt/pihole/setupLCD.sh
|
$SUDO /opt/pihole/setupLCD.sh
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -66,6 +71,11 @@ function gravityFunc {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uninstallFunc {
|
||||||
|
$SUDO /opt/pihole/uninstall.sh
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
function helpFunc {
|
function helpFunc {
|
||||||
echo "::: Control all PiHole specific functions!"
|
echo "::: Control all PiHole specific functions!"
|
||||||
echo ":::"
|
echo ":::"
|
||||||
|
@ -82,6 +92,7 @@ function helpFunc {
|
||||||
echo "::: -s, setupLCD Automatically configures the Pi to use the 2.8 LCD screen to display stats on it"
|
echo "::: -s, setupLCD Automatically configures the Pi to use the 2.8 LCD screen to display stats on it"
|
||||||
echo "::: -c, chronometer Calculates stats and displays to an LCD"
|
echo "::: -c, chronometer Calculates stats and displays to an LCD"
|
||||||
echo "::: -h, help Show this help dialog"
|
echo "::: -h, help Show this help dialog"
|
||||||
|
echo "::: uninstall Uninstall Pi-Hole from your system!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +102,15 @@ fi
|
||||||
|
|
||||||
# Handle redirecting to specific functions based on arguments
|
# Handle redirecting to specific functions based on arguments
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-w" | "whitelist" ) whitelistFunc "$@";;
|
"-w" | "whitelist" ) whitelistFunc "$@";;
|
||||||
"-b" | "blacklist" ) blacklistFunc "$@";;
|
"-b" | "blacklist" ) blacklistFunc "$@";;
|
||||||
"-d" | "debug" ) debugFunc;;
|
"-d" | "debug" ) debugFunc;;
|
||||||
"-f" | "flush" ) flushFunc;;
|
"-f" | "flush" ) flushFunc;;
|
||||||
"-u" | "-updateDashboard" ) updateDashboardFunc;;
|
"-u" | "updateDashboard" ) updateDashboardFunc;;
|
||||||
|
"-g" | "updateGravity" ) updateGravityFunc;;
|
||||||
"-s" | "setupLCD" ) setupLCDFunction;;
|
"-s" | "setupLCD" ) setupLCDFunction;;
|
||||||
"-c" | "chronometer" ) chronometerFunc;;
|
"-c" | "chronometer" ) chronometerFunc;;
|
||||||
"-h" | "help" ) helpFunc;;
|
"-h" | "help" ) helpFunc;;
|
||||||
|
"uninstall" ) uninstallFunc;;
|
||||||
* ) helpFunc;;
|
* ) helpFunc;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue