PREIN
/bin/sh
getent group smstools >/dev/null || groupadd -r smstools
# on older releases we need to use uucp (here it seems only the uucp group exists)
# on newer releases it's dialout (here it seems both groups exist)
# it would be more elegant to base my if clause on the udev rules instead of the group existence
if [ `getent group dialout` ]
then
getent passwd smstools >/dev/null || useradd -r -d /var/lib/smstools -m -g smstools -G dialout smstools
else
getent passwd smstools >/dev/null || useradd -r -d /var/lib/smstools -m -g smstools -G uucp smstools
fi
PREUN
/bin/sh
if [ $1 -eq 0 ]; then
/sbin/service smsd stop >/dev/null 2>&1
/sbin/chkconfig --del smsd
fi
POSTIN
/bin/sh
if [ $1 -eq 0 ]; then
/sbin/chkconfig --add smsd
fi
# Create initial log files so that logrotate doesn't complain
for n in smsd.log smsd_trouble.log; do
[ -f /var/log/smsd/$n ] || touch /var/log/smsd/$n
chown smstools:smstools /var/log/smsd/$n
chmod 640 /var/log/smsd/$n
done
POSTUN
/bin/sh
if [ $1 -ge 1 ]; then
/sbin/service smsd condrestart >/dev/null 2>&1
fi