]> git.pld-linux.org Git - packages/php.git/blob - php-module-install
- started 4.3.8 for RA
[packages/php.git] / php-module-install
1 #!/bin/sh
2
3 VERSION="$0 V 0.1 (C) 2001 Artur Frysiak"
4 COMMAND=usage
5 VERBOSE=""
6 MODNAME=""
7 INIFILE=""
8
9 install ()
10 {
11 if [ -f ${INIFILE} ] && ! grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE} ; then
12         echo "activating module '${MODNAME}.so' in ${INIFILE}" 1>&2
13         echo "extension=${MODNAME}.so" >> ${INIFILE}
14 fi
15 if [ -f /var/lock/subsys/httpd ]; then
16         /etc/rc.d/init.d/httpd restart 1>&2
17 fi
18 }
19
20 deinstall()
21 {
22 if [ -f ${INIFILE} ] && grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE} ; then
23         TMPFILE=`mktemp -q /tmp/php-module-install.XXXXXX`
24         if [ $? -ne 0 ]; then
25                 echo "$0: Can't create temp file, exiting..."
26                 exit 1
27         fi
28         echo "deactivating module '${MODNAME}.so' in ${INIFILE}" 1>&2
29         grep -v "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" > ${TMPFILE} < ${INIFILE}
30         mv ${TMPFILE} ${INIFILE}
31         chmod 644 ${INIFILE}
32 fi
33 if [ -f /var/lock/subsys/httpd ]; then
34         /etc/rc.d/init.d/httpd restart 1>&2
35 fi
36 }
37
38 usage()
39 {
40         echo $VERSION
41         echo "Usage:"
42         echo " $0 install MODNAME INIFILE"
43         echo " $0 remove  MODNAME INIFILE"
44 }
45
46 if [ "$#" = 3 ]; then
47         MODNAME="$2"
48         INIFILE="$3"
49
50         if [ "$1" = "install" ]; then
51                 install
52         else
53                 if [ "$1" = "remove" ]; then
54                         deinstall
55                 else
56                         usage
57                 fi
58         fi
59 else
60         usage
61         exit 1
62 fi
63
64 exit 0
This page took 0.082137 seconds and 3 git commands to generate.