[Pkg-php-commits] r910 - php5/branches/rg-extension-manager/debian
Raphael Geissert
atomo64-guest at alioth.debian.org
Tue Oct 23 23:09:12 UTC 2007
Author: atomo64-guest
Date: 2007-10-23 23:09:11 +0000 (Tue, 23 Oct 2007)
New Revision: 910
Modified:
php5/branches/rg-extension-manager/debian/php5disext
php5/branches/rg-extension-manager/debian/php5enext
Log:
EXTENSION is now EXTENSIONs and it can be 'all' to enable all extensions installed
Updated licence of scripts to GPLv3
Modified: php5/branches/rg-extension-manager/debian/php5disext
===================================================================
--- php5/branches/rg-extension-manager/debian/php5disext 2007-10-21 09:38:29 UTC (rev 909)
+++ php5/branches/rg-extension-manager/debian/php5disext 2007-10-23 23:09:11 UTC (rev 910)
@@ -1,17 +1,19 @@
#!/bin/sh
# Simple script to disable php extensions in the per-SAPI conf.d directory
-# Copyright: 2007 Raphael Geissert
-# Licence: GNU GPLv2
+# Copyright (C) 2007 by Raphael Geissert <atomo64 at gmail.com>
+# Licence: GNU GPLv3 (see /usr/share/common-licenses/GPL-3 for the full text)
PHPDIR="/etc/php5"
QUIET=0
FATAL=1
MISSING_SAPI_IS_ERROR=1
+ALREADY_DISABLED_EXT_IS_ERROR=1
if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: php5disext SAPIS EXTENSION [verbose|quiet] [fatal|nonfatal]"
+ echo "Usage: php5disext SAPIS EXTENSIONS [verbose|quiet] [fatal|nonfatal]"
echo -e "\t SAPIS: list of SAPIs or 'all'"
+ echo -e "\t EXTENSIONS: a single extension name, a list or 'all' (use with CARE)"
echo -e "\t quiet: Don't display any messages (not default)"
echo -e "\t fatal: exit with non-zero status if the extension is already disabled (default)"
exit 1
@@ -26,19 +28,19 @@
verbose)
QUIET=0
;;
- fatal)
- FATAL=1
- ;;
- nonfatal)
- FATAL=0
- ;;
+ fatal)
+ FATAL=1
+ ;;
+ nonfatal)
+ FATAL=0
+ ;;
esac
}
# verbose|quiet and fatal|nonfatal can actually be in any order
if [ ! -z "$3" ]; then
- OPT="$3"
- readOption
+ OPT="$3"
+ readOption
fi
if [ ! -z "$4" ]; then
@@ -46,7 +48,7 @@
readOption
fi
-EXT="$2"
+EXTS="$2"
SAPIS="$1"
if [ "$SAPIS" = "all" ]; then
@@ -54,41 +56,56 @@
MISSING_SAPI_IS_ERROR=0
fi
-for SAPI in $SAPIS; do
- if [ ! -e "$PHPDIR/$SAPI" ]; then
- if [ $MISSING_SAPI_IS_ERROR -eq 1 ]; then
- if [ ! $QUIET -eq 1 ]; then
- echo "The $SAPI SAPI doesn't seem to be installed!"
- fi
- exit 4
- else
- continue
- fi
- fi
+if [ "$EXTS" = "all" ]; then
+ EXTS="`/bin/ls -A $PHPDIR/conf.d | grep .ini`"
+ ALREADY_DISABLED_EXT_IS_ERROR=0
+fi
- # check for still-not-directory $SAPI/conf.d
- if [ ! -d "$PHPDIR/$SAPI/conf.d" ]; then
- if [ ! $QUIET -eq 1 ]; then
- echo "$PHPDIR/$SAPI/conf.d is not a directory!"
- fi
- exit 3
- fi
+for EXT in $EXTS; do
+ for SAPI in $SAPIS; do
+ if [ ! -e "$PHPDIR/$SAPI" ]; then
+ if [ $MISSING_SAPI_IS_ERROR -eq 1 ]; then
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $SAPI SAPI doesn't seem to be installed!"
+ fi
+ exit 4
+ else
+ continue
+ fi
+ fi
- if [ ! -L "$PHPDIR/$SAPI/conf.d/$EXT.ini" ]; then
- if [ ! $QUIET -eq 1 ]; then
- echo "The $EXT extension is not enabled on the $SAPI SAPI!"
+ # check for still-not-directory $SAPI/conf.d
+ # this is helpful in situations where the SAPI hasn't been upgraded but a new ext is installed
+ # preventing the removal of the _real_ .ini file
+ if [ -d "$PHPDIR/$SAPI/conf.d" ] && [ -s "$PHPDIR/$SAPI/conf.d" ]; then
+ if [ ! $QUIET -eq 1 ]; then
+ echo "$PHPDIR/$SAPI/conf.d is not a real directory!"
+ fi
+ # this option can prevent postrm scripts from stopping the removal
+ # in case the sapi hasn't been upgraded yet
+ if [ $FATAL -eq 1 ]; then
+ exit 3
+ else
+ continue
+ fi
fi
-
- if [ $FATAL -eq 1 ]; then
- exit 2
+
+ if [ ! -L "$PHPDIR/$SAPI/conf.d/$EXT.ini" ]; then
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $EXT extension is not enabled on the $SAPI SAPI!"
+ fi
+
+ if [ $FATAL -eq 1 ] && [ $ALREADY_DISABLED_EXT_IS_ERROR -eq 1 ]; then
+ exit 2
+ fi
+ else
+ unlink "$PHPDIR/$SAPI/conf.d/$EXT.ini"
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $EXT extension has been disabled on the $SAPI SAPI"
+ echo "In case $SAPI is a web server you might need to restart it"
+ fi
fi
- else
- unlink "$PHPDIR/$SAPI/conf.d/$EXT.ini"
- if [ ! $QUIET -eq 1 ]; then
- echo "The $EXT extension has been disabled on the $SAPI SAPI"
- echo "In case $SAPI is a web server you might need to restart it"
- fi
- fi
+ done
done
exit 0
Modified: php5/branches/rg-extension-manager/debian/php5enext
===================================================================
--- php5/branches/rg-extension-manager/debian/php5enext 2007-10-21 09:38:29 UTC (rev 909)
+++ php5/branches/rg-extension-manager/debian/php5enext 2007-10-23 23:09:11 UTC (rev 910)
@@ -1,17 +1,19 @@
#!/bin/sh
# Simple script to enable php extensions in the per-SAPI conf.d directory
-# Copyright: 2007 Raphael Geissert
-# Licence: GNU GPLv2
+# Copyright (C) 2007 by Raphael Geissert <atomo64 at gmail.com>
+# Licence: GNU GPLv3 (see /usr/share/common-licenses/GPL-3 for the full text)
PHPDIR="/etc/php5"
QUIET=0
FATAL=1
MISSING_SAPI_IS_ERROR=1
+ALREADY_ENABLED_EXT_IS_ERROR=1
if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: php5enext SAPIS EXTENSION [verbose|quiet] [fatal|nonfatal]"
- echo -e "\t SAPIS: list of SAPIs or 'all'"
+ echo "Usage: php5enext SAPIS EXTENSIONS [verbose|quiet] [fatal|nonfatal]"
+ echo -e "\t SAPIS: list of SAPIs, e.g. 'cli cgi', or 'all'"
+ echo -e "\t EXTENSIONS: a single extension name, a list or 'all' (use with CARE)"
echo -e "\t quiet: Don't display any messages (not default)"
echo -e "\t fatal: exit with non-zero status if the extension is already enabled (default)"
exit 1
@@ -26,19 +28,19 @@
verbose)
QUIET=0
;;
- fatal)
- FATAL=1
- ;;
- nonfatal)
- FATAL=0
- ;;
+ fatal)
+ FATAL=1
+ ;;
+ nonfatal)
+ FATAL=0
+ ;;
esac
}
# verbose|quiet and fatal|nonfatal can actually be in any order
if [ ! -z "$3" ]; then
- OPT="$3"
- readOption
+ OPT="$3"
+ readOption
fi
if [ ! -z "$4" ]; then
@@ -46,7 +48,7 @@
readOption
fi
-EXT="$2"
+EXTS="$2"
SAPIS="$1"
if [ "$SAPIS" = "all" ]; then
@@ -54,41 +56,56 @@
MISSING_SAPI_IS_ERROR=0
fi
-for SAPI in $SAPIS; do
- if [ ! -e "$PHPDIR/$SAPI" ]; then
- if [ $MISSING_SAPI_IS_ERROR -eq 1 ]; then
+if [ "$EXTS" = "all" ]; then
+ EXTS="`/bin/ls -A $PHPDIR/conf.d | grep .ini`"
+ ALREADY_ENABLED_EXT_IS_ERROR=0
+fi
+
+for EXT in $EXTS; do
+ for SAPI in $SAPIS; do
+ if [ ! -e "$PHPDIR/$SAPI" ]; then
+ if [ $MISSING_SAPI_IS_ERROR -eq 1 ]; then
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $SAPI SAPI doesn't seem to be installed!"
+ fi
+ exit 4
+ else
+ continue
+ fi
+ fi
+
+ # check for still-not-directory $SAPI/conf.d
+ # this is helpful in situations where the SAPI hasn't been upgraded but a new ext is installed
+ # preventing the removal of the _real_ .ini file
+ if [ -d "$PHPDIR/$SAPI/conf.d" ] && [ -s "$PHPDIR/$SAPI/conf.d" ]; then
if [ ! $QUIET -eq 1 ]; then
- echo "The $SAPI SAPI doesn't seem to be installed!"
+ echo "$PHPDIR/$SAPI/conf.d is not a real directory!"
fi
- exit 4
- else
- continue
- fi
- fi
+ # this option can prevent postinst scripts from stopping the installation
+ # in case the sapi hasn't been upgraded yet
+ if [ $FATAL -eq 1 ]; then
+ exit 3
+ else
+ continue
+ fi
+ fi
- # check for still-not-directory $SAPI/conf.d
- if [ ! -d "$PHPDIR/$SAPI/conf.d" ]; then
- if [ ! $QUIET -eq 1 ]; then
- echo "$PHPDIR/$SAPI/conf.d is not a directory!"
- fi
- exit 3
- fi
+ if [ -L "$PHPDIR/$SAPI/conf.d/$EXT.ini" ]; then
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $EXT extension is already enabled on the $SAPI SAPI"
+ fi
- if [ -L "$PHPDIR/$SAPI/conf.d/$EXT.ini" ]; then
- if [ ! $QUIET -eq 1 ]; then
- echo "The $EXT extension is already enabled on the $SAPI SAPI"
+ if [ $FATAL -eq 1 ] && [ $ALREADY_ENABLED_EXT_IS_ERROR -eq 1 ]; then
+ exit 2
+ fi
+ else
+ ln -s "$PHPDIR/conf.d/$EXT.ini" "$PHPDIR/$SAPI/conf.d/"
+ if [ ! $QUIET -eq 1 ]; then
+ echo "The $EXT extension has been enabled on the $SAPI SAPI"
+ echo "In case $SAPI is a web server you might need to restart it"
+ fi
fi
-
- if [ $FATAL -eq 1 ]; then
- exit 2
- fi
- else
- ln -s "$PHPDIR/conf.d/$EXT.ini" "$PHPDIR/$SAPI/conf.d/"
- if [ ! $QUIET -eq 1 ]; then
- echo "The $EXT extension has been enabled on the $SAPI SAPI"
- echo "In case $SAPI is a web server you might need to restart it"
- fi
- fi
+ done
done
exit 0
More information about the Pkg-php-commits
mailing list