[Pkg-php-commits] r874 - php5/branches/rg-extension-manager/debian

Raphael Geissert atomo64-guest at alioth.debian.org
Mon Sep 17 01:32:18 UTC 2007


Author: atomo64-guest
Date: 2007-09-17 01:32:18 +0000 (Mon, 17 Sep 2007)
New Revision: 874

Added:
   php5/branches/rg-extension-manager/debian/php5-module.postrm
   php5/branches/rg-extension-manager/debian/php5disext
   php5/branches/rg-extension-manager/debian/php5enext
Removed:
   php5/branches/rg-extension-manager/debian/php5-sapi.links
Modified:
   php5/branches/rg-extension-manager/debian/libapache2-mod-php5.dirs
   php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst
   php5/branches/rg-extension-manager/debian/php5-cgi.dirs
   php5/branches/rg-extension-manager/debian/php5-cgi.postinst
   php5/branches/rg-extension-manager/debian/php5-cli.dirs
   php5/branches/rg-extension-manager/debian/php5-cli.postinst
   php5/branches/rg-extension-manager/debian/rules
Log:
Applying the patch for the new extensions manager

Modified: php5/branches/rg-extension-manager/debian/libapache2-mod-php5.dirs
===================================================================
--- php5/branches/rg-extension-manager/debian/libapache2-mod-php5.dirs	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/libapache2-mod-php5.dirs	2007-09-17 01:32:18 UTC (rev 874)
@@ -1,3 +1,3 @@
 /etc/apache2/mods-available
-/etc/php5/apache2
+/etc/php5/apache2/conf.d
 /usr/lib/apache2/modules

Modified: php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/libapache2-mod-php5.postinst	2007-09-17 01:32:18 UTC (rev 874)
@@ -31,6 +31,19 @@
 
 ucf /usr/share/php5/php.ini-dist $phpini
 
