File debian.php5-mapi.postinst of Package zarafa

#! /bin/sh

set -e

SBIN=/usr/sbin
PEM=$SBIN/php5enmod
BASE=/etc/php5

ORG1=$BASE/apache2/conf.d/zarafa.ini
ORG2=$BASE/conf.d/zarafa.ini

OKLOC=$BASE/mods-available/

# not a symbolic file? then move it to the mods-directory
if [ -f $ORG1 ] ; then
	echo Moving $ORG1 to $OKLOC
	mv -f $ORG1 $OKLOC
else
	if [ -f $ORG2 ] ; then
		echo Moving $ORG2 to $OKLOC
		mv -f $ORG2 $OKLOC
	fi
fi

# remove any symbolinc links
for i in `find $BASE -type l -name \*zarafa.ini` ; do
	echo Removing symbolic link $i
	rm -f "$i"
done

echo Enable module
if [ -e $PEM ]
then
	echo php5-mapi: using new mods-available directory

	# this one does not work with the php5enmod in debian 7
	# $SBIN/php5enmod -s ALL zarafa
	$SBIN/php5enmod zarafa
else
	echo php5-mapi: using old style symbolic links

	ln -s $OKLOC $BASE/apache2/
	ln -s $OKLOC $BASE/cli/
fi

if /usr/sbin/service apache2 status >/dev/null 2>/dev/null; then
	/usr/sbin/service apache2 restart
fi
/bin/echo -e "\n\nIf you use a PHP executor other than Apache (like FPM), you may need to manually restart it.\n\n"
echo php5-mapi post install script finished

exit 0
openSUSE Build Service is sponsored by