From ee2949aba82346ee5f0fdbe7c19f563b067f48f6 Mon Sep 17 00:00:00 2001 From: diginc Date: Wed, 5 Oct 2016 21:55:08 -0500 Subject: [PATCH] entrypoint start script modifications for issues - piholeIPv6 in setupVars.txt fixes #50 - firstboot multipel runs fixes #51 - really only necessary for debian, but I like symmetry in the start files --- alpine/start.sh | 22 +++++++++++++++------- debian-armhf/start.sh | 20 ++++++++++++++------ debian/start.sh | 18 +++++++++++++----- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/alpine/start.sh b/alpine/start.sh index afb3bc9..c304981 100755 --- a/alpine/start.sh +++ b/alpine/start.sh @@ -6,15 +6,23 @@ fi; # /tmp/piholeIP is the current override of auto-lookup in gravity.sh echo "$ServerIP" > /etc/pihole/piholeIP; -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; +echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf; +echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf; -if [ -n "$VIRTUAL_HOST" ] ; then - echo "env[VIRTUAL_HOST] = ${VIRTUAL_HOST}" >> $PHP_ENV_CONFIG; +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 "env[VIRTUAL_HOST] = ${ServerIP}" >> $PHP_ENV_CONFIG; + echo "Skipped first boot configuration, looks like you're restarting this container" fi; echo "Added ENV to php:" diff --git a/debian-armhf/start.sh b/debian-armhf/start.sh index 9e1d517..a22b796 100755 --- a/debian-armhf/start.sh +++ b/debian-armhf/start.sh @@ -6,13 +6,21 @@ fi; # /tmp/piholeIP is the current override of auto-lookup in gravity.sh echo "$ServerIP" > /etc/pihole/piholeIP; -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 +echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf; +echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf; -if [ -n "$VIRTUAL_HOST" ] ; then - sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG -else - sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${ServerIP}\"," $PHP_ENV_CONFIG +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:" diff --git a/debian/start.sh b/debian/start.sh index 02797cb..01cb374 100755 --- a/debian/start.sh +++ b/debian/start.sh @@ -6,13 +6,21 @@ fi; # /tmp/piholeIP is the current override of auto-lookup in gravity.sh echo "$ServerIP" > /etc/pihole/piholeIP; -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 +echo "ipv4addr=$ServerIP" > /etc/pihole/setupVars.conf; +echo "piholeIPv6=$ServerIPv6" >> /etc/pihole/setupVars.conf; -if [ -n "$VIRTUAL_HOST" ] ; then - sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${VIRTUAL_HOST}\"," $PHP_ENV_CONFIG +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 - sed -i "/bin-environment/ a\\\t\t\t\"VIRTUAL_HOST\" => \"${ServerIP}\"," $PHP_ENV_CONFIG + echo "Skipped first boot configuration, looks like you're restarting this container" fi; echo "Added ENV to php:"