PREIN
/bin/sh
if [ -n "`/usr/bin/getgid motion`" ]; then
if [ "`/usr/bin/getgid motion`" != "177" ]; then
echo "Error: group motion doesn't have gid=177. Correct this before installing motion." 1>&2
exit 1
fi
else
echo "Adding group motion GID=177."
/usr/sbin/groupadd -g 177 -r motion 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u motion 2>/dev/null`" ]; then
if [ "`/bin/id -u motion`" != "177" ]; then
echo "Error: user motion doesn't have uid=177. Correct this before installing motion." 1>&2
exit 1
fi
else
echo "Adding user motion UID=177."
/usr/sbin/useradd \
\
-u 177 \
-r \
-d /usr/share/empty \
-s /bin/false \
\
-g motion \
\
\
motion 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ -f /var/lock/subsys/motion ]; then
/sbin/service motion stop 1>&2 || :;
fi }; /sbin/chkconfig --del motion
fi
POSTIN
/bin/sh
/sbin/chkconfig --add motion
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/motion ] && . /etc/sysconfig/motion
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/motion ]; then
/sbin/service motion restart 1>&2 || :;
else
echo 'Run "/sbin/service motion start" to start motion service.'
fi
fi };
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del motion
/usr/lib/rpm/user_group.sh group del motion
fi