PREIN
/bin/sh
/usr/sbin/useradd -d /var/lib/BackupPC -r -s /sbin/nologin backuppc 2> /dev/null || :
PREUN
/bin/sh
if [ $1 = 0 ]; then
# Package removal, not upgrade
service backuppc stop > /dev/null 2>&1 || :
chkconfig --del backuppc || :
fi
POSTIN
/bin/sh
(
# Install/update Selinux policy
semodule -i /usr/share/selinux/packages/BackupPC/BackupPC.pp
# files created by app
restorecon -R /etc/BackupPC
restorecon -R /var/log/BackupPC
) &>/dev/null
if [ $1 -eq 1 ]; then
# initial installation
chkconfig --add backuppc || :
service httpd condrestart > /dev/null 2>&1 || :
/usr/sbin/usermod -a -G backuppc apache || :
fi
# add BackupPC backup directories to PRUNEPATHS in locate database
if [ -w /etc/updatedb.conf ]; then
grep ^PRUNEPATHS /etc/updatedb.conf | grep /var/lib/BackupPC > /dev/null
if [ $? -eq 1 ]; then
sed -i '\@PRUNEPATHS@s@"$@ '/var/lib/BackupPC'"@' /etc/updatedb.conf
fi
fi
:
POSTUN
/bin/sh
# clear out any BackupPC configuration in apache
service httpd condrestart > /dev/null 2>&1 || :
if [ $1 -eq 0 ]; then
# uninstall
# Remove the SElinux policy.
semodule -r BackupPC &> /dev/null || :
# remove BackupPC backup directories from PRUNEPATHS in locate database
if [ -w /etc/updatedb.conf ]; then
sed -i '\@PRUNEPATHS@s@[ ]*'/var/lib/BackupPC'@@' /etc/updatedb.conf || :
fi
fi
if [ $1 -eq 1 ]; then
# package upgrade, not uninstall
# at least one command required
:
fi