PREIN
/bin/sh
getent group luci >/dev/null || groupadd -r luci
getent passwd luci >/dev/null || \
useradd -r -g luci -d /var/lib/luci -s /sbin/nologin \
-c "luci high availability management application" luci
if [ "$1" -eq "2" ]; then
# If we're upgrading from luci 0.22.x, we need to move
# the old config out of the way, as this file is no longer
# marked %config, but %ghost in luci 0.23.0 and later
conf_first_word="$((head -1 /var/lib/luci/etc/luci.ini 2>/dev/null || echo 'empty')|awk '{print $2}')"
if [ "$conf_first_word" = "luci" ]; then
mv -f /var/lib/luci/etc/luci.ini /var/lib/luci/etc/luci.ini.rpmsave
fi
fi
exit 0
PREUN
/bin/sh
if [ "$1" == "0" ]; then
/sbin/service "luci" stop &>/dev/null
/sbin/chkconfig --del "luci"
fi
exit 0
POSTIN
/bin/sh
/sbin/chkconfig --add "luci" || :
POSTUN
/bin/sh
if [ "$1" -ge "1" ]; then
/sbin/service "luci" condrestart &>/dev/null || :
fi