]> git.pld-linux.org Git - packages/php.git/blobdiff - php-module-install
- added dl-pcre and dl-zlib patches to allow building pcre and zlib extensions
[packages/php.git] / php-module-install
index c5cee55924c2274b869b0d0ede9701ec79fce1ce..cdccc398e65c3820024845377ecb462670807784 100644 (file)
@@ -8,9 +8,9 @@ INIFILE=""
 
 install ()
 {
-if [ -f ${INIFILE} ]; then
+if [ -f ${INIFILE} ] && ! grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE} ; then
        echo "activating module '${MODNAME}.so' in ${INIFILE}" 1>&2
-       perl -pi -e "s|^;extension=${MODNAME}.so|extension=${MODNAME}.so|g" ${INIFILE}
+       echo "extension=${MODNAME}.so" >> ${INIFILE}
 fi
 if [ -f /var/lock/subsys/httpd ]; then
        /etc/rc.d/init.d/httpd restart 1>&2
@@ -19,9 +19,16 @@ fi
 
 deinstall()
 {
-if [ -f ${INIFILE} ]; then
+if [ -f ${INIFILE} ] && grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE} ; then
+       TMPFILE=`mktemp -q /tmp/php-module-install.XXXXXX`
+       if [ $? -ne 0 ]; then
+               echo "$0: Can't create temp file, exiting..."
+               exit 1
+       fi
        echo "deactivating module '${MODNAME}.so' in ${INIFILE}" 1>&2
-       perl -pi -e "s|^extension=${MODNAME}.so|;extension=${MODNAME}.so|g" $INIFILE
+       grep -v "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" > ${TMPFILE} < ${INIFILE}
+       mv ${TMPFILE} ${INIFILE}
+       chmod 644 ${INIFILE}
 fi
 if [ -f /var/lock/subsys/httpd ]; then
        /etc/rc.d/init.d/httpd restart 1>&2
@@ -40,11 +47,11 @@ if [ "$#" = 3 ]; then
        MODNAME="$2"
        INIFILE="$3"
 
-       if [ "$1" = "install"]; then
+       if [ "$1" = "install" ]; then
                install
        else
-               if [ "$1" = "remove"]; then
-                       remove
+               if [ "$1" = "remove" ]; then
+                       deinstall
                else
                        usage
                fi
@@ -54,3 +61,4 @@ else
        exit 1
 fi
 
+exit 0
This page took 0.033503 seconds and 4 git commands to generate.