]> git.pld-linux.org Git - packages/php4.git/blame - php4-module-install
- keep the short_open_tag on
[packages/php4.git] / php4-module-install
CommitLineData
5d133d23 1#!/bin/sh
2
3VERSION="$0 V 0.1 (C) 2001 Artur Frysiak"
4COMMAND=usage
5VERBOSE=""
6MODNAME=""
7INIFILE=""
8
9install()
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
25deinstall()
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
40usage()
41{
42 echo $VERSION
43 echo "Usage:"
44 echo " $0 install MODNAME INIFILE"
45 echo " $0 remove MODNAME INIFILE"
46}
47
48if [ "$#" = 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
61else
62 usage
63 exit 1
64fi
65
66exit 0
This page took 0.036211 seconds and 4 git commands to generate.