/usr/share/dh-make-php/pecl.template/prerm is in dh-make-php 0.4.0.
This file is owned by root:root, with mode 0o775.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/bin/sh -e
PECL_NAME=##peclpackagename##
PHP_VERSION=##phpversion##
# Source debconf library.
. /usr/share/debconf/confmodule
if [ "$DPKG_DEBUG" = "developer" ]; then
set -x
fi
if [ "$1" != "remove" ] && [ "$1" != "purge" ]; then
exit 0
fi
##DEBHELPER##
EXTENSIONRE="^[[:space:]]*extension[[:space:]]*=[[:space:]]*${PECL_NAME}\.so"
for SAPI in apache apache2 cgi cli
do
# Use the same question for all extensions, because it's only
# used once per package: right here.
if [ -f "/etc/php${PHP_VERSION}/$SAPI/php.ini" ] \
&& grep -q "$EXTENSIONRE" /etc/php${PHP_VERSION}/$SAPI/php.ini
then
db_set php${PHP_VERSION}/remove_extension true
db_title "PHP"
db_subst php${PHP_VERSION}/remove_extension extname ${PECL_NAME}
db_subst php${PHP_VERSION}/remove_extension sapiconfig $SAPI
db_input low php${PHP_VERSION}/remove_extension || true
db_go
db_get php${PHP_VERSION}/remove_extension
if [ "$RET" = "true" ]; then
grep -v "$EXTENSIONRE" < /etc/php${PHP_VERSION}/$SAPI/php.ini \
> /etc/php${PHP_VERSION}/$SAPI/php.ini.${PECL_NAME}remove
chmod --reference=/etc/php${PHP_VERSION}/$SAPI/php.ini \
/etc/php${PHP_VERSION}/$SAPI/php.ini.${PECL_NAME}remove
mv /etc/php${PHP_VERSION}/$SAPI/php.ini.${PECL_NAME}remove \
/etc/php${PHP_VERSION}/$SAPI/php.ini
fi
db_fset php${PHP_VERSION}/remove_extension seen false
fi
done
exit 0
# Restart apache(s) so settings get refreshed
if [ -d /etc/php${PHP_VERSION}/apache/ ] || [ -d /etc/php${PHP_VERSION}/apache2/ ]; then
for srv in apache2 apache apache-ssl apache-perl; do
if [ -x "/etc/init.d/$srv" ]; then
if [ -x /usr/sbin/invoke-rc.d ]; then
/usr/sbin/invoke-rc.d $srv force-reload
else
/etc/init.d/$srv force-reload
fi
fi
done
fi
exit 0
|