Skip to content

Commit

Permalink
Merge pull request #211 from diginc/Installer_patches
Browse files Browse the repository at this point in the history
Update install.sh
  • Loading branch information
diginc authored Jan 27, 2018
2 parents 22ab253 + 45f491f commit 1f176da
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Dockerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
images = {
'debian': [
{
'base': 'debian:jessie',
'base': 'debian:stretch',
'arch': 'amd64'
},
{
'base': 'multiarch/debian-debootstrap:armhf-jessie-slim',
'base': 'multiarch/debian-debootstrap:armhf-stretch-slim',
'arch': 'armhf'
},
{
'base': 'multiarch/debian-debootstrap:arm64-jessie-slim',
'base': 'multiarch/debian-debootstrap:arm64-stretch-slim',
'arch': 'aarch64'
}
]
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/{{ pihole.s6_version }}/s6-overlay-{{ pihole.arch }}.tar.gz

RUN apt-get update && \
apt-get install -y wget curl net-tools cron && \
apt-get install -y wget curl net-tools cron procps && \
curl -L -s $S6OVERLAY_RELEASE \
| tar xvzf - -C / && \
docker-install.sh && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/s6-init" ]

ADD s6/{{ pihole.os }}-root /
COPY s6/service /usr/local/bin/service
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile_debian_aarch64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM multiarch/debian-debootstrap:arm64-jessie-slim
FROM multiarch/debian-debootstrap:arm64-stretch-slim

LABEL image="diginc/pi-hole:debian_aarch64"
LABEL maintainer="adam@diginc.us"
Expand All @@ -14,13 +14,14 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-aarch64.tar.gz

RUN apt-get update && \
apt-get install -y wget curl net-tools cron && \
apt-get install -y wget curl net-tools cron procps && \
curl -L -s $S6OVERLAY_RELEASE \
| tar xvzf - -C / && \
docker-install.sh && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/s6-init" ]

ADD s6/debian-root /
COPY s6/service /usr/local/bin/service
Expand All @@ -41,4 +42,6 @@ ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2

HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1

SHELL ["/bin/bash", "-c"]
11 changes: 7 additions & 4 deletions Dockerfile_debian_amd64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:jessie
FROM debian:stretch

LABEL image="diginc/pi-hole:debian_amd64"
LABEL maintainer="adam@diginc.us"
Expand All @@ -14,13 +14,14 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-amd64.tar.gz

RUN apt-get update && \
apt-get install -y wget curl net-tools cron && \
apt-get install -y wget curl net-tools cron procps && \
curl -L -s $S6OVERLAY_RELEASE \
| tar xvzf - -C / && \
docker-install.sh && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/s6-init" ]

ADD s6/debian-root /
COPY s6/service /usr/local/bin/service
Expand All @@ -41,4 +42,6 @@ ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2

HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1

SHELL ["/bin/bash", "-c"]
11 changes: 7 additions & 4 deletions Dockerfile_debian_armhf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM multiarch/debian-debootstrap:armhf-jessie-slim
FROM multiarch/debian-debootstrap:armhf-stretch-slim

LABEL image="diginc/pi-hole:debian_armhf"
LABEL maintainer="adam@diginc.us"
Expand All @@ -14,13 +14,14 @@ ENV PIHOLE_INSTALL /tmp/ph_install.sh
ENV S6OVERLAY_RELEASE https://github.com/just-containers/s6-overlay/releases/download/v1.21.2.2/s6-overlay-armhf.tar.gz

RUN apt-get update && \
apt-get install -y wget curl net-tools cron && \
apt-get install -y wget curl net-tools cron procps && \
curl -L -s $S6OVERLAY_RELEASE \
| tar xvzf - -C / && \
docker-install.sh && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* && \
mv /init /s6-init

ENTRYPOINT [ "/init" ]
ENTRYPOINT [ "/s6-init" ]

ADD s6/debian-root /
COPY s6/service /usr/local/bin/service
Expand All @@ -41,4 +42,6 @@ ENV S6_LOGGING 0
ENV S6_KEEP_ENV 1
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2

HEALTHCHECK CMD dig @127.0.0.1 pi.hole || exit 1

SHELL ["/bin/bash", "-c"]
13 changes: 6 additions & 7 deletions bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ validate_env() {
exit 1
fi;

# Debian
nc_error='Name or service not known'

# Required ServerIP is a valid IP
if nc -w1 -z "$ServerIP" 53 2>&1 | grep -q "$nc_error" ; then
# nc won't throw any text based errors when it times out connecting to a valid IP, otherwise it complains about the DNS name being garbage
# if nc doesn't behave as we expect on a valid IP the routing table should be able to look it up and return a 0 retcode
if [[ "$(nc -4 -w1 -z "$ServerIP" 53 2>&1)" != "" ]] || ! ip route get "$ServerIP" > /dev/null ; then
echo "ERROR: ServerIP Environment variable ($ServerIP) doesn't appear to be a valid IPv4 address"
exit 1
fi
Expand All @@ -31,7 +30,7 @@ validate_env() {
unset ServerIPv6
exit 1
fi
if nc -w 1 -z "$ServerIPv6" 53 2>&1 | grep -q "$nc_error" || ! ip route get "$ServerIPv6" > /dev/null ; then
if [[ "$(nc -6 -w1 -z "$ServerIPv6" 53 2>&1)" != "" ]] || ! ip route get "$ServerIPv6" > /dev/null ; then
echo "ERROR: ServerIPv6 Environment variable ($ServerIPv6) doesn't appear to be a valid IPv6 address"
echo " TIP: If your server is not IPv6 enabled just remove '-e ServerIPv6' from your docker container"
exit 1
Expand Down Expand Up @@ -227,9 +226,9 @@ test_configs() {
test_configs_debian() {
set -e
echo -n '::: Testing DNSmasq config: '
dnsmasq --test -7 /etc/dnsmasq.d
dnsmasq --test -7 /etc/dnsmasq.d || exit 1
echo -n '::: Testing lighttpd config: '
lighttpd -t -f /etc/lighttpd/lighttpd.conf
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
set +e
echo "::: All config checks passed, starting ..."
}
Expand Down
15 changes: 9 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ mkdir -p /etc/pihole/
export CORE_TAG='v3.2.1'
export WEB_TAG='v3.2.1'
export FTL_TAG='v2.13.2'
export USE_DEVELOPMENT_BRANCHES=false
export USE_DEVELOPMENT_BRANCHES=true

if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then
# install from custom hash or branch
CORE_TAG='development'
fi

# Make pihole scripts fail searching for `systemctl`,
# which fails pretty miserably in docker compared to `service`
# For more info see docker/docker issue #7459
mv "$(which systemctl)" /bin/no_systemctl && \
which systemctl && mv "$(which systemctl)" /bin/no_systemctl
# debconf-apt-progress seems to hang so get rid of it too
mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress
which debconf-apt-progress && mv "$(which debconf-apt-progress)" /bin/no_debconf-apt-progress

# Get the install functions
wget -O "$PIHOLE_INSTALL" https://raw.githubusercontent.com/pi-hole/pi-hole/${CORE_TAG}/automated%20install/basic-install.sh
Expand Down Expand Up @@ -39,8 +44,6 @@ if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then
else
pushd "${PI_HOLE_LOCAL_REPO}";
git reset --hard "${CORE_TAG}";
# Can be removed once https://github.com/pi-hole/pi-hole/pull/1779 is in a release
git checkout 8d721d086cbe4b49665c9e0b1d81499b284776a9 gravity.sh
popd;
pushd "${webInterfaceDir}"; git reset --hard "${WEB_TAG}"; popd;
fi
Expand All @@ -61,7 +64,7 @@ sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in
# Replace references to `updatePiholeFunc` with new `unsupportedFunc`
sed -i $'s/updatePiholeFunc;;/unsupportedFunc;;/g' /usr/local/bin/pihole

mv "${tmpLog}" "${instalLogLoc}"
mv "${tmpLog}" /
touch /.piholeFirstBoot

# Fix dnsmasq in docker
Expand Down
7 changes: 5 additions & 2 deletions s6/debian-root/etc/cont-init.d/20-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
bashCmd='bash -e -x'
fi

$bashCmd /start.sh

# Start dnsmasq for validate_env and gravity.sh
dnsmasq -7 /etc/dnsmasq.d

$bashCmd /start.sh
gravity.sh

# Kill dnsmasq because s6 won't like it if it's running when s6 services start
kill -9 $(pgrep dnsmasq) || true

0 comments on commit 1f176da

Please sign in to comment.