From 8e075529543b8980b9e8c5a029b1f6d4903dbd17 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 17 Feb 2022 09:44:29 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20modified:=20bin/entrypo?= =?UTF-8?q?int-squid.sh=20=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/entrypoint-squid.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/entrypoint-squid.sh b/bin/entrypoint-squid.sh index 87a9a32..325aea4 100755 --- a/bin/entrypoint-squid.sh +++ b/bin/entrypoint-squid.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +PROXY_HOSTNAME=${PROXY_HOSTNAME:-proxy.casjay.net} export SQUID_PORT="${SQUID_PORT:-3127}" export E2GUARD_PORT="${E2GUARD_PORT:-3128}" export APACHE2_PORT="${APACHE2_PORT:-8080}" @@ -56,6 +57,18 @@ __init() { sed -i "s|SQUID_PORT|$SQUID_PORT|g" "/config/squid/squid.conf" fi + if [ -f "/data/htdocs/cgi-bin/e2guardian" ]; then + sed -i "s|PROXY_HOSTNAME|$PROXY_HOSTNAME|g" "/data/htdocs/cgi-bin/e2guardian" + fi + + if [ -f "/data/htdocs/cgi-bin/squidguard" ]; then + sed -i "s|PROXY_HOSTNAME|$PROXY_HOSTNAME|g" "/data/htdocs/cgi-bin/squidguard" + fi + + if [ ! -f "/data/htdocs/cgi-bin/cachemgr.cgi" ]; then + cp -Rf "/usr/lib/cgi-bin/cachemgr.cgi" "/data/htdocs/cgi-bin/cachemgr.cgi" + fi + cp -Rf "/config/." "/etc/" if [ "$(find /data/squidguard/db/* 2>/dev/null | wc -l)" -eq 0 ]; then @@ -69,14 +82,6 @@ __init() { chown -Rf ${SQUID_USER}:${SQUID_USER} "/data/squidguard/db" fi - if [ ! -f "/data/htdocs/cgi-bin/cachemgr.cgi" ]; then - cp -Rf "/usr/lib/cgi-bin/cachemgr.cgi" "/data/htdocs/cgi-bin/cachemgr.cgi" - fi - - if [ ! -f "/data/htdocs/cgi-bin/e2guardian.pl" ]; then - cp -Rf "/usr/lib/cgi-bin/e2guardian.pl" "/data/htdocs/cgi-bin/e2guardian.pl" - fi - # allow arguments to be passed to squid if [[ ${1:0:1} = '-' ]]; then EXTRA_ARGS=("$@")