debian/littlebird-tc-core.postinst
changeset 118 aa280f39150b
parent 116 865ca85cbf5b
--- a/debian/littlebird-tc-core.postinst	Fri Oct 14 14:44:08 2011 +0200
+++ b/debian/littlebird-tc-core.postinst	Sun Feb 19 23:34:32 2012 +0100
@@ -24,23 +24,31 @@
 case "$1" in
     configure)
 
-    dirs="/var/log/littlebird-tc /var/lib/littlebird-tc/CA /var/lib/littlebird-tc/data"
-    chgrp -R www-data $dirs
-    chmod -R g+w $dirs
+    # some of these dirs may not be installed (notably /var/logs seems
+    # not to be installed anymore (told me by Stefan Kögel - 2012-02-15)
+    for dir in /var/log/littlebird-tc /var/lib/littlebird-tc/CA /var/lib/littlebird-tc/data
+    do
+	test -d "$dir" && chgrp -R www-data $dir
+	test -d "$dir" && chmod -R g+w $dir
+    done
 
     # Timezone in /usr/local/zend/etc/php.ini
     # note: this file is handled as a conffile under ucf control
     f=/usr/local/zend/etc/php.ini
-    perl -pi -e 's{^;?\s*(date\.timezone\s*=).*$}{$1 "Europe/Berlin"}' $f
+    test -f $f \
+    && perl -pi -e 's{^;?\s*(date\.timezone\s*=).*$}{$1 "Europe/Berlin"}' $f
 
     # not sure if this conforms to policy: changing another packages
-    # config files
+    # config files: if a /usr/local/zend/etc/conf.php.ini exists, we'll
+    # link the "official" php.ini to this local php.ini
+    # 2012-02-15: I think, it is not necessary anymore, since the
+    # zend-server is not used anymore.
     if test -d /etc/php5/cli; then
 	#echo "# linking php.ini to zend" >&2
 	( set -e
 	  cd /etc/php5/cli
 	  s=/usr/local/zend/etc/conf.php.ini
-	  if test `readlink -f php.ini` != `readlink -f $s`
+	  if test -f $s && test `readlink -f php.ini` != `readlink -f $s`
 	  then
 	      rm -vf php.ini
 	      ln -vs $s php.ini
@@ -55,7 +63,7 @@
 	  for p in mysqli.ini curl.ini mcrypt.ini gd.ini
 	  do
 	    s=/usr/local/zend/etc/conf.d/$p
-	    if test `readlink -f $p` != `readlink -f $s`
+	    if test -f $s && test `readlink -f $p` != `readlink -f $s`
 	    then
 		rm -vf $p
 		ln -vs $s .
@@ -193,13 +201,16 @@
 
     db_stop || true
 	( . /etc/apache2/envvars
-	  invoke=`which invoke-rc.d`
-	  if ! apache2 -M 2>/dev/null | grep -q ssl_module; then
-		  a2enmod ssl
-		  test "$invoke" && $invoke apache2 restart >&2
-	  else
-		  test "$invoke" && $invoke apache2 reload >&2
-	  fi
+	  invoke=
+	  for module in ssl rewrite; do
+	      if ! apache2 -M 2>/dev/null | grep -q ${module}_module; then
+		      a2enmod $module
+		      invoke=`which invoke-rc.d`
+	      fi
+	   done
+	   # for ssl reload doesn't suffice, using restart we're on the
+	   # safe side
+	   test "$invoke" && $invoke apache2 restart >&2 || true
 	)
 
     ;;