X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=php-module-install;h=cdccc398e65c3820024845377ecb462670807784;hb=35ef43f3e58ac6c0d4daf729ec60c0548495228c;hp=c5cee55924c2274b869b0d0ede9701ec79fce1ce;hpb=b12a6a9f3e0f28dd8c508593d6e0aae6c3433795;p=packages%2Fphp.git diff --git a/php-module-install b/php-module-install index c5cee55..cdccc39 100644 --- a/php-module-install +++ b/php-module-install @@ -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