blob: 1055e4bd1c6aea64f959ac48d1211dbf2272cf6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
post_install() {
# set post_install message
/bin/cat << EOM
--> This release marks a minor (NOT micro!) version change and is not 100%
--> compatible with former versions. Have a look at the new lighttpd.conf,
--> there are some changes in the index files syntax and nested conditions
--> are possible by now. Also please read the documentation in
--> /usr/share/lighttpd or on lighttpds's hompage: http://lighttpd.org
--> for the following OPTIONAL modules (when choosen from lighttpd.conf)
--> you will need the following dependencies:
mod_webdav : libxml2, sqlite3
mod_cml: libmemcache, lua
mod_trigger_b4_dl: libmemcache, gdbm
mod_auth.so: libldap
mod_mysql_vhost: libmysqlclient
EOM
# import daemon configuration file to detect lighttpd.conf location
[ -f /etc/conf.d/lighttpd ] && . /etc/conf.d/lighttpd
# some automagic dealing with the users preferences as marked in
# /etc/lighttpd/lighttpd.conf
# a simple conf-file parser to isolate the user, logfiles etc.
FILES=`sed -n -e '/accesslog\.filename/p;/server\.errorlog/p' \
${DAEMON_CONF} \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
DAEMON_USER=`sed -n -e '/server\.username/p' ${DAEMON_CONF} \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
DAEMON_GROUP=`sed -n -e '/server\.groupname/p' ${DAEMON_CONF} \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
DIRECTORIES=`sed -n -e '/\.cache-dir/p;/\.server-root/p' ${DAEMON_CONF} \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
DOCROOTDIRS=`sed -n -e '/server.\document-root/p' ${DAEMON_CONF} \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
CHROOT=`sed -n -e '/server\.chroot/p' ${DAEMON_CONF} \
| sed -e '/^ *#.*$/d' \
| sed -e 's/^.*"\(.*\)".*$/\1/'`
touch /tmp/empty
# make sure logfiles exist
for FILE in $FILES; do
[ ! -f ${CHROOT}${FILE} ] && \
install -Dm644 -o $DAEMON_USER -g $DAEMON_GROUP /tmp/empty ${CHROOT}${FILE} && \
echo 'Creating file ' ${CHROOT}${FILE}
done
# make sure the lighttpd.user owns the cache dirs and vhost-root ...
for DIR in $DIRECTORIES; do
[ ! -d ${CHROOT}${DIR} ] && \
install -dm755 -o $DAEMON_USER -g $DAEMON_GROUP ${CHROOT}${DIR} && \
echo "Creating directory ${CHROOT}${DIR}" && \
chown $DAEMON_USER:$DAEMON_GROUP ${CHROOT}${DIR}
done
# ... and the document roots
for DIR in $DOCROOTDIRS; do
[ ! -d ${CHROOT}${DIR} ] && \
install -dm755 -o $DAEMON_USER -g $DAEMON_GROUP ${CHROOT}${DIR} && \
echo "Creating directory ${CHROOT}${DIR}"
chown -R $DAEMON_USER:$DAEMON_GROUP ${CHROOT}${DIR}
done
rm -f /tmp/empty
}
post_upgrade() {
cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.old
cp /etc/lighttpd/lighttpd.conf.pacnew /etc/lighttpd/lighttpd.conf
if [ -f /usr/bin/php ]
then
cp /etc/lighttpd/lighttpd.conf /tmp
sed -e "s/# .* \"mod_fastcgi\",/\"mod_fastcgi\"\,/g" /tmp/lighttpd.conf > /etc/lighttpd/lighttpd.conf
fi
post_install $1
}
op=$1
shift
$op $*
# vim: ft=sh ts=2
|