Manje ciscenje debian/postinst. wheezy v2.2.22+1
authorDragan Dosen <Dragan.Dosen@CARNet.hr>
Thu, 15 Aug 2013 18:53:48 +0000 (20:53 +0200)
committerDragan Dosen <Dragan.Dosen@CARNet.hr>
Thu, 15 Aug 2013 18:53:48 +0000 (20:53 +0200)
debian/postinst

index fffc063..1d09c19 100755 (executable)
@@ -45,7 +45,6 @@ BACKUPDIR="/var/backups/apache2-cn"
 
 backup_done=0
 need_restart=0
-apache2_sslcert=0
 apache2_sslcf=
 apache2_sslckf=
 apache2_sslccf=
@@ -131,6 +130,7 @@ listen_ssl() {
         cp_echo "CN: Enabling SSL port (443) for Apache2 web server."
 
         out=$(mktemp ${PORTCONF}.XXXXXX)
+        temp_files="${temp_files} ${out}"
 
         if [ -f "$PORTCONF" ]; then
             cp $PORTCONF $out
@@ -141,7 +141,6 @@ listen_ssl() {
         chmod 644 $PORTCONF
 
         need_restart=1
-        temp_files="${temp_files} ${out}"
     fi
 }
 
@@ -379,8 +378,6 @@ fi
 
 # Apache2 SSL certificate.
 #
-has_listen_ssl=0
-
 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls $CONFDIR/conf.d)" ]; then
     listen_ssl_mask=$CONFDIR/conf.d/*
 fi
@@ -392,13 +389,12 @@ for file in $CONF $listen_ssl_mask; do
     if [ -f "$file" ]; then
         if egrep -iq '^[[:space:]]*<VirtualHost .*443[[:space:]]*>' $file; then
             has_listen_ssl=1
-            apache2_sslcert=1
             break
         fi
     fi
 done
 
-if [ $apache2_sslcert -eq 0 ]; then
+if [ $has_listen_ssl -eq 0 ]; then
 
     db_get apache2-cn/sslcf || true
     apache2_sslcf="$RET"
@@ -477,7 +473,7 @@ fi
 
 # Add VirtualHost for SSL?
 #
-if [ $apache2_sslcert -eq 0 ]; then
+if [ $has_listen_ssl -eq 0 ]; then
 
     if [ -f "$CONFDIR/sites-available/ssl" ]; then
         cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/ssl
@@ -500,7 +496,7 @@ fi
 
 # Check SSL certificates location for VirtualHosts.
 #
-if [ $apache2_sslcert -eq 0 ]; then
+if [ $has_listen_ssl -eq 0 ]; then
 
     chk_conf_tag "${CONFDIR}/sites-available/ssl"
     if [ $RET -eq 0 ] && [ -n "$apache2_sslcf" ]; then
@@ -521,8 +517,8 @@ if [ $apache2_sslcert -eq 0 ]; then
 
         # SSLCertificateChainFile
         if [ -n "$apache2_sslccf" ]; then
-            cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/cert-chain\.pem" \
-                "s#\# SSLCertificateChainFile /etc/ssl/certs/cert-chain.pem#SSLCertificateChainFile $apache2_sslccf #g" \
+            cp_check_and_sed "^[[:space:]]*# SSLCertificateChainFile \/etc\/ssl\/certs\/(sureserverEDU|cert-chain)\.pem" \
+                "s#\# SSLCertificateChainFile /etc/ssl/certs/\(sureserverEDU\|cert-chain\).pem#SSLCertificateChainFile $apache2_sslccf #g" \
             $SSLTMP || true
         fi