diff --git a/bash_functions.sh b/bash_functions.sh index 38e59e4..f6e3f1e 100644 --- a/bash_functions.sh +++ b/bash_functions.sh @@ -63,10 +63,10 @@ setup_dnsmasq_dns() { fi echo "Using $dnsType DNS servers: $DNS1 & $DNS2" - if [[ -n "$DNS1" && -z "$setupDNS1" ]] ; then + if [[ -n "$DNS1" && -z "$setupDNS1" ]] ; then change_setting "PIHOLE_DNS_1" "${DNS1}" fi - if [[ -n "$DNS2" && -z "$setupDNS2" ]] ; then + if [[ -n "$DNS2" && -z "$setupDNS2" ]] ; then change_setting "PIHOLE_DNS_2" "${DNS2}" fi } @@ -78,7 +78,7 @@ setup_dnsmasq_interface() { interfaceType='custom' fi; echo "DNSMasq binding to $interfaceType interface: $INTERFACE" - [ -n "$INTERFACE" ] && change_setting "PIHOLE_INTERFACE" "${INTERFACE}" + [ -n "$INTERFACE" ] && change_setting "PIHOLE_INTERFACE" "${INTERFACE}" } setup_dnsmasq_config_if_missing() { @@ -174,11 +174,11 @@ setup_php_env_debian() { setup_php_env_alpine() { # Intentionally tabs, required by HEREDOC de-indentation (<<-) cat <<-EOF > "$PHP_ENV_CONFIG" - [www] - env[PATH] = ${PATH} - env[PHP_ERROR_LOG] = ${PHP_ERROR_LOG} - env[ServerIP] = ${ServerIP} - EOF + [www] + env[PATH] = ${PATH} + env[PHP_ERROR_LOG] = ${PHP_ERROR_LOG} + env[ServerIP] = ${ServerIP} + EOF if [ -z "$VIRTUAL_HOST" ] ; then VIRTUAL_HOST="$ServerIP" @@ -224,10 +224,10 @@ setup_web_password() { fi; set -x if [[ "$WEBPASSWORD" == "" ]] ; then - echo "" | pihole -a -p + echo "" | pihole -a -p else - pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD" - fi + pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD" + fi { set +x; } 2>/dev/null } @@ -274,10 +274,12 @@ test_configs_alpine() { test_framework_stubbing() { if [ -n "$PYTEST" ] ; then - echo ":::::: Tests are being ran - stub out ad list fetching and add a fake ad block" - sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)" - echo 'testblock.pi-hole.local' >> /etc/pihole/black.list - fi + echo ":::::: Tests are being ran - stub out ad list fetching and add a fake ad block" + sed -i 's/^gravity_spinup$/#gravity_spinup # DISABLED FOR PYTEST/g' "$(which gravity.sh)" + echo '123.123.123.123 testblock.pi-hole.local' > /var/www/html/fake.list + echo 'file:///var/www/html/fake.list' > /etc/pihole/adlists.txt + echo 'http://localhost/fake.list' >> /etc/pihole/adlists.txt + fi } docker_main() { diff --git a/install.sh b/install.sh index 7f8cac0..205db88 100755 --- a/install.sh +++ b/install.sh @@ -65,7 +65,11 @@ if [[ $USE_DEVELOPMENT_BRANCHES == true ]] ; then pushd "${PI_HOLE_LOCAL_REPO}"; git checkout development; popd; pushd "${webInterfaceDir}"; git checkout devel; popd; else - pushd "${PI_HOLE_LOCAL_REPO}"; git reset --hard "${CORE_TAG}"; popd; + 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 diff --git a/test/test_start.py b/test/test_start.py index e54d875..19c3bac 100644 --- a/test/test_start.py +++ b/test/test_start.py @@ -65,7 +65,7 @@ def test_javascript_requests_load_as_expected(RunningPiHole, addr, url): http_rc = RunningPiHole.run(command) assert http_rc.rc == 0 assert int(http_rc.stdout) == 200 - assert RunningPiHole.run('md5sum /tmp/curled_file /var/www/html/pihole/index.js').rc == 0 + assert 'var x = "Pi-hole: A black hole for Internet advertisements."' in RunningPiHole.run('cat /tmp/curled_file').stdout # IPv6 checks aren't passing CORS, removed :( @pytest.mark.parametrize('addr', [ 'localhost' ] )