PREIN
/bin/sh
# move to trigger?
if [ -n "`/usr/bin/getgid ups`" ] && [ "`/usr/bin/getgid ups`" = 121 ]; then
/usr/sbin/groupmod -g 76 ups
chgrp ups /etc/ups/{upsd.conf,ups.conf,upsd.users}
/usr/sbin/usermod -g 76 ups
fi
if [ -n "`/usr/bin/getgid ups`" ]; then
if [ "`/usr/bin/getgid ups`" != "76" ]; then
echo "Error: group ups doesn't have gid=76. Correct this before installing nut." 1>&2
exit 1
fi
else
echo "Adding group ups GID=76."
/usr/sbin/groupadd -g 76 -r ups 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u ups 2>/dev/null`" ]; then
if [ "`/bin/id -u ups`" != "70" ]; then
echo "Error: user ups doesn't have uid=70. Correct this before installing nut." 1>&2
exit 1
fi
else
echo "Adding user ups UID=70."
/usr/sbin/useradd \
\
-u 70 \
-r \
-d /usr/share/empty \
-s /bin/false \
-c "UPS Manager User"\
-g ups \
\
\
ups 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh user del ups
/usr/lib/rpm/user_group.sh group del ups
fi