Files
shell_sequencer/seqs/pihole.sh

71 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
readonly toolName=pi-hole
step_1_info() { echo "${toolName} statue"; }
step_1_alias() { echo "status"; }
step_1() {
local piholeCmd=
if ! piholeCmd="$(command -v pihole)" ; then
warning "${toolName} not installed"
return 1
fi
exe "${piholeCmd}" status
}
step_3_alias() { echo "restart"; }
step_3() {
exe service pihole-FTL restart
exe pihole restartdns
}
step_10_info() {
echo "Install ${toolName} using the offical installer"
echoinfo "https://install.pi-hole.net"
}
step_10_alias() { echo "install"; }
step_10() {
exep curl -sSL https://install.pi-hole.net \| bash
}
step_11_info() { echo 'Notes'; }
step_11_alias() { echo 'notes'; }
step_11() {
color green
cat <<NOTES_END
[/etc/dnsmasq.d/10-owndhcp.conf]
expand-hosts
local=/lan/
# define custom gateway for dhcp clients
#dhcp-option=3,192.168.0.1
# define dns server for dhcp clients
dhcp-option=6,192.168.0.20,192.168.0.29
# define ntp server for dhcp clients
dhcp-option=42,192.168.0.20
# push static route to vpn network
#dhcp-option=121,10.8.0.0/24,192.168.0.10,0.0.0.0/0,192.168.0.1
[/etc/dnsmasq.d/10-owndomain.conf]
address=/mydomain.com/192.168.0.20
address=/mydomain.com/fd::20
# Use together with unbound
(https://docs.pi-hole.net/guides/dns/unbound)
[/etc/dnsmasq.d/99-edns.conf]
edns-packet-max=1232
NOTES_END
}
step_20_info() { echo "List ${toolName} enabled adlist sources"; }
step_20_alias() { echo 'adlists'; }
step_20() {
exe sqlite3 /etc/pihole/gravity.db 'SELECT address FROM adlist WHERE enabled = 1;'
}
# shellcheck disable=SC2034 # Appears unused
readonly sqr_minVersion=16
# shellcheck disable=SC1091 # Don't follow this source
. /usr/local/bin/sequencer.sh