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