Update pihole-install.sh

Code refactoring
This commit is contained in:
tteckster 2022-09-20 12:37:36 -04:00 committed by GitHub
parent 4bcec067e1
commit 3d1c964d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
YW=`echo "\033[33m"` YW=`echo "\033[33m"`
RD=`echo "\033[01;31m"` RD=`echo "\033[01;31m"`
BL=`echo "\033[36m"` BL=`echo "\033[36m"`
@ -76,8 +77,24 @@ apt-get install -y ntp &>/dev/null
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Pi-hole" msg_info "Installing Pi-hole"
wget -O tteck-install.sh https://install.pi-hole.net &>/dev/null mkdir -p /etc/pihole/
bash tteck-install.sh cat <<EOF > /etc/pihole/setupVars.conf
PIHOLE_INTERFACE=eth0
PIHOLE_DNS_1=8.8.8.8
PIHOLE_DNS_2=8.8.4.4
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true
CACHE_SIZE=10000
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSMASQ_LISTENING=local
WEBPASSWORD=$(openssl rand -base64 48)
BLOCKING_ENABLED=true
EOF
curl -sSL https://install.pi-hole.net | bash /dev/stdin --unattended &>/dev/null
msg_ok "Installed Pi-hole" msg_ok "Installed Pi-hole"
PASS=$(grep -w "root" /etc/shadow | cut -b6); PASS=$(grep -w "root" /etc/shadow | cut -b6);
@ -101,5 +118,4 @@ msg_ok "Customized Container"
msg_info "Cleaning up" msg_info "Cleaning up"
apt-get autoremove >/dev/null apt-get autoremove >/dev/null
apt-get autoclean >/dev/null apt-get autoclean >/dev/null
rm -rf /var/{cache,log}/* /var/lib/apt/lists/* /root/tteck-install.sh
msg_ok "Cleaned" msg_ok "Cleaned"