]> git.pld-linux.org Git - packages/php4.git/blob - php4-module-install
- keep the short_open_tag on
[packages/php4.git] / php4-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
16         # restart only if there's module installed
17         if [ -f /etc/httpd/httpd.conf/??_mod_php4.conf ] && [ -f /var/lock/subsys/httpd ]; then
18                 /etc/rc.d/init.d/httpd restart 1>&2
19         fi
20         if [ -f /etc/apache/conf.d/??_mod_php4.conf ] && [ -f /var/lock/subsys/apache ]; then
21                 /etc/rc.d/init.d/apache restart 1>&2
22         fi
23 }
24
25 deinstall()
26 {
27         if [ -f ${INIFILE} ] && grep -q "^extension[[:space:]]*=[[:space:]]*${MODNAME}.so" ${INIFILE}; then
28                 sed -i -e "/^extension[[:space:]]*=[[:space:]]*${MODNAME}.so/d" ${INIFILE}
29         fi
30
31         # restart only if there's module installed
32         if [ -f /etc/httpd/httpd.conf/??_mod_php4.conf ] && [ -f /var/lock/subsys/httpd ]; then
33                 /etc/rc.d/init.d/httpd restart 1>&2
34         fi
35         if [ -f /etc/apache/conf.d/??_mod_php4.conf ] && [ -f /var/lock/subsys/apache ]; then
36                 /etc/rc.d/init.d/apache restart 1>&2
37         fi
38 }
39
40 usage()
41 {
42         echo $VERSION
43         echo "Usage:"
44         echo " $0 install MODNAME INIFILE"
45         echo " $0 remove  MODNAME INIFILE"
46 }
47
48 if [ "$#" = 3 ]; then
49         MODNAME="$2"
50         INIFILE="$3"
51
52         if [ "$1" = "install" ]; then
53                 install
54         else
55                 if [ "$1" = "remove" ]; then
56                         deinstall
57                 else
58                         usage
59                 fi
60         fi
61 else
62         usage
63         exit 1
64 fi
65
66 exit 0
This page took 0.027682 seconds and 3 git commands to generate.