@@ -36,21 +36,6 @@ function fixperms {
3636 chown -R www-data:www-data " $1 /"
3737}
3838
39- # Handle http proxy if set - comprehensive proxy support matching provision.sh
40- function setup_proxy_environment {
41- # Set both HTTP and HTTPS proxy environment variables
42- export HTTP_PROXY=" http://$PROXY_HOST :$PROXY_PORT "
43- export HTTPS_PROXY=" http://$PROXY_HOST :$PROXY_PORT "
44- echo " ===> Proxy configured: $PROXY_HOST :$PROXY_PORT "
45-
46- # check for auth
47- if [ ! -z " $PROXY_USER " -a ! -z " $PROXY_PASS " ] ; then
48- export HTTP_PROXY=" http://$PROXY_USER :$PROXY_PASS @$PROXY_HOST :$PROXY_PORT "
49- export HTTPS_PROXY=" http://$PROXY_USER :$PROXY_PASS @$PROXY_HOST :$PROXY_PORT "
50- echo " ===> Proxy authentication enabled for user: $PROXY_USER "
51- fi
52- }
53-
5439# install php dependencies:
5540apt-get install ${APT_OPTS} $SNAPPY_PKGS
5641
7358if [ -f " ./$SNAPPY_FILE " -a " $DOMAIN " == " mailad.cu" ]; then
7459 cp " ./$SNAPPY_FILE " " /tmp/$SNAPPY_FILE "
7560else
76- # Add proxy options to wget for package download if proxy is configured
77- WGET_OPTS=" --no-clobber"
78- if [ " $PROXY_HOST " -a " $PROXY_PORT " ] ; then
79- echo " ===> Using proxy for SnappyMail package download: $PROXY_HOST :$PROXY_PORT " | tee -a $FILE
80- WGET_OPTS=" ${WGET_OPTS} --proxy=on --http-proxy=\" $HTTP_PROXY \" --https-proxy=\" $HTTPS_PROXY \" "
61+ # Setup proxy if needed
62+ if [ " $PROXY_HOST " -a " $PROXY_PORT " ] ; then
63+ # Set both HTTP and HTTPS proxy environment variables
64+ export HTTP_PROXY=" http://$PROXY_HOST :$PROXY_PORT "
65+ export HTTPS_PROXY=" http://$PROXY_HOST :$PROXY_PORT "
66+ echo " ===> Proxy configured: $HTTP_PROXY "
67+
68+ # check for auth tyo add auth
69+ if [ " $PROXY_USER " -a " $PROXY_PASS " ] ; then
70+ export HTTP_PROXY=" http://$PROXY_USER :$PROXY_PASS @$PROXY_HOST :$PROXY_PORT "
71+ export HTTPS_PROXY=" http://$PROXY_USER :$PROXY_PASS @$PROXY_HOST :$PROXY_PORT "
72+ echo " ===> Proxy authentication enabled for user: $PROXY_USER "
73+ fi
8174 fi
82-
75+
8376 echo " ===> Downloading SnappyMail package from: $SNAPPY_URL " | tee -a $FILE
84- wget -q ${WGET_OPTS} " $SNAPPY_URL " -O " /tmp/$SNAPPY_FILE "
77+ wget -q -c " $SNAPPY_URL " -O " /tmp/$SNAPPY_FILE "
8578 R=$?
79+
80+ # Unset proxy variables to avoid get them used locally
81+ unset HTTP_PROXY
82+ unset HTTPS_PROXY
8683fi
8784
8885# check if download fails
@@ -93,9 +90,9 @@ if [ $R -ne 0 -a $R -ne 1 ]; then
9390 echo " Return code: $R " | tee -a $FILE
9491
9592 # Provide specific proxy-related error messages
96- if [ ! -z " $PROXY_HOST " -a ! -z " $PROXY_PORT " ] ; then
93+ if [ " $PROXY_HOST " -a " $PROXY_PORT " ] ; then
9794 echo " Proxy configured: $PROXY_HOST :$PROXY_PORT " | tee -a $FILE
98- if [ ! -z " $PROXY_USER " -a ! -z " $PROXY_PASS " ] ; then
95+ if [ " $PROXY_USER " -a " $PROXY_PASS " ] ; then
9996 echo " Proxy authentication: enabled for user $PROXY_USER " | tee -a $FILE
10097 fi
10198 echo " This could be a proxy authentication or connectivity issue." | tee -a $FILE
0 commit comments