1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-18 06:08:21 +00:00

Merge branch 'BugFix463' into development

This commit is contained in:
Mcat12 2016-04-20 15:55:26 -04:00
commit aec6fcd00b
3 changed files with 43 additions and 7 deletions

View File

@ -10,6 +10,24 @@
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#rootcheck
if [[ $EUID -eq 0 ]];then
echo "::: You are root."
else
echo "::: sudo will be used."
# Check if it is actually installed
# If it isn't, exit because the install cannot complete
if [[ $(dpkg-query -s sudo) ]];then
export SUDO="sudo"
else
echo "::: Please install sudo or run this script as root."
exit 1
fi
fi
if [[ $# = 0 ]]; then
helpFunc
fi
#globals
basename=pihole
@ -51,7 +69,7 @@ function helpFunc()
echo "::: Immediately blacklists one or more domains in the hosts file"
echo ":::"
echo ":::"
echo "::: Usage: sudo pihole -b domain1 [domain2 ...]"
echo "::: Usage: pihole -b domain1 [domain2 ...]"
echo "::: Options:"
echo "::: -d, --delmode Remove domains from the blacklist"
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
@ -167,10 +185,10 @@ function Reload() {
if [[ $dnsmasqPid ]]; then
# service already running - reload config
sudo kill -HUP "$dnsmasqPid"
$SUDO killall -s HUP dnsmasq
else
# service not running, start it up
sudo service dnsmasq start
$SUDO service dnsmasq start
fi
echo " done!"
}

View File

@ -10,6 +10,24 @@
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#rootcheck
if [[ $EUID -eq 0 ]];then
echo "::: You are root."
else
echo "::: sudo will be used."
# Check if it is actually installed
# If it isn't, exit because the install cannot complete
if [[ $(dpkg-query -s sudo) ]];then
export SUDO="sudo"
else
echo "::: Please install sudo or run this script as root."
exit 1
fi
fi
if [[ $# = 0 ]]; then
helpFunc
fi
#globals
basename=pihole
@ -49,7 +67,7 @@ function helpFunc()
{
echo "::: Immediately whitelists one or more domains in the hosts file"
echo ":::"
echo "::: Usage: sudo pihole -w domain1 [domain2 ...]"
echo "::: Usage: pihole -w domain1 [domain2 ...]"
echo ":::"
echo "::: Options:"
echo "::: -d, --delmode Remove domains from the whitelist"
@ -180,10 +198,10 @@ function Reload() {
if [[ $dnsmasqPid ]]; then
# service already running - reload config
sudo kill -HUP "$dnsmasqPid"
$SUDO killall -s HUP dnsmasq
else
# service not running, start it up
sudo service dnsmasq start
$SUDO service dnsmasq start
fi
echo " done!"
}

View File

@ -320,7 +320,7 @@ function gravity_reload() {
if [[ $dnsmasqPid ]]; then
# service already running - reload config
$SUDO kill -HUP "$dnsmasqPid"
$SUDO killall -s HUP dnsmasq
else
# service not running, start it up
$SUDO service dnsmasq start