Skip to content

Commit 01e1e34

Browse files
committed
Merge pull request #441 from pi-hole/development
Pihole v2.6.1.2. Closes #439
2 parents 32ff7fb + 28a3cbf commit 01e1e34

File tree

4 files changed

+52
-36
lines changed

4 files changed

+52
-36
lines changed

advanced/Scripts/blacklist.sh

+18-11
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@
1111
# (at your option) any later version.
1212

1313
if [[ $# = 0 ]]; then
14-
echo "::: Immediately blacklists one or more domains in the hosts file"
15-
echo ":::"
16-
echo "::: Usage: sudo pihole.sh -b domain1 [domain2 ...]"
17-
echo ":::"
18-
echo "::: Options:"
19-
echo "::: -d, --delmode Remove domains from the blacklist"
20-
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
21-
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
22-
echo "::: -q, --quiet output is less verbose"
23-
exit 1
14+
helpFunc
2415
fi
2516

2617
#globals
@@ -58,6 +49,21 @@ if [[ -f $piholeIPv6file ]];then
5849
fi
5950

6051

52+
function helpFunc()
53+
{
54+
echo "::: Immediately blacklists one or more domains in the hosts file"
55+
echo ":::"
56+
echo "::: Usage: sudo pihole.sh -b domain1 [domain2 ...]"
57+
echo ":::"
58+
echo "::: Options:"
59+
echo "::: -d, --delmode Remove domains from the blacklist"
60+
echo "::: -nr, --noreload Update blacklist without refreshing dnsmasq"
61+
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
62+
echo "::: -q, --quiet output is less verbose"
63+
echo "::: -h, --help Show this help dialog"
64+
exit 1
65+
}
66+
6167
function HandleOther(){
6268
#check validity of domain
6369
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
@@ -175,7 +181,8 @@ do
175181
"-nr"| "--noreload" ) reload=false;;
176182
"-d" | "--delmode" ) addmode=false;;
177183
"-f" | "--force" ) force=true;;
178-
"-q" | "--quiet" ) versbose=false;;
184+
"-q" | "--quiet" ) versbose=false;;
185+
"-h" | "--help" ) helpFunc;;
179186
* ) HandleOther "$var";;
180187
esac
181188
done

advanced/Scripts/whitelist.sh

+18-11
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@
1111
# (at your option) any later version.
1212

1313
if [[ $# = 0 ]]; then
14-
echo "::: Immediately whitelists one or more domains in the hosts file"
15-
echo ":::"
16-
echo "::: Usage: sudo pihole.sh -w domain1 [domain2 ...]"
17-
echo ":::"
18-
echo "::: Options:"
19-
echo "::: -d, --delmode Remove domains from the whitelist"
20-
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq"
21-
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
22-
echo "::: -q, --quiet output is less verbose"
23-
exit 1
14+
helpFunc
2415
fi
2516

2617
#globals
@@ -57,6 +48,21 @@ if [[ -f $piholeIPv6file ]];then
5748
fi
5849

5950

51+
function helpFunc()
52+
{
53+
echo "::: Immediately whitelists one or more domains in the hosts file"
54+
echo ":::"
55+
echo "::: Usage: sudo pihole.sh -w domain1 [domain2 ...]"
56+
echo ":::"
57+
echo "::: Options:"
58+
echo "::: -d, --delmode Remove domains from the whitelist"
59+
echo "::: -nr, --noreload Update Whitelist without refreshing dnsmasq"
60+
echo "::: -f, --force Force updating of the hosts files, even if there are no changes"
61+
echo "::: -q, --quiet output is less verbose"
62+
echo "::: -h, --help Show this help dialog"
63+
exit 1
64+
}
65+
6066
function HandleOther(){
6167
#check validity of domain
6268
validDomain=$(echo "$1" | perl -ne'print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/')
@@ -188,7 +194,8 @@ do
188194
"-nr"| "--noreload" ) reload=false;;
189195
"-d" | "--delmode" ) addmode=false;;
190196
"-f" | "--force" ) force=true;;
191-
"-q" | "--quiet" ) versbose=false;;
197+
"-q" | "--quiet" ) versbose=false;;
198+
"-h" | "--help" ) helpFunc;;
192199
* ) HandleOther "$var";;
193200
esac
194201
done

