Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 4281842808682a69bc7ab695a975c470 > scriptlet

BackupPC-3.2.1-7.fc16.i686.rpm

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
  /bin/systemctl --no-reload disable backuppc.service > /dev/null 2>&1 || :
  /bin/systemctl stop backuppc.service > /dev/null 2>&1 || :
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
  /bin/systemctl daemon-reload > /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
  /bin/systemctl try-restart backuppc.service > /dev/null 2>&1 || :  
  # at least one command required
  :
fi