#!/bin/sh VERSION="$0 V 0.1 (C) 2001 Artur Frysiak" COMMAND=usage VERBOSE="" MODNAME="" INIFILE="" install() { if [ -f ${INIFILE} ] && ! grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE}; then echo "activating module '${MODNAME}.so' in ${INIFILE}" 1>&2 echo "extension=${MODNAME}.so" >> ${INIFILE} fi # restart only if there's module installed if [ -f /etc/httpd/httpd.conf/??_mod_php4.conf ] && [ -f /var/lock/subsys/httpd ]; then /etc/rc.d/init.d/httpd restart 1>&2 fi if [ -f /etc/apache/conf.d/??_mod_php4.conf ] && [ -f /var/lock/subsys/apache ]; then /etc/rc.d/init.d/apache restart 1>&2 fi } deinstall() { if [ -f ${INIFILE} ] && grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE}; then sed -i -e "/^extension[[:space:]]*=[[:space:]]*${MODNAME}.so/d" ${INIFILE} fi # restart only if there's module installed if [ -f /etc/httpd/httpd.conf/??_mod_php4.conf ] && [ -f /var/lock/subsys/httpd ]; then /etc/rc.d/init.d/httpd restart 1>&2 fi if [ -f /etc/apache/conf.d/??_mod_php4.conf ] && [ -f /var/lock/subsys/apache ]; then /etc/rc.d/init.d/apache restart 1>&2 fi } usage() { echo $VERSION echo "Usage:" echo " $0 install MODNAME INIFILE" echo " $0 remove MODNAME INIFILE" } if [ "$#" = 3 ]; then MODNAME="$2" INIFILE="$3" if [ "$1" = "install" ]; then install else if [ "$1" = "remove" ]; then deinstall else usage fi fi else usage exit 1 fi exit 0