2019-02-09 06:14:44 +01:00
|
|
|
#!/bin/bash -ex
|
2018-10-30 06:20:45 +01:00
|
|
|
|
2019-06-01 19:16:05 +02:00
|
|
|
mkdir -p /etc/pihole/
|
2018-01-31 17:07:55 +01:00
|
|
|
mkdir -p /var/run/pihole
|
2019-04-12 05:17:22 +02:00
|
|
|
|
2021-04-20 00:06:00 +02:00
|
|
|
CORE_LOCAL_REPO=/etc/.pihole
|
|
|
|
WEB_LOCAL_REPO=/var/www/html/admin
|
|
|
|
|
2021-09-12 17:46:19 +02:00
|
|
|
setupVars=/etc/pihole/setupVars.conf
|
2017-01-08 17:42:39 +01:00
|
|
|
|
2021-09-12 23:34:24 +02:00
|
|
|
s6_download_url() {
|
|
|
|
DETECTED_ARCH=$(dpkg --print-architecture)
|
|
|
|
S6_ARCH=$DETECTED_ARCH
|
|
|
|
case $DETECTED_ARCH in
|
|
|
|
armel)
|
|
|
|
S6_ARCH="arm";;
|
|
|
|
armhf)
|
|
|
|
S6_ARCH="arm";;
|
|
|
|
arm64)
|
|
|
|
S6_ARCH="aarch64";;
|
|
|
|
i386)
|
|
|
|
S6_ARCH="x86";;
|
2021-09-15 19:32:38 +02:00
|
|
|
ppc64el)
|
|
|
|
S6_ARCH="ppc64le";;
|
2021-09-12 23:34:24 +02:00
|
|
|
esac
|
|
|
|
echo "https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.gz"
|
|
|
|
}
|
|
|
|
|
2020-07-16 01:42:29 +02:00
|
|
|
ln -s `which echo` /usr/local/bin/whiptail
|
2021-09-12 23:34:24 +02:00
|
|
|
curl -L -s "$(s6_download_url)" | tar xvzf - -C /
|
2018-11-01 04:40:00 +01:00
|
|
|
mv /init /s6-init
|
|
|
|
|
2018-07-01 00:16:16 +02:00
|
|
|
# Preseed variables to assist with using --unattended install
|
|
|
|
{
|
|
|
|
echo "PIHOLE_INTERFACE=eth0"
|
|
|
|
echo "IPV4_ADDRESS=0.0.0.0"
|
|
|
|
echo "IPV6_ADDRESS=0:0:0:0:0:0"
|
|
|
|
echo "PIHOLE_DNS_1=8.8.8.8"
|
|
|
|
echo "QUERY_LOGGING=true"
|
|
|
|
echo "INSTALL_WEB_SERVER=true"
|
|
|
|
echo "INSTALL_WEB_INTERFACE=true"
|
|
|
|
echo "LIGHTTPD_ENABLED=true"
|
|
|
|
}>> "${setupVars}"
|
|
|
|
source $setupVars
|
|
|
|
|
2017-01-08 17:42:39 +01:00
|
|
|
export USER=pihole
|
2018-07-01 00:16:16 +02:00
|
|
|
|
2021-04-20 00:06:00 +02:00
|
|
|
export PIHOLE_SKIP_OS_CHECK=true
|
|
|
|
|
|
|
|
# Run the installer in unattended mode using the preseeded variables above and --reconfigure so that local repos are not updated
|
2021-09-12 17:46:19 +02:00
|
|
|
curl -sSL https://install.pi-hole.net | bash -sex -- --unattended
|
|
|
|
|
2021-12-10 21:51:35 +01:00
|
|
|
# At this stage, if we are building a :nightly tag, then switch the Pi-hole install to dev versions
|
|
|
|
if [[ "${PIHOLE_DOCKER_TAG}" = 'nightly' ]]; then
|
|
|
|
yes | pihole checkout dev
|
|
|
|
fi
|
2021-09-12 17:46:19 +02:00
|
|
|
|
2017-01-18 05:49:42 +01:00
|
|
|
sed -i 's/readonly //g' /opt/pihole/webpage.sh
|
2019-06-01 19:16:05 +02:00
|
|
|
sed -i '/^WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
2018-01-01 18:18:29 +01:00
|
|
|
|
2021-08-05 00:41:39 +02:00
|
|
|
# sed a new function into the `pihole` script just above the `helpFunc()` function for later use.
|
2018-01-01 18:18:29 +01:00
|
|
|
sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in Docker images"\\\n exit 0\\\n}\\\n\\\nhelpFunc() {/g' /usr/local/bin/pihole
|
2021-12-10 21:51:35 +01:00
|
|
|
|
2021-08-05 00:41:39 +02:00
|
|
|
# Replace a few of the `pihole` options with calls to `unsupportedFunc`:
|
|
|
|
# pihole -up / pihole updatePihole
|
2018-12-11 21:16:04 +01:00
|
|
|
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
2021-08-05 00:41:39 +02:00
|
|
|
# pihole uninstall
|
|
|
|
sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
2021-12-10 21:51:35 +01:00
|
|
|
# pihole -r / pihole reconfigure
|
|
|
|
sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
2021-08-05 00:41:39 +02:00
|
|
|
|
2021-12-10 21:51:35 +01:00
|
|
|
if [[ "${PIHOLE_DOCKER_TAG}" != "dev" && "${PIHOLE_DOCKER_TAG}" != "nightly" ]]; then
|
|
|
|
# If we are on a version other than dev or nightly, disable `pihole checkout`, otherwise it is useful to have for quick troubleshooting sometimes
|
2021-11-18 00:42:49 +01:00
|
|
|
sed -i $'s/)\s*piholeCheckoutFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
|
|
|
fi
|
|
|
|
|
2022-03-31 20:49:35 +02:00
|
|
|
if [ ! -f /.piholeFirstBoot ]; then
|
|
|
|
touch /.piholeFirstBoot
|
|
|
|
fi
|
2021-09-12 23:34:24 +02:00
|
|
|
echo 'Docker install successful'
|