diff --git a/bash_functions.sh b/bash_functions.sh index a645d2d..d3e9e47 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -184,10 +184,12 @@ setup_web_port() { fi echo "Custom WEB_PORT set to $web_port" echo "INFO: Without proper router DNAT forwarding to $ServerIP:$web_port, you may not get any blocked websites on ads" - case $TAG in - "debian") - sed -i '/server.port\s*=\s*80\s*$/ s/80/'$WEB_PORT'/g' /etc/lighttpd/lighttpd.conf ;; - esac + + # Update lighttpd's port + sed -i '/server.port\s*=\s*80\s*$/ s/80/'$WEB_PORT'/g' /etc/lighttpd/lighttpd.conf + # Update any default port 80 references in the HTML + grep -Prl '://127\.0\.0\.1/' /var/www/html/ | xargs -r sed -i "s|/127\.0\.0\.1/|/127.0.0.1:${WEB_PORT}/|g" + grep -Prl '://pi\.hole/' /var/www/html/ | xargs -r sed -i "s|/pi\.hole/|/pi\.hole:${WEB_PORT}/|g" } diff --git a/deploy_arm.sh b/deploy_arm.sh new file mode 100755 index 0000000..17f4b9d --- /dev/null +++ b/deploy_arm.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Script for manually pushing the docker arm images for diginc only +# (no one else has docker repo permissions) +if [ ! -f ~/.docker/config.json ] ; then + echo "Error: You should setup your docker push authorization first" + exit 1 +fi + +if [[ "$1" == 'prod' ]] ; then + export version='3.2.1' + for tag in debian_armhf debian_aarch64; do + # Verison specific tags for ongoing history + docker tag pi-hole-multiarch:$tag diginc/pi-hole-multiarch:v${version}_${tag} + docker push diginc/pi-hole-multiarch:v${version}_${tag} + # Floating latest tags + docker tag pi-hole-multiarch:$tag diginc/pi-hole-multiarch:${tag} + docker push diginc/pi-hole-multiarch:${tag} + done +elif [[ "$1" == 'dev' ]] ; then + for tag in debian_armhf debian_aarch64; do + # Floating dev tag + docker tag pi-hole-multiarch:$tag diginc/pi-hole-multiarch:${tag}_dev + docker push diginc/pi-hole-multiarch:${tag}_dev + done +fi diff --git a/test/test_bash_functions.py b/test/test_bash_functions.py index bc68adc..a9fa2b7 100644 --- a/test/test_bash_functions.py +++ b/test/test_bash_functions.py @@ -31,6 +31,13 @@ def test_overrides_default_WEB_PORT(Docker, os, args): config = Docker.run('cat {}'.format( WEB_CONFIG[os])).stdout for expected_line in CONFIG_LINES[os]: assert re.search(expected_line, config) != None + # grep fails to find any of the old address w/o port + assert Docker.run('grep -rq "://127.0.0.1/" /var/www/html/').rc == 1 + assert Docker.run('grep -rq "://pi.hole/" /var/www/html/').rc == 1 + # Find at least one instance of our changes + # upstream repos determines how many and I don't want to keep updating this test + assert int(Docker.run('grep -rl "://127.0.0.1:999/" /var/www/html/ | wc -l').stdout) >= 1 + assert int(Docker.run('grep -rl "://pi.hole:999/" /var/www/html/ | wc -l').stdout) >= 1 @pytest.mark.parametrize('args,expected_error', [ (DEFAULTARGS + '-e WEB_PORT="LXXX"', 'WARNING: Custom WEB_PORT not used - LXXX is not an integer'),