diff options
| author | Ondřej Surý <ondrej@sury.org> | 2013-05-07 11:04:16 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2013-05-07 11:04:16 +0200 |
| commit | b11cd8d92c2d2f6bb4e1ca9832926584911dd756 (patch) | |
| tree | 95e6b530e116eb1030a6f8f0f140916dfc638df9 | |
| parent | 3b2c79c0e330959074b095ddacb4ba08da017ab0 (diff) | |
| download | php-b11cd8d92c2d2f6bb4e1ca9832926584911dd756.tar.gz | |
Unify dpkg maintfiles
| -rw-r--r-- | debian/libapache2-mod-php5.postinst | 32 | ||||
| -rw-r--r-- | debian/libapache2-mod-php5filter.postinst | 31 | ||||
| -rw-r--r-- | debian/libphp5-embed.postinst | 15 | ||||
| -rw-r--r-- | debian/libphp5-embed.prerm | 4 | ||||
| -rw-r--r-- | debian/php5-cgi.postinst | 49 | ||||
| -rw-r--r-- | debian/php5-cgi.preinst | 9 | ||||
| -rw-r--r-- | debian/php5-cgi.prerm | 10 | ||||
| -rw-r--r-- | debian/php5-cli.postinst | 20 | ||||
| -rw-r--r-- | debian/php5-cli.prerm | 4 | ||||
| -rw-r--r-- | debian/php5-dev.postinst | 16 | ||||
| -rw-r--r-- | debian/php5-dev.prerm | 12 | ||||
| -rw-r--r-- | debian/php5-fpm.postinst | 19 | ||||
| -rw-r--r-- | debian/php5-fpm.preinst | 4 | ||||
| -rw-r--r-- | debian/php5-module.postinst | 5 | ||||
| -rw-r--r-- | debian/php5-module.postrm | 17 | ||||
| -rw-r--r-- | debian/php5-module.preinst | 4 | ||||
| -rw-r--r-- | debian/php5-module.prerm | 3 | ||||
| -rw-r--r-- | debian/php5-sapi.postrm | 39 |
18 files changed, 135 insertions, 158 deletions
diff --git a/debian/libapache2-mod-php5.postinst b/debian/libapache2-mod-php5.postinst index bc45a8e3e..5c64e4c5b 100644 --- a/debian/libapache2-mod-php5.postinst +++ b/debian/libapache2-mod-php5.postinst @@ -2,6 +2,18 @@ set -e +require_prefork() { + if [ $(a2query -M) != 'prefork' ] ; then + if apache2_switch_mpm prefork ; then + return 0 + else + apache2_msg err "Could not switch to prefork, not enabling php5" + return 1 + fi + fi + return 0 +} + # 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 @@ -13,22 +25,12 @@ elif [ "$1" != "configure" ]; then exit 0 fi -phpini="/etc/php5/apache2/php.ini" - -ucf /usr/share/php5/php.ini-production $phpini -ucfr libapache2-mod-php5 $phpini +if [ "$1" = "configure" ]; then + phpini="/etc/php5/apache2/php.ini" -require_prefork() { - if [ $(a2query -M) != 'prefork' ] ; then - if apache2_switch_mpm prefork ; then - return 0 - else - apache2_msg err "Could not switch to prefork, not enabling php5" - return 1 - fi - fi - return 0 -} + ucf /usr/share/php5/php.ini-production $phpini + ucfr libapache2-mod-php5 $phpini +fi #DEBHELPER# diff --git a/debian/libapache2-mod-php5filter.postinst b/debian/libapache2-mod-php5filter.postinst index 12b034de5..167883543 100644 --- a/debian/libapache2-mod-php5filter.postinst +++ b/debian/libapache2-mod-php5filter.postinst @@ -2,22 +2,6 @@ set -e -# 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 - . /usr/share/apache2/apache2-maintscript-helper - apache2_reload restart - fi - exit 0 -elif [ "$1" != "configure" ]; then - exit 0 -fi - -phpini="/etc/php5/apache2filter/php.ini" - -ucf /usr/share/php5/php.ini-production $phpini -ucfr libapache2-mod-php5filter $phpini - require_prefork() { if [ $(a2query -M) != 'prefork' ] ; then if apache2_switch_mpm prefork ; then @@ -30,6 +14,21 @@ require_prefork() { return 0 } +# 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 + . /usr/share/apache2/apache2-maintscript-helper + apache2_reload restart + fi +fi + +if [ "$1" = "configure" ]; then + phpini="/etc/php5/apache2filter/php.ini" + + ucf /usr/share/php5/php.ini-production $phpini + ucfr libapache2-mod-php5filter $phpini +fi + #DEBHELPER# exit 0 diff --git a/debian/libphp5-embed.postinst b/debian/libphp5-embed.postinst index 0204c38b8..e1d0a8dc0 100644 --- a/debian/libphp5-embed.postinst +++ b/debian/libphp5-embed.postinst @@ -2,17 +2,14 @@ set -e -#DEBHELPER# - -[ "$1" = "configure" ] && ldconfig +if [ "$1" = "configure" ]; then + ldconfig -if [ "$1" != "configure" ]; then - exit 0 + phpini="/etc/php5/embed/php.ini" + ucf /usr/share/php5/php.ini-production $phpini + ucfr libphp5-embed $phpini fi -phpini="/etc/php5/embed/php.ini" - -ucf /usr/share/php5/php.ini-production $phpini -ucfr libphp5-embed $phpini +#DEBHELPER# exit 0 diff --git a/debian/libphp5-embed.prerm b/debian/libphp5-embed.prerm index 3db0acd4d..267af11f7 100644 --- a/debian/libphp5-embed.prerm +++ b/debian/libphp5-embed.prerm @@ -2,10 +2,10 @@ set -e -#DEBHELPER# - if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then update-alternatives --remove php /usr/bin/php5 fi +#DEBHELPER# + exit 0 diff --git a/debian/php5-cgi.postinst b/debian/php5-cgi.postinst index 25e34dab0..df442869d 100644 --- a/debian/php5-cgi.postinst +++ b/debian/php5-cgi.postinst @@ -4,35 +4,6 @@ set -e VERSION=$2 -if dpkg-maintscript-helper supports mv_conffile 2>/dev/null; then - dpkg-maintscript-helper mv_conffile \ - /etc/apache2/mods-available/php5_cgi.conf \ - /etc/apache2/conf-available/php5-cgi.conf \ - 5.5.0~beta4-1 -- "$@" -fi - -if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then - dpkg-maintscript-helper rm_conffile \ - /etc/apache2/mods-available/php5_cgi.load -fi - -if [ "$1" != "configure" ]; then - exit 0 -fi - -phpini="/etc/php5/cgi/php.ini" - -ucf /usr/share/php5/php.ini-production $phpini -ucfr php5-cgi $phpini - -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 - -update-alternatives \ - --install /usr/lib/cgi-bin/php php-cgi-bin /usr/lib/cgi-bin/php5 50 - 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 @@ -42,6 +13,26 @@ enable_cgi() { fi } +dpkg-maintscript-helper mv_conffile /etc/apache2/mods-available/php5_cgi.conf \ + /etc/apache2/conf-available/php5-cgi.conf 5.5.0~beta4-1 -- "$@" + +dpkg-maintscript-helper rm_conffile /etc/apache2/mods-available/php5_cgi.load + +if [ "$1" = "configure" ]; then + phpini="/etc/php5/cgi/php.ini" + + ucf /usr/share/php5/php.ini-production $phpini + ucfr php5-cgi $phpini + + 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 + + update-alternatives \ + --install /usr/lib/cgi-bin/php php-cgi-bin /usr/lib/cgi-bin/php5 50 +fi + #DEBHELPER# exit 0 diff --git a/debian/php5-cgi.preinst b/debian/php5-cgi.preinst index 44cff8130..2978b00a2 100644 --- a/debian/php5-cgi.preinst +++ b/debian/php5-cgi.preinst @@ -4,12 +4,9 @@ set -e #DEBHELPER# -if dpkg-maintscript-helper supports mv_conffile 2>/dev/null; then - dpkg-maintscript-helper mv_conffile /etc/apache2/mods-available/php5_cgi.conf /etc/apache2/conf-available/php5-cgi.conf 5.5.0~beta4-1 -- "$@" -fi +dpkg-maintscript-helper mv_conffile /etc/apache2/mods-available/php5_cgi.conf \ + /etc/apache2/conf-available/php5-cgi.conf 5.5.0~beta4-1 -- "$@" -if dpkg-maintscript-helper supports rm_conffile 2>/dev/null; then - dpkg-maintscript-helper rm_conffile /etc/apache2/mods-available/php5_cgi.load -fi +dpkg-maintscript-helper rm_conffile /etc/apache2/mods-available/php5_cgi.load exit 0 diff --git a/debian/php5-cgi.prerm b/debian/php5-cgi.prerm index 199dfa53f..7a842cea6 100644 --- a/debian/php5-cgi.prerm +++ b/debian/php5-cgi.prerm @@ -2,12 +2,10 @@ set -e -case "$1" in - remove) - update-alternatives --remove php-cgi /usr/bin/php5-cgi - update-alternatives --remove php-cgi-bin /usr/lib/cgi-bin/php5 - ;; -esac +if [ "$1" = "remove" ]; then + update-alternatives --remove php-cgi /usr/bin/php5-cgi + update-alternatives --remove php-cgi-bin /usr/lib/cgi-bin/php5 +fi #DEBHELPER# diff --git a/debian/php5-cli.postinst b/debian/php5-cli.postinst index 4d8bfa344..18d8aec3b 100644 --- a/debian/php5-cli.postinst +++ b/debian/php5-cli.postinst @@ -2,19 +2,17 @@ set -e -#DEBHELPER# - -if [ "$1" != "configure" ]; then - exit 0 -fi +if [ "$1" = "configure" ]; then + phpini="/etc/php5/cli/php.ini" -phpini="/etc/php5/cli/php.ini" + ucf /usr/share/php5/php.ini-production.cli $phpini + ucfr php5-cli $phpini -ucf /usr/share/php5/php.ini-production.cli $phpini -ucfr php5-cli $phpini + 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 +fi -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 +#DEBHELPER# exit 0 diff --git a/debian/php5-cli.prerm b/debian/php5-cli.prerm index 3db0acd4d..267af11f7 100644 --- a/debian/php5-cli.prerm +++ b/debian/php5-cli.prerm @@ -2,10 +2,10 @@ set -e -#DEBHELPER# - if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then update-alternatives --remove php /usr/bin/php5 fi +#DEBHELPER# + exit 0 diff --git a/debian/php5-dev.postinst b/debian/php5-dev.postinst index 0d4574c95..a3146d930 100644 --- a/debian/php5-dev.postinst +++ b/debian/php5-dev.postinst @@ -2,16 +2,14 @@ set -e -#DEBHELPER# - -if [ "$1" != "configure" ]; then - exit 0 +if [ "$1" = "configure" ]; then + for i in php-config phpize; do + update-alternatives \ + --install /usr/bin/"$i" $i /usr/bin/"$i"5 50 \ + --slave /usr/share/man/man1/"$i".1.gz "$i".1.gz /usr/share/man/man1/"$i"5.1.gz + done fi -for i in php-config phpize; do - update-alternatives \ - --install /usr/bin/"$i" $i /usr/bin/"$i"5 50 \ - --slave /usr/share/man/man1/"$i".1.gz "$i".1.gz /usr/share/man/man1/"$i"5.1.gz -done +#DEBHELPER# exit 0 diff --git a/debian/php5-dev.prerm b/debian/php5-dev.prerm index f9d22e0c4..50d2c4f67 100644 --- a/debian/php5-dev.prerm +++ b/debian/php5-dev.prerm @@ -2,14 +2,12 @@ set -e -#DEBHELPER# - -if [ "$1" != "remove" -a "$1" != "purge" ]; then - exit 0 +if [ "$1" = "remove" -o "$1" = "purge" ]; then + for i in php-config phpize; do + update-alternatives --remove $i /usr/bin/"$i"5 + done fi -for i in php-config phpize; do - update-alternatives --remove $i /usr/bin/"$i"5 -done +#DEBHELPER# exit 0 diff --git a/debian/php5-fpm.postinst b/debian/php5-fpm.postinst index 58c36dbfe..d021dab86 100644 --- a/debian/php5-fpm.postinst +++ b/debian/php5-fpm.postinst @@ -2,20 +2,19 @@ set -e -#DEBHELPER# - -dpkg-maintscript-helper mv_conffile /etc/php5/fpm/main.conf /etc/php5/fpm/php-fpm.conf 5.3.5-1 -- "$@" - if [ "$1" = "triggered" ] && [ "$2" = "/etc/php5/conf.d" ]; then invoke-rc.d php5-fpm restart - exit 0 -elif [ "$1" != "configure" ]; then - exit 0 fi -phpini="/etc/php5/fpm/php.ini" +dpkg-maintscript-helper mv_conffile /etc/php5/fpm/main.conf /etc/php5/fpm/php-fpm.conf 5.3.5-1 -- "$@" -ucf /usr/share/php5/php.ini-production $phpini -ucfr php5-fpm $phpini +if [ "$1" = "configure" ]; then + phpini="/etc/php5/fpm/php.ini" + + ucf /usr/share/php5/php.ini-production $phpini + ucfr php5-fpm $phpini +fi + +#DEBHELPER# exit 0 diff --git a/debian/php5-fpm.preinst b/debian/php5-fpm.preinst index f03891c71..d7ca279a4 100644 --- a/debian/php5-fpm.preinst +++ b/debian/php5-fpm.preinst @@ -2,8 +2,8 @@ set -e -#DEBHELPER# - dpkg-maintscript-helper mv_conffile /etc/php5/fpm/main.conf /etc/php5/fpm/php-fpm.conf 5.3.5-1 -- "$@" +#DEBHELPER# + exit 0 diff --git a/debian/php5-module.postinst b/debian/php5-module.postinst index 6830cc77a..7e8c50f96 100644 --- a/debian/php5-module.postinst +++ b/debian/php5-module.postinst @@ -3,10 +3,9 @@ set -e #EXTRA# -#DEBHELPER# -inidir=/etc/php5/mods-available if [ "$1" = "configure" ]; then + inidir=/etc/php5/mods-available for dsoname in @modules@; do inifile=${dsoname}.ini priority=$(sed -ne "s/^; priority=\([0-9]\+\)$/\\1/p" /usr/share/php5/@package@/${inifile}) @@ -31,4 +30,6 @@ if [ "$1" = "configure" ]; then done fi +#DEBHELPER# + exit 0 diff --git a/debian/php5-module.postrm b/debian/php5-module.postrm index bc9dac186..f6c553bbe 100644 --- a/debian/php5-module.postrm +++ b/debian/php5-module.postrm @@ -3,7 +3,6 @@ set -e #EXTRA# -#DEBHELPER# inidir=/etc/php5/mods-available for dsoname in @modules@; do @@ -11,14 +10,14 @@ for dsoname in @modules@; do dpkg-maintscript-helper mv_conffile /etc/php5/conf.d/${inifile} ${inidir}/${inifile} 5.4.0~rc6-1 -- "$@"; - # Query which package has this conffile registered - if which ucfq >/dev/null; then - ucfp=$(ucfq -w ${inidir}/${inifile} | cut -f 2 -d:) - fi + if [ "$1" = "purge" ]; then + # Query which package has this conffile registered + if which ucfq >/dev/null; then + ucfp=$(ucfq -w ${inidir}/${inifile} | cut -f 2 -d:) + fi - # Only work with the config file if it still belongs to us - if test "$ucfp" = php5-@package@; then - if [ "$1" = "purge" ]; then + # Only work with the config file if it still belongs to us + if test "$ucfp" = php5-@package@; then for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do rm -f ${inidir}/${inifile}${ext} done @@ -33,4 +32,6 @@ for dsoname in @modules@; do fi done +#DEBHELPER# + exit 0 diff --git a/debian/php5-module.preinst b/debian/php5-module.preinst index d2bf865b4..fd88bb504 100644 --- a/debian/php5-module.preinst +++ b/debian/php5-module.preinst @@ -3,12 +3,12 @@ set -e #EXTRA# -#DEBHELPER# for dsoname in @modules@; do inifile=${dsoname}.ini - dpkg-maintscript-helper mv_conffile /etc/php5/conf.d/${inifile} /etc/php5/mods-available/${inifile} 5.4.0~rc6-1 -- "$@"; done +#DEBHELPER# + exit 0 diff --git a/debian/php5-module.prerm b/debian/php5-module.prerm index e55b85ede..caf443384 100644 --- a/debian/php5-module.prerm +++ b/debian/php5-module.prerm @@ -3,7 +3,6 @@ set -e #EXTRA# -#DEBHELPER# if [ "$1" = "remove" ]; then for dsoname in @modules@; do @@ -11,4 +10,6 @@ if [ "$1" = "remove" ]; then done fi +#DEBHELPER# + exit 0 diff --git a/debian/php5-sapi.postrm b/debian/php5-sapi.postrm index 1e0c9fcaf..40a4a52b6 100644 --- a/debian/php5-sapi.postrm +++ b/debian/php5-sapi.postrm @@ -2,29 +2,26 @@ set -e -phpini=/etc/php5/@sapi@/php.ini - -case "$1" in -purge) - # remove the flag to remember the original state - if [ -e /etc/php5/@sapi@/.start ]; then - rm -f /etc/php5/@sapi@/.start - fi - for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do - rm -f $phpini$ext - done - rm -f $phpini - if which ucf >/dev/null; then - ucf --purge $phpini - fi - if which ucfr >/dev/null; then - ucfr --purge @package@ $phpini - fi - ;; -esac - #EXTRA# +if [ "$1" = "purge" ]; then + phpini=/etc/php5/@sapi@/php.ini + # remove the flag to remember the original state + if [ -e /etc/php5/@sapi@/.start ]; then + rm -f /etc/php5/@sapi@/.start + fi + for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do + rm -f $phpini$ext + done + rm -f $phpini + if which ucf >/dev/null; then + ucf --purge $phpini + fi + if which ucfr >/dev/null; then + ucfr --purge @package@ $phpini + fi +fi + #DEBHELPER# exit 0 |
