-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Pi-hole to v6 development branch
DO NOT MERGE Signed-off-by: Kyle Harding <[email protected]>
- Loading branch information
Showing
11 changed files
with
90 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# https://hub.docker.com/r/pihole/pihole/tags | ||
FROM pihole/pihole:2023.11.0@sha256:24b1ef8f66d810faffefdb9b66850bbe2d55013506b892605acef414e210edeb | ||
FROM pihole/pihole:development-v6 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
# https://wiki.alpinelinux.org/wiki/Fonts | ||
# hadolint ignore=DL3018 | ||
RUN apk add --no-cache dbus font-terminus kbd | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y console-setup dbus netcat && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
COPY balena-init.sh / | ||
|
||
COPY cont-init.d/ /etc/cont-init.d/ | ||
COPY s6-overlay/ /etc/s6-overlay/ | ||
RUN chmod +x /balena-init.sh | ||
|
||
RUN chmod +x /etc/cont-init.d/10-custom.sh | ||
ENTRYPOINT [ "tini", "--", "/balena-init.sh" ] | ||
|
||
ENV DBUS_SYSTEM_BUS_ADDRESS 'unix:path=/host/run/dbus/system_bus_socket' | ||
ENV CONSOLE_FONT 'ter-u16n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# avoid port conflicts with resin-dns | ||
# https://docs.pi-hole.net/ftldns/interfaces/ | ||
mkdir -p /etc/dnsmasq.d | ||
echo "bind-interfaces" >/etc/dnsmasq.d/90-resin-dns.conf | ||
echo "except-interface=resin-dns" >>/etc/dnsmasq.d/90-resin-dns.conf | ||
# remove deprecated dnsmasq config files if they exist | ||
rm -f /etc/dnsmasq.d/balena.conf /etc/dnsmasq.d/01-pihole.conf | ||
|
||
# source bash functions like setFTLConfigValue | ||
# shellcheck source=/dev/null | ||
# . /usr/bin/bash_functions.sh | ||
|
||
# enable inclusion of dnsmasq.d conf files | ||
# https://github.com/pi-hole/FTL/pull/1734 | ||
pihole-FTL --config misc.etc_dnsmasq_d true | ||
|
||
# update the webpassword if one was provided | ||
pihole setpassword "${WEBPASSWORD:-}" || true | ||
|
||
# check if we are using unbound as upstream DNS | ||
if [[ ${PIHOLE_DNS_%;*} =~ ^127\.0\.0\.1#5053$ ]]; then | ||
# https://docs.pi-hole.net/guides/dns/unbound/ | ||
# https://docs.pi-hole.net/ftldns/dnsmasq_warn/#reducing-dns-packet-size-for-nameserver-address-to-safe_pktsz | ||
pkt_size=1232 | ||
echo "Reducing DNS packet size for nameserver ${PIHOLE_DNS_%;*} to ${pkt_size}..." | ||
echo "edns-packet-max=${pkt_size}" >/etc/dnsmasq.d/99-edns.conf | ||
fi | ||
|
||
# execute the Pi-hole entrypoint in the background | ||
/usr/bin/start.sh & | ||
pid=$! | ||
|
||
# quit the plymouth (balena logo) service so that we can see the TTY | ||
echo "Stopping plymouth service..." | ||
dbus-send \ | ||
--system \ | ||
--dest=org.freedesktop.systemd1 \ | ||
--type=method_call \ | ||
--print-reply \ | ||
/org/freedesktop/systemd1 org.freedesktop.systemd1.Manager.StartUnit \ | ||
string:"plymouth-quit.service" string:"replace" | ||
|
||
# get the FTL webserver port | ||
webserver_port="$(pihole-FTL --config webserver.port)" | ||
webserver_port="${webserver_port%%,*}" | ||
|
||
is_api_available() { | ||
response="$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:${webserver_port}/api/auth")" | ||
case "${response}" in | ||
200 | 401) return 0 ;; | ||
*) return 1 ;; | ||
esac | ||
} | ||
|
||
set -x | ||
|
||
# wait for FTL API to be available | ||
while ! is_api_available; do | ||
sleep 2 | ||
done | ||
|
||
console=/dev/tty1 | ||
|
||
# check if console is available | ||
if [ -e "${console}" ]; then | ||
# https://wiki.alpinelinux.org/wiki/Fonts | ||
# https://www.man7.org/linux/man-pages/man8/setfont.8.html | ||
echo "Setting console font to ${CONSOLE_FONT}..." | ||
setfont -C "${console}" /usr/share/consolefonts/"${CONSOLE_FONT}".psf.gz | ||
|
||
# start PADD as a background process | ||
echo "Starting PADD..." | ||
/usr/local/bin/padd --secret "${WEBPASSWORD:-}" 2>/dev/null >"${console}" & | ||
fi | ||
|
||
# reattach to the Pi-hole entrypoint process | ||
wait $pid |
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.