PREIN
/bin/sh
if [ -n "`/usr/bin/getgid lighttpd`" ]; then
if [ "`/usr/bin/getgid lighttpd`" != "109" ]; then
echo "Error: group lighttpd doesn't have gid=109. Correct this before installing lighttpd." 1>&2
exit 1
fi
else
echo "Adding group lighttpd GID=109."
/usr/sbin/groupadd -g 109 -r lighttpd 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/usr/bin/getgid http`" ]; then
if [ "`/usr/bin/getgid http`" != "51" ]; then
echo "Error: group http doesn't have gid=51. Correct this before installing lighttpd." 1>&2
exit 1
fi
else
echo "Adding group http GID=51."
/usr/sbin/groupadd -g 51 -r http 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u lighttpd 2>/dev/null`" ]; then
if [ "`/bin/id -u lighttpd`" != "116" ]; then
echo "Error: user lighttpd doesn't have uid=116. Correct this before installing lighttpd." 1>&2
exit 1
fi
else
echo "Adding user lighttpd UID=116."
/usr/sbin/useradd \
\
-u 116 \
-r \
-d /home/services/lighttpd \
-s /bin/false \
-c "LigHTTPd User"\
-g lighttpd \
\
\
lighttpd 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;/usr/lib/rpm/user_group.sh user addtogroup lighttpd http
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ -f /var/lock/subsys/lighttpd ]; then
/sbin/service lighttpd stop 1>&2 || :;
fi }; /sbin/chkconfig --del lighttpd
fi
POSTIN
/bin/sh
for a in access.log error.log; do
if [ ! -f /var/log/lighttpd/$a ]; then
touch /var/log/lighttpd/$a
chown lighttpd:lighttpd /var/log/lighttpd/$a
chmod 644 /var/log/lighttpd/$a
fi
done
/sbin/chkconfig --add lighttpd
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del lighttpd
/usr/lib/rpm/user_group.sh group del lighttpd
/usr/lib/rpm/user_group.sh group del http
fi
POSTTRANS
/bin/sh
# minimizing lighttpd restarts logics. we restart webserver:
#
# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
# 2. first install of module (post: $1 = 1)
# 2. uninstall of module (postun: $1 == 0)
#
# the strict internal deps between lighttpd modules and
# main package are very important for all this to work.
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/lighttpd ] && . /etc/sysconfig/lighttpd
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/lighttpd ]; then
/sbin/service lighttpd restart 1>&2 || :;
else
echo 'Run "/sbin/service lighttpd start" to start LigHTTPd webserver.'
fi
fi };exit 0
# macro called at module post scriptlet
# macro called at module postun scriptlet
# it's sooo annoying to write them
Triggers
lighttpd <=
1.3.6-2
/bin/sh
RPM_SCRIPTVERBOSITY=5
[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
if [ -x /usr/bin/banner.sh ]; then
CMD="/usr/bin/banner.sh --stderr $([ $RPM_SCRIPTVERBOSITY -ge 5 ] && echo -s) -m lighttpd"
else
CMD="cat >&2"
fi
eval $CMD <