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