summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/libapache2-mod-php5.postinst36
-rw-r--r--debian/libapache2-mod-php5.prerm21
-rw-r--r--debian/libapache2-mod-php5filter.postinst38
-rw-r--r--debian/libapache2-mod-php5filter.prerm21
-rw-r--r--debian/php5-cgi.postinst19
-rw-r--r--debian/php5-cgi.prerm8
-rwxr-xr-xdebian/rules3
7 files changed, 34 insertions, 112 deletions
diff --git a/debian/libapache2-mod-php5.postinst b/debian/libapache2-mod-php5.postinst
index ea5a19ed5..bc45a8e3e 100644
--- a/debian/libapache2-mod-php5.postinst
+++ b/debian/libapache2-mod-php5.postinst
@@ -2,8 +2,6 @@
set -e
-#DEBHELPER#
-
# we've registered a trigger to handle extension updates.
if [ "$1" = "triggered" ] && [ "$2" = "/etc/php5/conf.d" ]; then
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
@@ -20,32 +18,18 @@ phpini="/etc/php5/apache2/php.ini"
ucf /usr/share/php5/php.ini-production $phpini
ucfr libapache2-mod-php5 $phpini
-ENABLE=yes
-
-if [ -n "$2" ]; then
- # recover the previous state
- if [ -e /etc/php5/apache2/.start ]; then
- rm -f /etc/php5/apache2/.start
- else
- ENABLE=no
- fi
-fi
-
-if [ "$ENABLE" = "yes" ]; then
- if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
-
- # php5 requires the prefork MPM
- if [ $(a2query -M) != 'prefork' ] ; then
- if apache2_switch_mpm prefork ; then
- apache2_invoke enmod php5
- else
- apache2_msg err "Could not switch to prefork, not enabling php5"
- fi
+require_prefork() {
+ if [ $(a2query -M) != 'prefork' ] ; then
+ if apache2_switch_mpm prefork ; then
+ return 0
else
- apache2_invoke enmod php5
+ apache2_msg err "Could not switch to prefork, not enabling php5"
+ return 1
fi
fi
-fi
+ return 0
+}
+
+#DEBHELPER#
exit 0
diff --git a/debian/libapache2-mod-php5.prerm b/debian/libapache2-mod-php5.prerm
deleted file mode 100644
index 22dded400..000000000
--- a/debian/libapache2-mod-php5.prerm
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-#DEBHELPER#
-
-case "$1" in
- remove)
- if [ -e /etc/apache2/apache2.conf -a -e /etc/apache2/mods-enabled/php5.load ]; then
- # set a flag to remember the original state useful when
- # reinstalling the same version.
- touch /etc/php5/apache2/.start
- fi
- if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
- apache2_invoke dismod php5
- fi
- ;;
-esac
-
-exit 0
diff --git a/debian/libapache2-mod-php5filter.postinst b/debian/libapache2-mod-php5filter.postinst
index ef779590a..12b034de5 100644
--- a/debian/libapache2-mod-php5filter.postinst
+++ b/debian/libapache2-mod-php5filter.postinst
@@ -2,8 +2,6 @@
set -e
-#DEBHELPER#
-
# we've registered a trigger to handle extension updates.
if [ "$1" = "triggered" ] && [ "$2" = "/etc/php5/conf.d" ]; then
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
@@ -20,34 +18,18 @@ phpini="/etc/php5/apache2filter/php.ini"
ucf /usr/share/php5/php.ini-production $phpini
ucfr libapache2-mod-php5filter $phpini
-[ -e /usr/share/apache2/apache2-maintscript-helper ] || exit 0
-
-DO_START=yes
-
-if [ -n "$2" ]; then
- # recover the previous state
- if [ -e /etc/php5/apache2filter/.start ]; then
- rm -f /etc/php5/apache2filter/.start
- else
- DO_START=no
- fi
-fi
-
-if [ "$DO_START" = "yes" ]; then
- if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
-
- # php5filter requires the prefork MPM
- if [ $(a2query -M) != 'prefork' ] ; then
- if apache2_switch_mpm prefork ; then
- apache2_invoke enmod php5filter
- else
- apache2_msg err "Could not switch to prefork, not enabling php5filter"
- fi
+require_prefork() {
+ if [ $(a2query -M) != 'prefork' ] ; then
+ if apache2_switch_mpm prefork ; then
+ return 0
else
- apache2_invoke enmod php5filter
+ apache2_msg err "Could not switch to prefork, not enabling php5filter"
+ return 1
fi
fi
-fi
+ return 0
+}
+
+#DEBHELPER#
exit 0
diff --git a/debian/libapache2-mod-php5filter.prerm b/debian/libapache2-mod-php5filter.prerm
deleted file mode 100644
index fa153b6fc..000000000
--- a/debian/libapache2-mod-php5filter.prerm
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-#DEBHELPER#
-
-case "$1" in
- remove)
- if [ -e /etc/apache2/apache2.conf -a -e /etc/apache2/mods-enabled/php5.load ]; then
- # set a flag to remember the original state useful when
- # reinstalling the same version.
- touch /etc/php5/apache2filter/.start
- fi
- if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
- apache2_invoke dismod php5filter
- fi
- ;;
-esac
-
-exit 0
diff --git a/debian/php5-cgi.postinst b/debian/php5-cgi.postinst
index 368b5a3cf..25e34dab0 100644
--- a/debian/php5-cgi.postinst
+++ b/debian/php5-cgi.postinst
@@ -2,7 +2,7 @@
set -e
-#DEBHELPER#
+VERSION=$2
if dpkg-maintscript-helper supports mv_conffile 2>/dev/null; then
dpkg-maintscript-helper mv_conffile \
@@ -33,14 +33,15 @@ update-alternatives \
update-alternatives \
--install /usr/lib/cgi-bin/php php-cgi-bin /usr/lib/cgi-bin/php5 50
-if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
-
- # Enable php5-cgi if upgrading from older versions of php5-cgi
- if [ -n "$2" ] && dpkg --compare-versions "$2" lt 5.4.4-5; then
- # Only enable php5-cgi if apache2 is installed
- apache2_invoke enconf php5-cgi
+enable_cgi() {
+ # Enable php5-cgi only if upgrading from older versions of php5-cgi
+ if [ -n "$VERSION" ] && dpkg --compare-versions "$VERSION" lt 5.4.4-5; then
+ return 0
+ else
+ return 1
fi
-fi
+}
+
+#DEBHELPER#
exit 0
diff --git a/debian/php5-cgi.prerm b/debian/php5-cgi.prerm
index df2e4121b..199dfa53f 100644
--- a/debian/php5-cgi.prerm
+++ b/debian/php5-cgi.prerm
@@ -2,17 +2,13 @@
set -e
-#DEBHELPER#
-
case "$1" in
remove)
- if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
- . /usr/share/apache2/apache2-maintscript-helper
- apache2_invoke disconf php5_cgi
- fi
update-alternatives --remove php-cgi /usr/bin/php5-cgi
update-alternatives --remove php-cgi-bin /usr/lib/cgi-bin/php5
;;
esac
+#DEBHELPER#
+
exit 0
diff --git a/debian/rules b/debian/rules
index c89a10ec8..5522ada9e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -480,7 +480,8 @@ install: build
chmod 01733 debian/php5-common/var/lib/php5
# install apache2 DSO module
- dh_apache2
+ dh_apache2 -Nphp5-cgi --conditional=require_prefork
+ dh_apache2 -pphp5-cgi --conditional=enable_cgi
# sanitize php.ini file
cat php.ini-production | tr "\t" " " | sed -e'/session.gc_probability =/ s/1/0/g;/disable_functions =/ s/$$/ $(PCNTL_FUNCTIONS)/g;' > debian/php5-common/usr/share/php5/php.ini-production