automated install/basic-install.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ welcomeDialogs() {
110110

111111
# Explain the need for a static address
112112
whiptail --msgbox --backtitle "Initating network interface" --title "Static IP Needed" "The Pi-hole is a SERVER so it needs a STATIC IP ADDRESS to function properly.
113-
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
113+
114+
In the next section, you can choose to use your current network settings (DHCP) or to manually edit them." $r $c
114115
}
115116

116117

@@ -174,7 +175,7 @@ cleanupIPv6() {
174175

175176
use4andor6() {
176177
# Let use select IPv4 and/or IPv6
177-
cmd=(whiptail --separate-output --checklist "Select Protocols" $r $c 2)
178+
cmd=(whiptail --separate-output --checklist "Select Protocols (press space to select)" $r $c 2)
178179
options=(IPv4 "Block ads over IPv4" on
179180
IPv6 "Block ads over IPv6" off)
180181
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
@@ -232,8 +233,8 @@ getStaticIPv4Settings() {
232233
Gateway: $IPv4gw" $r $c) then
233234
# If they choose yes, let the user know that the IP address will not be available via DHCP and may cause a conflict.
234235
whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict" "It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that.
235-
If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want.
236-
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c
236+
If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want.
237+
It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c
237238
# Nothing else to do since the variables are already set above
238239
else
239240
# Otherwise, we need to ask the user to input their desired settings.
@@ -695,12 +696,12 @@ displayFinalMessage() {
695696
# Final completion message to user
696697
whiptail --msgbox --backtitle "Make it so." --title "Installation Complete!" "Configure your devices to use the Pi-hole as their DNS server using:
697698
698-
$IPv4addr
699-
$piholeIPv6
699+
IPv4: $IPv4addr
700+
IPv6: $piholeIPv6
700701
701-
If you set a new IP address, you should restart the Pi.
702+
If you set a new IP address, you should restart the Pi.
702703
703-
The install log is in /etc/pihole." $r $c
704+
The install log is in /etc/pihole." $r $c
704705
}
705706

706707
######## SCRIPT ############

pihole

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# (at your option) any later version.
1212

1313
# Must be root to use this tool
14-
if [[ $EUID -eq 0 ]];then
15-
echo "::: You are root."
16-
else
17-
echo "::: Sudo will be used for this tool."
14+
if [[ ! $EUID -eq 0 ]];then
15+
#echo "::: You are root."
16+
#else
17+
#echo "::: Sudo will be used for this tool."
1818
# Check if it is actually installed
1919
# If it isn't, exit because the pihole cannot be invoked without privileges.
2020
if [[ $(dpkg-query -s sudo) ]];then
@@ -63,7 +63,8 @@ function setupLCDFunction {
6363
}
6464

6565
function chronometerFunc {
66-
$SUDO /opt/pihole/chronometer.sh
66+
shift
67+
$SUDO /opt/pihole/chronometer.sh "$@"
6768
exit 1
6869
}
6970

@@ -106,7 +107,7 @@ case "$1" in
106107
"-u" | "updateDashboard" ) updateDashboardFunc;;
107108
"-g" | "updateGravity" ) updateGravityFunc;;
108109
"-s" | "setupLCD" ) setupLCDFunction;;
109-
"-c" | "chronometer" ) chronometerFunc;;
110+
"-c" | "chronometer" ) chronometerFunc "$@";;
110111
"-h" | "help" ) helpFunc;;
111112
"uninstall" ) uninstallFunc;;
112113
* ) helpFunc;;

0 commit comments

Comments
 (0)