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
|
2018-08-05 20:14:00 +02:00
|
|
|
# Production tags with valid web footers
|
2019-02-18 20:14:27 +01:00
|
|
|
export CORE_VERSION="$(cat /etc/docker-pi-hole-version)"
|
2020-11-29 20:15:05 +01:00
|
|
|
export WEB_VERSION="${CORE_VERSION}"
|
2020-11-29 20:29:07 +01:00
|
|
|
export PIHOLE_SKIP_OS_CHECK=true
|
2020-11-29 20:15:05 +01:00
|
|
|
# Overwrite WEB_VERSION if core and web versions are different
|
2021-04-14 20:18:20 +02:00
|
|
|
export WEB_VERSION="v5.5"
|
2019-04-12 05:17:22 +02:00
|
|
|
|
2018-08-05 20:14:00 +02:00
|
|
|
# Only use for pre-production / testing
|
2019-04-12 05:17:22 +02:00
|
|
|
export CHECKOUT_BRANCHES=false
|
|
|
|
# Search for release/* branch naming convention for custom checkouts
|
|
|
|
if [[ "$CORE_VERSION" == *"release/"* ]] ; then
|
|
|
|
CHECKOUT_BRANCHES=true
|
|
|
|
fi
|
2017-01-08 17:42:39 +01:00
|
|
|
|
2018-11-01 04:40:00 +01:00
|
|
|
apt-get update
|
2019-05-20 04:19:24 +02:00
|
|
|
apt-get install --no-install-recommends -y curl procps ca-certificates
|
2020-06-04 23:03:48 +02:00
|
|
|
# curl in armhf-buster's image has SSL issues. Running c_rehash fixes it.
|
|
|
|
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923479
|
|
|
|
c_rehash
|
2020-07-16 01:42:29 +02:00
|
|
|
ln -s `which echo` /usr/local/bin/whiptail
|
2018-11-01 04:40:00 +01:00
|
|
|
curl -L -s $S6OVERLAY_RELEASE | tar xvzf - -C /
|
|
|
|
mv /init /s6-init
|
|
|
|
|
2017-01-08 17:42:39 +01:00
|
|
|
# debconf-apt-progress seems to hang so get rid of it too
|
2018-10-30 06:20:45 +01:00
|
|
|
which debconf-apt-progress
|
|
|
|
mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress
|
2017-01-08 17:42:39 +01:00
|
|
|
|
|
|
|
# Get the install functions
|
2019-02-18 20:14:27 +01:00
|
|
|
curl https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_VERSION}/automated%20install/basic-install.sh > "$PIHOLE_INSTALL"
|
2017-01-08 17:42:39 +01:00
|
|
|
PH_TEST=true . "${PIHOLE_INSTALL}"
|
|
|
|
|
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
|
|
|
distro_check
|
|
|
|
|
|
|
|
# fix permission denied to resolvconf post-inst /etc/resolv.conf moby/moby issue #1297
|
2018-10-30 06:20:45 +01:00
|
|
|
apt-get -y install debconf-utils
|
|
|
|
echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections
|
2018-10-21 22:08:23 +02:00
|
|
|
|
2019-09-18 05:13:12 +02:00
|
|
|
ln -s /bin/true /usr/local/bin/service
|
|
|
|
bash -ex "./${PIHOLE_INSTALL}" --unattended
|
|
|
|
rm /usr/local/bin/service
|
2020-02-16 18:43:21 +01:00
|
|
|
|
2018-07-01 00:16:16 +02:00
|
|
|
# IPv6 support for nc openbsd better than traditional
|
|
|
|
apt-get install -y --force-yes netcat-openbsd
|
2017-01-31 06:58:48 +01:00
|
|
|
|
2019-06-23 19:53:08 +02:00
|
|
|
fetch_release_metadata() {
|
|
|
|
local directory="$1"
|
|
|
|
local version="$2"
|
|
|
|
pushd "$directory"
|
|
|
|
git fetch -t
|
|
|
|
git remote set-branches origin '*'
|
|
|
|
git fetch --depth 10
|
|
|
|
git checkout master
|
|
|
|
git reset --hard "$version"
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2019-04-12 05:17:22 +02:00
|
|
|
if [[ $CHECKOUT_BRANCHES == true ]] ; then
|
2018-07-01 00:16:16 +02:00
|
|
|
ln -s /bin/true /usr/local/bin/service
|
2018-12-11 04:28:53 +01:00
|
|
|
ln -s /bin/true /usr/local/bin/update-rc.d
|
2020-04-19 13:42:35 +02:00
|
|
|
echo "${CORE_VERSION}" | sudo tee /etc/pihole/ftlbranch
|
2019-02-18 20:14:27 +01:00
|
|
|
echo y | bash -x pihole checkout core ${CORE_VERSION}
|
|
|
|
echo y | bash -x pihole checkout web ${WEB_VERSION}
|
2020-02-04 06:39:03 +01:00
|
|
|
# echo y | bash -x pihole checkout ftl ${CORE_VERSION}
|
2019-02-18 20:14:27 +01:00
|
|
|
# If the v is forgotten: ${CORE_VERSION/v/}
|
2018-07-01 00:16:16 +02:00
|
|
|
unlink /usr/local/bin/service
|
2018-12-11 04:28:53 +01:00
|
|
|
unlink /usr/local/bin/update-rc.d
|
2018-01-30 20:36:57 +01:00
|
|
|
else
|
|
|
|
# Reset to our tags so version numbers get detected correctly
|
2019-06-23 19:53:08 +02:00
|
|
|
fetch_release_metadata "${PI_HOLE_LOCAL_REPO}" "${CORE_VERSION}"
|
|
|
|
fetch_release_metadata "${webInterfaceDir}" "${WEB_VERSION}"
|
2018-01-30 20:36:57 +01:00
|
|
|
fi
|
2020-02-04 06:39:03 +01: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
|
|
|
|
2018-12-11 21:16:04 +01:00
|
|
|
# Replace the call to `updatePiholeFunc` in arg parse with new `unsupportedFunc`
|
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
|
2018-12-11 21:16:04 +01:00
|
|
|
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
2018-01-01 18:18:29 +01:00
|
|
|
|
2019-06-01 19:16:05 +02:00
|
|
|
touch /.piholeFirstBoot
|
2017-01-08 17:42:39 +01:00
|
|
|
|
2017-05-14 00:03:24 +02:00
|
|
|
echo 'Docker install successful'
|