commit
cf42873171
|
@ -1,6 +1,8 @@
|
|||
FROM alpine:edge
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE alpine
|
||||
|
||||
RUN apk add --update \
|
||||
dnsmasq \
|
||||
nginx \
|
||||
|
@ -57,6 +59,7 @@ RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
|
|||
ENV PHP_ENV_CONFIG '/etc/php5/fpm.d/envs.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/nginx/error.log'
|
||||
COPY ./alpine/start.sh /
|
||||
COPY ./common_start.sh /
|
||||
|
||||
# IPV6 disable flag for networks/devices that do not support it
|
||||
ENV IPv6 True
|
||||
|
|
|
@ -39,44 +39,26 @@ function helpFunc()
|
|||
exit 1
|
||||
}
|
||||
|
||||
piholeIPfile=/etc/pihole/piholeIP
|
||||
piholeIPv6file=/etc/pihole/.useIPv6
|
||||
|
||||
adListFile=/etc/pihole/adlists.list
|
||||
adListDefault=/etc/pihole/adlists.default
|
||||
whitelistScript=/opt/pihole/whitelist.sh
|
||||
blacklistScript=/opt/pihole/blacklist.sh
|
||||
|
||||
if [[ -f ${piholeIPfile} ]];then
|
||||
# If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script
|
||||
piholeIP=$(cat ${piholeIPfile})
|
||||
#rm $piholeIPfile
|
||||
else
|
||||
# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script
|
||||
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||
piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}')
|
||||
piholeIP=${piholeIPCIDR%/*}
|
||||
fi
|
||||
|
||||
if [[ -f ${piholeIPv6file} ]];then
|
||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
||||
fi
|
||||
#Source the setupVars from install script for the IP
|
||||
. /etc/pihole/setupVars.conf
|
||||
#Remove the /* from the end of the IPv4addr.
|
||||
IPv4addr=${IPv4addr%/*}
|
||||
|
||||
# Variables for various stages of downloading and formatting the list
|
||||
## Nate 3/26/2016 - Commented unused variables
|
||||
basename=pihole
|
||||
piholeDir=/etc/${basename}
|
||||
adList=${piholeDir}/gravity.list
|
||||
#blacklist=$piholeDir/blacklist.txt
|
||||
#whitelist=$piholeDir/whitelist.txt
|
||||
#latentWhitelist=$piholeDir/latentWhitelist.txt
|
||||
justDomainsExtension=domains
|
||||
matterandlight=${basename}.0.matterandlight.txt
|
||||
matterAndLight=${basename}.0.matterandlight.txt
|
||||
supernova=${basename}.1.supernova.txt
|
||||
eventHorizon=${basename}.2.eventHorizon.txt
|
||||
accretionDisc=${basename}.3.accretionDisc.txt
|
||||
#eyeOfTheNeedle=$basename.4.wormhole.txt
|
||||
|
||||
# After setting defaults, check if there's local overrides
|
||||
if [[ -r ${piholeDir}/pihole.conf ]];then
|
||||
|
@ -213,10 +195,10 @@ function gravity_Schwarzchild() {
|
|||
echo "::: "
|
||||
# Find all active domains and compile them into one file and remove CRs
|
||||
echo -n "::: Aggregating list of domains..."
|
||||
truncate -s 0 ${piholeDir}/${matterandlight}
|
||||
truncate -s 0 ${piholeDir}/${matterAndLight}
|
||||
for i in "${activeDomains[@]}"
|
||||
do
|
||||
cat "$i" | tr -d '\r' >> ${piholeDir}/${matterandlight}
|
||||
cat "$i" | tr -d '\r' >> ${piholeDir}/${matterAndLight}
|
||||
done
|
||||
echo " done!"
|
||||
}
|
||||
|
@ -264,17 +246,23 @@ function gravity_unique() {
|
|||
function gravity_hostFormat() {
|
||||
# Format domain list as "192.168.x.x domain.com"
|
||||
echo "::: Formatting domains into a HOSTS file..."
|
||||
hostname=$(</etc/hostname)
|
||||
if [[ -f /etc/hostname ]]; then
|
||||
hostname=$(</etc/hostname)
|
||||
elif [ -x "$(command -v hostname)" ]; then
|
||||
hostname=$(hostname -f)
|
||||
else
|
||||
echo "::: Error: Unable to determine fully qualified domain name of host"
|
||||
fi
|
||||
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
echo -e "$piholeIP $hostname\n$piholeIPv6 $hostname\n$piholeIP pi.hole\n$piholeIPv6 pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
echo -e "$IPv4addr $hostname\n$piholeIPv6 $hostname\n$IPv4addr pi.hole\n$piholeIPv6 pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" -v ipv6addr="$piholeIPv6" '{sub(/\r$/,""); print ipv4addr" "$0"\n"ipv6addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
else
|
||||
# Otherwise, just create gravity.list as normal using IPv4
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
echo -e "$piholeIP $hostname\n$piholeIP pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$piholeIP" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
echo -e "$IPv4addr $hostname\n$IPv4addr pi.hole" > ${piholeDir}/${accretionDisc}
|
||||
cat ${piholeDir}/${eventHorizon} | awk -v ipv4addr="$IPv4addr" '{sub(/\r$/,""); print ipv4addr" "$0}' >> ${piholeDir}/${accretionDisc}
|
||||
fi
|
||||
|
||||
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
|
||||
|
@ -301,7 +289,10 @@ function gravity_advanced() {
|
|||
# This helps with that and makes it easier to read
|
||||
# It also helps with debugging so each stage of the script can be researched more in depth
|
||||
echo -n "::: Formatting list of domains to remove comments...."
|
||||
awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterandlight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
#awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' ${piholeDir}/${matterAndLight} | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
#Above line does not correctly grab domains where comment is on the same line (e.g 'addomain.com #comment')
|
||||
#Add additional awk command to read all lines up to a '#', and then continue as we were
|
||||
cat ${piholeDir}/${matterAndLight} | awk -F'#' '{print $1}' | awk '($1 !~ /^#/) { if (NF>1) {print $2} else {print $1}}' | sed -nr -e 's/\.{2,}/./g' -e '/\./p' > ${piholeDir}/${supernova}
|
||||
echo " done!"
|
||||
|
||||
numberOf=$(wc -l < ${piholeDir}/${supernova})
|
||||
|
@ -349,14 +340,13 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list
|
||||
|
||||
if [[ ${forceGrav} == true ]]; then
|
||||
echo -n "::: Deleting exising list cache..."
|
||||
${SUDO} rm /etc/pihole/list.*
|
||||
echo " done!"
|
||||
fi
|
||||
|
||||
#Overwrite adlists.default from /etc/.pihole in case any changes have been made. Changes should be saved in /etc/adlists.list
|
||||
${SUDO} cp /etc/.pihole/adlists.default /etc/pihole/adlists.default
|
||||
gravity_collapse
|
||||
gravity_spinup
|
||||
|
|
|
@ -1,44 +1,21 @@
|
|||
#!/bin/sh
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
echo "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container with the IP of your docker host from which you are passing web (80) and dns (53) ports from"
|
||||
exit 1
|
||||
fi;
|
||||
. /common_start.sh
|
||||
# Dockerfile variables
|
||||
export IMAGE
|
||||
export ServerIP
|
||||
export ServerIPv6
|
||||
export DNS1
|
||||
export DNS2
|
||||
export PYTEST
|
||||
export PHP_ENV_CONFIG
|
||||
export PHP_ERROR_LOG
|
||||
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf;
|
||||
echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf;
|
||||
|
||||
if [ ! -f /var/run/dockerpihole-firstboot ] ; then
|
||||
echo "[www]" > $PHP_ENV_CONFIG;
|
||||
echo "env[PATH] = ${PATH}" >> $PHP_ENV_CONFIG;
|
||||
echo "env[PHP_ERROR_LOG] = ${PHP_ERROR_LOG}" >> $PHP_ENV_CONFIG;
|
||||
echo "env[ServerIP] = ${ServerIP}" >> $PHP_ENV_CONFIG;
|
||||
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
echo "env[VIRTUAL_HOST] = ${VIRTUAL_HOST}" >> $PHP_ENV_CONFIG;
|
||||
|
||||
touch /var/run/dockerpihole-firstboot
|
||||
else
|
||||
echo "Skipped first boot configuration, looks like you're restarting this container"
|
||||
fi;
|
||||
|
||||
echo "Added ENV to php:"
|
||||
cat $PHP_ENV_CONFIG
|
||||
|
||||
dnsType='default'
|
||||
DNS1=${DNS1:-'8.8.8.8'}
|
||||
DNS2=${DNS2:-'8.8.4.4'}
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i "s/@DNS1@/$DNS1/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
validate_env
|
||||
setup_saved_variables
|
||||
setup_php_env
|
||||
setup_dnsmasq
|
||||
|
||||
# alpine unique currently
|
||||
ip_versions="IPv4 and IPv6"
|
||||
if [ "$IPv6" != "True" ] ; then
|
||||
ip_versions="IPv4"
|
||||
|
@ -46,14 +23,10 @@ if [ "$IPv6" != "True" ] ; then
|
|||
fi;
|
||||
echo "Using $ip_versions"
|
||||
|
||||
dnsmasq --test -7 /etc/dnsmasq.d || exit 1
|
||||
php-fpm -t || exit 1
|
||||
nginx -t || exit 1
|
||||
echo " :: All config checks passed, starting ..."
|
||||
test_configs
|
||||
test_framework_stubbing
|
||||
|
||||
if [ -n "$PYTEST" ] ; then sed -i 's/^gravity_spinup/#donotcurl/g' `which gravity.sh`; fi;
|
||||
gravity.sh
|
||||
dnsmasq -7 /etc/dnsmasq.d
|
||||
gravity.sh # dnsmasq start included
|
||||
php-fpm
|
||||
nginx
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
validate_env() {
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
echo "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container with the IP of your docker host from which you are passing web (80) and dns (53) ports from"
|
||||
exit 1
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_saved_variables() {
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
echo "IPv4addr=$ServerIP" > /etc/pihole/setupVars.conf;
|
||||
echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf;
|
||||
}
|
||||
|
||||
setup_dnsmasq() {
|
||||
local dnsType='default'
|
||||
local DNS1="${1:-8.8.8.8}"
|
||||
local DNS2="${2:-8.8.4.4}"
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i "s/@DNS1@/$DNS1/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf
|
||||
}
|
||||
|
||||
setup_php_env() {
|
||||
if [ ! -f /var/run/dockerpihole-firstboot ] ; then
|
||||
case $IMAGE in
|
||||
"debian") setup_php_env_debian ;;
|
||||
"alpine") setup_php_env_alpine ;;
|
||||
esac
|
||||
|
||||
touch /var/run/dockerpihole-firstboot
|
||||
else
|
||||
echo "Looks like you're restarting this container, skipping php env setup"
|
||||
fi;
|
||||
}
|
||||
|
||||
setup_php_env_debian() {
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"ServerIP\" => \"${ServerIP}\"," $PHP_ENV_CONFIG
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\"," $PHP_ENV_CONFIG
|
||||
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|ServerIP)' $PHP_ENV_CONFIG
|
||||
}
|
||||
|
||||
setup_php_env_alpine() {
|
||||
echo "[www]" > $PHP_ENV_CONFIG;
|
||||
echo "env[PATH] = ${PATH}" >> $PHP_ENV_CONFIG;
|
||||
echo "env[PHP_ERROR_LOG] = ${PHP_ERROR_LOG}" >> $PHP_ENV_CONFIG;
|
||||
echo "env[ServerIP] = ${ServerIP}" >> $PHP_ENV_CONFIG;
|
||||
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
echo "env[VIRTUAL_HOST] = ${VIRTUAL_HOST}" >> $PHP_ENV_CONFIG;
|
||||
|
||||
echo "Added ENV to php:"
|
||||
cat $PHP_ENV_CONFIG
|
||||
}
|
||||
|
||||
test_configs() {
|
||||
case $IMAGE in
|
||||
"debian") test_configs_debian ;;
|
||||
"alpine") test_configs_alpine ;;
|
||||
esac
|
||||
}
|
||||
|
||||
test_configs_debian() {
|
||||
set -e
|
||||
echo -n '::: Testing DNSmasq config: '
|
||||
dnsmasq --test -7 /etc/dnsmasq.d
|
||||
echo -n '::: Testing lighttpd config: '
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf
|
||||
set +e
|
||||
echo "::: All config checks passed, starting ..."
|
||||
}
|
||||
|
||||
test_configs_alpine() {
|
||||
set -e
|
||||
echo -n '::: Testing DNSmasq config: '
|
||||
dnsmasq --test -7 /etc/dnsmasq.d
|
||||
echo -n '::: Testing PHP-FPM config: '
|
||||
php-fpm -t
|
||||
echo -n '::: Testing NGINX config: '
|
||||
nginx -t
|
||||
set +e
|
||||
echo "::: All config checks passed, starting ..."
|
||||
}
|
||||
|
||||
test_framework_stubbing() {
|
||||
if [ -n "$PYTEST" ] ; then sed -i 's/^gravity_spinup/#donotcurl/g' `which gravity.sh`; fi;
|
||||
}
|
|
@ -2,6 +2,7 @@ FROM jsurf/rpi-raspbian
|
|||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
RUN [ "cross-build-start" ]
|
||||
ENV IMAGE debian
|
||||
|
||||
# Requirements
|
||||
RUN apt-get -q update && \
|
||||
|
@ -9,7 +10,7 @@ RUN apt-get -q update && \
|
|||
dnsmasq \
|
||||
lighttpd \
|
||||
php5-common php5-cgi php5 \
|
||||
bc curl unzip wget sudo && \
|
||||
bc curl unzip wget sudo dnsutils && \
|
||||
rm -rf /var/cache/apt/archives
|
||||
|
||||
# Original upstream pihole code being used
|
||||
|
@ -54,11 +55,13 @@ RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
|
|||
# php config start passes special ENVs into
|
||||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./debian-armhf/start.sh /
|
||||
COPY ./debian/start.sh /
|
||||
COPY ./common_start.sh /
|
||||
|
||||
EXPOSE 53 53/udp
|
||||
EXPOSE 80
|
||||
|
||||
# Tini doesn't work in ARM
|
||||
ENTRYPOINT [ "bash", "-c" ]
|
||||
CMD [ "/start.sh" ]
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#!/bin/sh
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
echo "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container with the IP of your docker host from which you are passing web (80) and dns (53) ports from"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf;
|
||||
echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf;
|
||||
|
||||
if [ ! -f /var/run/dockerpihole-firstboot ] ; then
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"ServerIP\" => \"${ServerIP}\"," $PHP_ENV_CONFIG
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\"," $PHP_ENV_CONFIG
|
||||
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG
|
||||
|
||||
touch /var/run/dockerpihole-firstboot
|
||||
else
|
||||
echo "Skipped first boot configuration, looks like you're restarting this container"
|
||||
fi;
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|ServerIP)' $PHP_ENV_CONFIG
|
||||
|
||||
dnsType='default'
|
||||
DNS1=${DNS1:-'8.8.8.8'}
|
||||
DNS2=${DNS2:-'8.8.4.4'}
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i "s/@DNS1@/$DNS1/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
|
||||
dnsmasq --test -7 /etc/dnsmasq.d || exit 1
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
|
||||
|
||||
gravity.sh # dnsmasq start included
|
||||
service lighttpd start
|
||||
|
||||
tail -F /var/log/lighttpd/*.log /var/log/pihole.log
|
|
@ -1,6 +1,8 @@
|
|||
FROM debian:jessie
|
||||
MAINTAINER adam@diginc.us <adam@diginc.us>
|
||||
|
||||
ENV IMAGE debian
|
||||
|
||||
ENV TINI_VERSION v0.9.0
|
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
||||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc
|
||||
|
@ -14,7 +16,7 @@ RUN apt-get -q update && \
|
|||
dnsmasq \
|
||||
lighttpd \
|
||||
php5-common php5-cgi php5 \
|
||||
bc curl unzip wget sudo && \
|
||||
bc curl unzip wget sudo dnsutils && \
|
||||
rm -rf /var/cache/apt/archives
|
||||
|
||||
# Original upstream pihole code being used
|
||||
|
@ -60,6 +62,7 @@ RUN grep -q '^user=root' || echo 'user=root' >> /etc/dnsmasq.conf
|
|||
ENV PHP_ENV_CONFIG '/etc/lighttpd/conf-enabled/15-fastcgi-php.conf'
|
||||
ENV PHP_ERROR_LOG '/var/log/lighttpd/error.log'
|
||||
COPY ./debian/start.sh /
|
||||
COPY ./common_start.sh /
|
||||
|
||||
# IPV6 disable flag for networks/devices that do not support it
|
||||
# not fully supported in debian yet
|
||||
|
|
|
@ -1,47 +1,22 @@
|
|||
#!/bin/sh
|
||||
if [ -z "$ServerIP" ] ; then
|
||||
echo "ERROR: To function correctly you must pass an environment variables of 'ServerIP' into the docker container with the IP of your docker host from which you are passing web (80) and dns (53) ports from"
|
||||
exit 1
|
||||
fi;
|
||||
#!/bin/bash -e
|
||||
. /common_start.sh
|
||||
# Dockerfile variables
|
||||
export IMAGE
|
||||
export ServerIP
|
||||
export ServerIPv6
|
||||
export DNS1
|
||||
export DNS2
|
||||
export PYTEST
|
||||
export PHP_ENV_CONFIG
|
||||
export PHP_ERROR_LOG
|
||||
|
||||
# /tmp/piholeIP is the current override of auto-lookup in gravity.sh
|
||||
echo "$ServerIP" > /etc/pihole/piholeIP;
|
||||
echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf;
|
||||
echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf;
|
||||
validate_env
|
||||
setup_saved_variables
|
||||
setup_php_env
|
||||
setup_dnsmasq
|
||||
test_configs
|
||||
test_framework_stubbing
|
||||
|
||||
if [ ! -f /var/run/dockerpihole-firstboot ] ; then
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"ServerIP\" => \"${ServerIP}\"," $PHP_ENV_CONFIG
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"PHP_ERROR_LOG\" => \"${PHP_ERROR_LOG}\"," $PHP_ENV_CONFIG
|
||||
|
||||
if [ -z "$VIRTUAL_HOST" ] ; then
|
||||
VIRTUAL_HOST="$ServerIP"
|
||||
fi;
|
||||
sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG
|
||||
|
||||
touch /var/run/dockerpihole-firstboot
|
||||
else
|
||||
echo "Skipped first boot configuration, looks like you're restarting this container"
|
||||
fi;
|
||||
|
||||
echo "Added ENV to php:"
|
||||
grep -E '(VIRTUAL_HOST|ServerIP)' $PHP_ENV_CONFIG
|
||||
|
||||
dnsType='default'
|
||||
DNS1=${DNS1:-'8.8.8.8'}
|
||||
DNS2=${DNS2:-'8.8.4.4'}
|
||||
if [ "$DNS1" != '8.8.8.8' ] || [ "$DNS2" != '8.8.4.4' ] ; then
|
||||
dnsType='custom'
|
||||
fi;
|
||||
|
||||
echo "Using $dnsType DNS servers: $DNS1 & $DNS2"
|
||||
sed -i "s/@DNS1@/$DNS1/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
sed -i "s/@DNS2@/$DNS2/" /etc/dnsmasq.d/01-pihole.conf && \
|
||||
|
||||
dnsmasq --test -7 /etc/dnsmasq.d || exit 1
|
||||
lighttpd -t -f /etc/lighttpd/lighttpd.conf || exit 1
|
||||
echo " :: All config checks passed, starting ..."
|
||||
|
||||
if [ -n "$PYTEST" ] ; then sed -i 's/^gravity_spinup/#donotcurl/g' `which gravity.sh`; fi;
|
||||
gravity.sh # dnsmasq start included
|
||||
service lighttpd start
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|||
# Download any updates from the adlists
|
||||
59 1 * * 7 root docker exec $DOCKER_NAME pihole updateGravity > /dev/null
|
||||
|
||||
# Pi-hole: Update the Web interface shortly after gravity runs
|
||||
# This should also update the version number if it is changed in the dashboard repo
|
||||
#30 2 * * 7 root docker exec $DOCKER_NAME pihole updateDashboard > /dev/null
|
||||
# Update docker-pi-hole by pulling the latest docker image ane re-creating your container.
|
||||
# pihole software update commands are unsupported in docker!
|
||||
#30 2 * * 7 root docker exec $DOCKER_NAME pihole updatePihole > /dev/null
|
||||
|
||||
# Pi-hole: Parse the log file before it is flushed and save the stats to a database
|
||||
# This will be used for a historical view of your Pi-hole's performance
|
||||
|
|
2
pi-hole
2
pi-hole
|
@ -1 +1 @@
|
|||
Subproject commit 6eedfb572e474e7a88f8dc6526ffee7ff8979559
|
||||
Subproject commit 5966d76e9a8ebb5b65327d6ff861cafa86149c7a
|
|
@ -1 +1 @@
|
|||
V2.9.1
|
||||
V2.9.2
|
||||
|
|
|
@ -6,12 +6,13 @@ run_local = testinfra.get_backend(
|
|||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
@pytest.mark.parametrize("image,tag", [
|
||||
( 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||
( 'debian.docker', 'diginc/pi-hole:debian' ),
|
||||
( 'debian-armhf.docker', 'diginc/pi-hole-armhf:debian' ),
|
||||
@pytest.mark.parametrize("upstream,image,tag", [
|
||||
( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||
( 'debian:jessie', 'debian.docker', 'diginc/pi-hole:debian' ),
|
||||
( 'jsurf/rpi-raspbian', 'debian-armhf.docker', 'diginc/pi-hole-armhf:debian' ),
|
||||
])
|
||||
def test_build_pihole_image(image, tag):
|
||||
def test_build_pihole_image(upstream, image, tag):
|
||||
run_local('docker pull {}'.format(upstream))
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
|
|
|
@ -16,5 +16,8 @@ cp -f pi-hole/advanced/pihole.cron ${cron};
|
|||
sed -i '/Update the ad sources/ i\# Your container name goes here:\nDOCKER_NAME=pihole\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n' ${cron};
|
||||
sed -i 's|/usr/local/bin/|docker exec $DOCKER_NAME |g' ${cron};
|
||||
sed -i '/docker exec/ s|$| > /dev/null|g' ${cron};
|
||||
|
||||
# docker-pi-hole users update their docker images, not git code
|
||||
sed -i '/Update Pi-hole/ a\# pihole software update commands are unsupported in docker!' ${cron};
|
||||
sed -i '/Update Pi-hole/ c\# Update docker-pi-hole by pulling the latest docker image ane re-creating your container.' ${cron};
|
||||
sed -i '/pihole updateDashboard/ s/^/#/' ${cron};
|
||||
|
|
Loading…
Reference in New Issue