+# upgrade to new extensions management
+SAPI="apache2"
+if [ -L "/etc/php5/${SAPI}/conf.d" ]; then
+	unlink "/etc/php5/${SAPI}/conf.d"
+	mkdir "/etc/php5/${SAPI}/conf.d/"
+	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
+	for i in /etc/php5/conf.d/*; do
+		ln -s "$i" "/etc/php5/${SAPI}/conf.d/"
+	done
+fi
+
+# END of upgrade code
+
 reload_apache()
 {
 	if apache2ctl configtest 2>/dev/null; then

Modified: php5/branches/rg-extension-manager/debian/php5-cgi.dirs
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cgi.dirs	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/php5-cgi.dirs	2007-09-17 01:32:18 UTC (rev 874)
@@ -1,4 +1,4 @@
-/etc/php5/cgi
+/etc/php5/cgi/conf.d
 /usr/lib/cgi-bin
 /usr/bin
 /usr/share/man/man1

Modified: php5/branches/rg-extension-manager/debian/php5-cgi.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cgi.postinst	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/php5-cgi.postinst	2007-09-17 01:32:18 UTC (rev 874)
@@ -30,6 +30,19 @@
 
 ucf /usr/share/php5/php.ini-dist $phpini
 
+# upgrade to new extensions management
+SAPI="cgi"
+if [ -L "/etc/php5/${SAPI}/conf.d" ]; then
+	unlink "/etc/php5/${SAPI}/conf.d"
+	mkdir "/etc/php5/${SAPI}/conf.d/"
+	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
+	for i in /etc/php5/conf.d/*; do
+		ln -s "$i" "/etc/php5/${SAPI}/conf.d/"
+	done
+fi
+
+# END of upgrade code
+
 update-alternatives \
         --install /usr/bin/php-cgi php-cgi /usr/bin/php5-cgi 50 \
         --slave /usr/share/man/man1/php-cgi.1.gz php-cgi.1.gz /usr/share/man/man1/php5-cgi.1.gz

Modified: php5/branches/rg-extension-manager/debian/php5-cli.dirs
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cli.dirs	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/php5-cli.dirs	2007-09-17 01:32:18 UTC (rev 874)
@@ -1,3 +1,3 @@
-/etc/php5/cli
+/etc/php5/cli/conf.d
 /usr/bin
 /usr/share/man/man1

Modified: php5/branches/rg-extension-manager/debian/php5-cli.postinst
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-cli.postinst	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/php5-cli.postinst	2007-09-17 01:32:18 UTC (rev 874)
@@ -30,6 +30,19 @@
 
 ucf /usr/share/php5/php.ini-dist.cli $phpini
 
+# upgrade to new extensions management
+SAPI="cli"
+if [ -L "/etc/php5/${SAPI}/conf.d" ]; then
+	unlink "/etc/php5/${SAPI}/conf.d"
+	mkdir "/etc/php5/${SAPI}/conf.d/"
+	chmod a+xr,u+w "/etc/php5/${SAPI}/conf.d/"
+	for i in /etc/php5/conf.d/*; do
+		ln -s "$i" "/etc/php5/${SAPI}/conf.d/"
+	done
+fi
+
+# END of upgrade code
+
 update-alternatives \
 	--install /usr/bin/php php /usr/bin/php5 50 \
 	--slave /usr/share/man/man1/php.1.gz php.1.gz /usr/share/man/man1/php5.1.gz

Added: php5/branches/rg-extension-manager/debian/php5-module.postrm
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-module.postrm	                        (rev 0)
+++ php5/branches/rg-extension-manager/debian/php5-module.postrm	2007-09-17 01:32:18 UTC (rev 874)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" != "remove" ]; then
+	exit 0
+fi
+
+# Disable extension on all SAPIs if @dsoname@ is being removed
+if [ -x /usr/sbin/php5disext ]; then
+	/usr/sbin/php5disext all "@dsoname@" quiet nonfatal
+fi
+
+
+#DEBHELPER#
+
+exit 0
+

Deleted: php5/branches/rg-extension-manager/debian/php5-sapi.links
===================================================================
--- php5/branches/rg-extension-manager/debian/php5-sapi.links	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/php5-sapi.links	2007-09-17 01:32:18 UTC (rev 874)
@@ -1 +0,0 @@
-etc/php5/conf.d etc/php5/@sapi@/conf.d

Added: php5/branches/rg-extension-manager/debian/php5disext
===================================================================
--- php5/branches/rg-extension-manager/debian/php5disext	                        (rev 0)
+++ php5/branches/rg-extension-manager/debian/php5disext	2007-09-17 01:32:18 UTC (rev 874)
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# Simple script to disable php extensions in the per-SAPI conf.d directory
+# Copyright: 2007 Raphael Geissert
+# Licence: GNU GPLv2
+
+PHPDIR="/etc/php5"
+QUIET=0
+FATAL=1
+
+if [ -z $1 ] || [ -z $2 ]; then
+	echo "Usage: php5disext SAPIS EXTENSION [quiet] [fatal]"
+	echo -e "\t SAPIS: list of SAPIs or 'all'"
+	echo -e "\t quiet: set any value"
+	echo -e "\t fatal: exit with non-zero status if the extension is already disabled (default)"
+	echo "NOTE: The posible values for quiet and fatal are:"
+	echo -e "\tPositive: true|1|quiet|yes|fatal"
+	echo -e "\tNegative: false|0|verbose|shout|no|nonfatal"
+	echo "NOTE: quiet, fatal, verbose and nonfatal do not aplly to both"
+	exit 1
+fi
+
+if [ ! -z $3 ]; then
+	case $3 in
+		true|1|quiet|yes)
+			QUIET=1
+		;;
+		false|0|verbose|shout|no)
+			QUIET=0
+		;;
+	esac
+fi
+
+if [ ! -z $4 ]; then
+	case $4 in
+		true|1|fatal|yes)
+			FATAL=1
+		;;
+		false|0|nonfatal|no)
+			FATAL=0
+		;;
+	esac
+fi
+
+EXT="${2}"
+EXT_SO="${2}.so"
+SAPIS="${1}"
+
+if [ $SAPIS = "all" ]; then
+	SAPIS="apache apache2 cli cgi"
+fi
+
+for SAPI in $SAPIS; do
+	if [ ! -L "${PHPDIR}/${SAPI}/conf.d/${EXT_SO}" ]; then
+		if [ ! $QUIET -eq 1 ];then
+			echo "The extension ${EXT} is not enabled for ${SAPI}"
+		fi
+		
+		if [ $FATAL -eq 1 ]; then
+			exit 2
+		fi
+	else
+		unlink "${PHPDIR}/${SAPI}/conf.d/${EXT_SO}"
+		if [ ! $QUIET -eq 1 ];then
+			echo "The extension ${EXT} has been disabled for ${SAPI}"
+			echo "In case ${SAPI} is a web server you might need to reload it"
+		fi
+	fi
+fi
+
+exit 0

Added: php5/branches/rg-extension-manager/debian/php5enext
===================================================================
--- php5/branches/rg-extension-manager/debian/php5enext	                        (rev 0)
+++ php5/branches/rg-extension-manager/debian/php5enext	2007-09-17 01:32:18 UTC (rev 874)
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# Simple script to enable php extensions in the per-SAPI conf.d directory
+# Copyright: 2007 Raphael Geissert
+# Licence: GNU GPLv2
+
+PHPDIR="/etc/php5"
+QUIET=0
+FATAL=1
+
+if [ -z $1 ] || [ -z $2 ]; then
+	echo "Usage: php5enext SAPIS EXTENSION [quiet] [fatal]"
+	echo -e "\t SAPIS: list of SAPIs or 'all'"
+	echo -e "\t quiet: set any value"
+	echo -e "\t fatal: exit with non-zero status if the extension is already enabled (default)"
+	echo "NOTE: The posible values for quiet and fatal are:"
+	echo -e "\tPositive: true|1|quiet|yes|fatal"
+	echo -e "\tNegative: false|0|verbose|shout|no|nonfatal"
+	echo "NOTE: quiet, fatal, verbose and nonfatal do not aplly to both"
+	exit 1
+fi
+
+if [ ! -z $3 ]; then
+	case $3 in
+		true|1|quiet|yes)
+			QUIET=1
+		;;
+		false|0|verbose|shout|no)
+			QUIET=0
+		;;
+	esac
+fi
+
+if [ ! -z $4 ]; then
+	case $4 in
+		true|1|fatal|yes)
+			FATAL=1
+		;;
+		false|0|nonfatal|no)
+			FATAL=0
+		;;
+	esac
+fi
+
+EXT="${2}"
+EXT_SO="${2}.so"
+SAPIS="${1}"
+
+if [ $SAPIS = "all" ]; then
+	SAPIS="apache apache2 cli cgi"
+fi
+
+for SAPI in $SAPIS; do
+	if [ -L "${PHPDIR}/${SAPI}/conf.d/${EXT_SO}" ]; then
+		if [ ! $QUIET -eq 1 ];then
+			echo "The extension ${EXT} is already enabled for ${SAPI}"
+		fi
+		
+		if [ $FATAL -eq 1 ]; then
+			exit 2
+		fi
+	else
+		ln -s "${PHPDIR}/conf.d/${EXT_SO}" "${PHPDIR}/${SAPI}/conf.d/"
+		if [ ! $QUIET -eq 1 ];then
+			echo "The extension ${EXT} has been enabled for ${SAPI}"
+			echo "In case ${SAPI} is a web server you might need to reload it"
+		fi
+	fi
+fi
+
+exit 0

Modified: php5/branches/rg-extension-manager/debian/rules
===================================================================
--- php5/branches/rg-extension-manager/debian/rules	2007-09-16 23:55:59 UTC (rev 873)
+++ php5/branches/rg-extension-manager/debian/rules	2007-09-17 01:32:18 UTC (rev 874)
@@ -297,9 +297,10 @@
 	# clean up autogenerated cruft
 	cat debian/modulelist | while read package extname dsoname; do \
 		rm -f debian/php5-$$package.postinst; \
+		rm -f debian/php5-$$package.postrm; \
 	done
 	for sapi in libapache2-mod-php5 php5-cgi php5-cli; do \
-		for cruft in postrm links; do \
+		for cruft in postrm; do \
 			rm -f debian/$${sapi}.$${cruft}; \
 		done; \
 	done
@@ -310,6 +311,13 @@
 	dh_testroot
 	dh_clean -k
 	dh_installdirs
+	
+	# Install php5enext and php5disext
+	mkdir -p debian/php5-common/usr/sbin
+	cp debian/php5enext \
+		debian/php5-common/usr/sbin/
+	cp debian/php5disext \
+		debian/php5-common/usr/sbin/
 
 	chmod 01733 debian/php5-common/var/lib/php5
 
@@ -439,6 +447,9 @@
 		  < debian/php5-module.postinst \
 		| sed -e'/#EXTRA#/ d' \
 		  > debian/php5-$${package}.postinst; \
+		sed -e"s/@extname@/$$extname/g; s/@dsoname@/$$dsoname/g" \
+		  < debian/php5-module.postrm \
+		  > debian/php5-$${package}.postrm; \
 	done
 
 	# generate the config snippets for various php
@@ -452,7 +463,7 @@
 	done
 
 	# likewise, for the different sapi implementations
-	for tmpl in postrm links; do \
+	for tmpl in postrm; do \
 		for sapi in apache2 cgi cli; do \
 			sed -e "s/@sapi@/$$sapi/g" \
 		  	< debian/php5-sapi.$$tmpl \




More information about the Pkg-php-commits mailing list