2017-05-14 00:03:24 +02:00
|
|
|
#!/bin/bash -ex
|
2017-01-08 17:42:39 +01:00
|
|
|
mkdir -p /etc/pihole/
|
2018-01-10 17:05:27 +01:00
|
|
|
export CORE_TAG='v3.2.1'
|
2018-01-05 06:51:30 +01:00
|
|
|
export WEB_TAG='v3.2.1'
|
2018-01-08 15:46:30 +01:00
|
|
|
export FTL_TAG='v2.13.2'
|
2018-01-27 06:58:47 +01:00
|
|
|
export USE_DEVELOPMENT_BRANCHES=true
|
2017-01-08 17:42:39 +01:00
|
|
|
|
2018-01-27 04:14:30 +01:00
|
|
|
if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then
|
|
|
|
# install from custom hash or branch
|
|
|
|
CORE_TAG='development'
|
|
|
|
fi
|
|
|
|
|
2017-01-08 17:42:39 +01:00
|
|
|
# Make pihole scripts fail searching for `systemctl`,
|
|
|
|
# which fails pretty miserably in docker compared to `service`
|
|
|
|
# For more info see docker/docker issue #7459
|
2018-01-26 22:46:17 +01:00
|
|
|
which systemctl && mv "$(which systemctl)" /bin/no_systemctl
|
2017-01-08 17:42:39 +01:00
|
|
|
# debconf-apt-progress seems to hang so get rid of it too
|
2018-01-27 04:10:56 +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
|
2018-01-27 04:14:30 +01:00
|
|
|
wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh
|
2017-01-08 17:42:39 +01:00
|
|
|
PH_TEST=true . "${PIHOLE_INSTALL}"
|
|
|
|
|
|
|
|
# Run only what we need from installer
|
|
|
|
export USER=pihole
|
2017-10-04 18:05:27 +02:00
|
|
|
if [[ "$TAG" == 'debian' ]] ; then
|
2017-01-31 23:01:46 +01:00
|
|
|
distro_check
|
2017-01-08 17:42:39 +01:00
|
|
|
install_dependent_packages INSTALLER_DEPS[@]
|
|
|
|
install_dependent_packages PIHOLE_DEPS[@]
|
2017-03-04 06:13:11 +01:00
|
|
|
install_dependent_packages PIHOLE_WEB_DEPS[@]
|
2017-01-12 03:12:56 +01:00
|
|
|
sed -i "/sleep 2/ d" /etc/init.d/dnsmasq # SLOW
|
2017-05-19 07:36:53 +02:00
|
|
|
# IPv6 support for nc openbsd better than traditional
|
|
|
|
apt-get install -y --force-yes netcat-openbsd
|
2017-01-08 17:42:39 +01:00
|
|
|
fi
|
2017-01-31 06:58:48 +01:00
|
|
|
|
2017-03-04 06:13:11 +01:00
|
|
|
piholeGitUrl="${piholeGitUrl}"
|
|
|
|
webInterfaceGitUrl="${webInterfaceGitUrl}"
|
|
|
|
webInterfaceDir="${webInterfaceDir}"
|
2017-01-31 06:58:48 +01:00
|
|
|
git clone "${piholeGitUrl}" "${PI_HOLE_LOCAL_REPO}"
|
|
|
|
git clone "${webInterfaceGitUrl}" "${webInterfaceDir}"
|
2017-11-14 03:41:49 +01:00
|
|
|
if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then
|
|
|
|
pushd "${PI_HOLE_LOCAL_REPO}"; git checkout development; popd;
|
|
|
|
pushd "${webInterfaceDir}"; git checkout devel; popd;
|
|
|
|
else
|
2017-12-08 06:30:54 +01:00
|
|
|
pushd "${PI_HOLE_LOCAL_REPO}";
|
|
|
|
git reset --hard "${CORE_TAG}";
|
|
|
|
popd;
|
2017-11-14 03:41:49 +01:00
|
|
|
pushd "${webInterfaceDir}"; git reset --hard "${WEB_TAG}"; popd;
|
|
|
|
fi
|
2017-01-08 17:42:39 +01:00
|
|
|
|
|
|
|
export PIHOLE_INTERFACE=eth0
|
|
|
|
export IPV4_ADDRESS=0.0.0.0
|
|
|
|
export IPV6_ADDRESS=0:0:0:0:0:0
|
|
|
|
export PIHOLE_DNS_1=8.8.8.8
|
|
|
|
export PIHOLE_DNS_2=8.8.4.4
|
|
|
|
export QUERY_LOGGING=true
|
2017-01-18 05:49:42 +01:00
|
|
|
|
2017-11-14 03:41:49 +01:00
|
|
|
tmpLog="/tmp/pihole-install.log"
|
|
|
|
installLogLoc="${installLogLoc}"
|
2017-01-08 17:42:39 +01:00
|
|
|
installPihole | tee "${tmpLog}"
|
2017-01-18 05:49:42 +01:00
|
|
|
sed -i 's/readonly //g' /opt/pihole/webpage.sh
|
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
|
|
|
|
# Replace references to `updatePiholeFunc` with new `unsupportedFunc`
|
|
|
|
sed -i $'s/updatePiholeFunc;;/unsupportedFunc;;/g' /usr/local/bin/pihole
|
|
|
|
|
2018-01-27 01:26:46 +01:00
|
|
|
mv "${tmpLog}" /
|
2017-11-20 06:15:44 +01:00
|
|
|
touch /.piholeFirstBoot
|
2017-01-08 17:42:39 +01:00
|
|
|
|
|
|
|
# Fix dnsmasq in docker
|
|
|
|
grep -q '^user=root' || echo -e '\nuser=root' >> /etc/dnsmasq.conf
|
2017-05-14 00:03:24 +02:00
|
|
|
echo 'Docker install successful'
|