mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-28 12:11:04 +02:00
611df9b3f0
- Moves most code in start.sh into functions in bash_functions.sh - Removes code from 20-start.sh and moves it inside start.sh - Removes unused variables and code, making it easier to find our way around - Removes dependency on webpage.sh, which had to be modified in order to source it properly (thus breaking pihole checkout), use utils.sh instead - Replaces all uses of ServerIP/v6 with new FTLCONF_REPLY_ADDR4/6 variables - No need to symlink echo to whiptail any more (probably hasn't been needed for a while) - removes huge list of exported env vars at the top of start.sh - no longer appear to be needed - rename some functions in bash_functions to more logical names, group their usages in start.sh - adjust/fix tests to match changes - remove some dead tests Signed-off-by: Adam Warner <me@adamwarner.co.uk>
40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
|
|
|
|
PIHOLE_BASE="${PIHOLE_BASE:-$(pwd)}"
|
|
[[ -d "$PIHOLE_BASE" ]] || mkdir -p "$PIHOLE_BASE" || { echo "Couldn't create storage directory: $PIHOLE_BASE"; exit 1; }
|
|
|
|
# Note: FTLCONF_REPLY_ADDR4 should be replaced with your external ip.
|
|
docker run -d \
|
|
--name pihole \
|
|
-p 53:53/tcp -p 53:53/udp \
|
|
-p 80:80 \
|
|
-e TZ="America/Chicago" \
|
|
-v "${PIHOLE_BASE}/etc-pihole:/etc/pihole" \
|
|
-v "${PIHOLE_BASE}/etc-dnsmasq.d:/etc/dnsmasq.d" \
|
|
--dns=127.0.0.1 --dns=1.1.1.1 \
|
|
--restart=unless-stopped \
|
|
--hostname pi.hole \
|
|
-e VIRTUAL_HOST="pi.hole" \
|
|
-e PROXY_LOCATION="pi.hole" \
|
|
-e FTLCONF_REPLY_ADDR4="127.0.0.1" \
|
|
pihole/pihole:latest
|
|
|
|
printf 'Starting up pihole container '
|
|
for i in $(seq 1 20); do
|
|
if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then
|
|
printf ' OK'
|
|
echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/"
|
|
exit 0
|
|
else
|
|
sleep 3
|
|
printf '.'
|
|
fi
|
|
|
|
if [ $i -eq 20 ] ; then
|
|
echo -e "\nTimed out waiting for Pi-hole start, consult your container logs for more info (\`docker logs pihole\`)"
|
|
exit 1
|
|
fi
|
|
done;
|