Sophie

Sophie

distrib > Fedora > 20 > x86_64 > by-pkgid > 8629e81570ccc726f25addc03359556f > scriptlet

mailman-2.1.18.1-1.fc20.x86_64.rpm

PREIN

/bin/sh

# Make sure the user "mailman" exists on this system and has the correct values
if grep -q "^mailman:" /etc/group 2> /dev/null ; then
  /usr/sbin/groupmod -g 41 -n mailman mailman 2> /dev/null || :
else
  /usr/sbin/groupadd -g 41 mailman 2> /dev/null || :
fi
if grep -q "^mailman:" /etc/passwd 2> /dev/null ; then
  /usr/sbin/usermod -s /sbin/nologin -c "GNU Mailing List Manager" -d /usr/lib/mailman -u 41 -g 41       mailman 2> /dev/null || :
else
  /usr/sbin/useradd -s /sbin/nologin -c "GNU Mailing List Manager" -d /usr/lib/mailman -u 41 -g 41 -M -r mailman 2> /dev/null || :
fi

# Mailman should never be running during an install, but a package upgrade
# shouldn't silently stop the service, so if mailman was running
# we'll leave a temp file in the lock directory as a flag so in
# the post install phase we can restart it.
#
# rpmlint will complain here about "dangerous use of rm"
# but this is OK because we are only rm-ing our temporary file
if [ -d /var/lock/mailman ]; then
  rm -f /var/run/mailman-restart-after-rpm-install
  /sbin/service mailman status >/dev/null 2>&1
  if [ $? -eq 0 ]; then
      touch /var/run/mailman-restart-after-rpm-install
      /sbin/service mailman stop >/dev/null 2>&1
  fi
fi

# Remove older rpm-state dir
if [ -d /var/lib/rpm-state/mailman ]; then
  rm -rf /var/lib/rpm-state/mailman
fi

# Move mm_cfg.py to different location to be able to copy it to /etc/mailman
# later in post. This is needed, otherwise RPM would remove it.
mkdir -p /var/lib/rpm-state/mailman/
if [ -L /etc/mailman/mm_cfg.py -a ! -L /usr/lib/mailman/Mailman/mm_cfg.py -a -d /etc/mailman ]; then
  mv /usr/lib/mailman/Mailman/mm_cfg.py /var/lib/rpm-state/mailman/mm_cfg.py
fi

# Move templates dir to different location to be able to copy it to
# /etc/mailman later in post. This is needed, otherwise RPM would remove it.
if [ ! -d /etc/mailman/templates -a -d /usr/lib/mailman/templates ]; then
  mv /usr/lib/mailman/templates /var/lib/rpm-state/mailman/
fi

# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

PREUN

/bin/sh

# if [ $1 = 0 ]' checks that this is the actual deinstallation of
# the package, as opposed to just removing the old package on upgrade.


if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        /usr/bin/systemctl --no-reload disable mailman.service > /dev/null 2>&1 || : 
        /usr/bin/systemctl stop mailman.service > /dev/null 2>&1 || : 
fi 
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

POSTIN

/bin/sh
# We no longer use crontab, but previous versions of the spec file did, so clean up
if [ -f /var/spool/cron/mailman ]; then
  crontab -u mailman -r
fi

# Restart mailman if it had been running before installation
if [ -e /var/run/mailman-restart-after-rpm-install ]; then
  rm /var/run/mailman-restart-after-rpm-install
  /sbin/service mailman start >/dev/null 2>&1
fi

# Move mm_cfg.py from /usr/lib/mailman/Mailman to /etc/mailman and create
# symlink to it (#905845).
if [ -f /var/lib/rpm-state/mailman/mm_cfg.py ]; then
  cp -p /var/lib/rpm-state/mailman/mm_cfg.py /etc/mailman/mm_cfg.py
fi

# Move mmdir/templates to /etc/mailman/templates
if [ -d /var/lib/rpm-state/mailman/templates ]; then
  cp -pr /var/lib/rpm-state/mailman/templates/* /etc/mailman/templates
  rm -rf /var/lib/rpm-state/mailman/templates/
fi

if [ -d /var/lib/rpm-state/mailman ]; then
  rm -rf /var/lib/rpm-state/mailman
fi

# systemd

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        /usr/bin/systemctl preset mailman.service >/dev/null 2>&1 || : 
fi 

# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

POSTUN

/bin/sh
if [ $1 = 0 ]; then
  crontab -u mailman -r 2>/dev/null
fi

# systemd

/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : 
if [ $1 -ge 1 ] ; then 
        # Package upgrade, not uninstall 
        /usr/bin/systemctl try-restart mailman.service >/dev/null 2>&1 || : 
fi 

# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0

Triggers

mailman < 3:2.1.14-9

/bin/sh
/usr/bin/systemd-sysv-convert --save mailman >/dev/null 2>&1 ||:
/bin/systemctl enable mailman.service >/dev/null 2>&1
/sbin/chkconfig --del mailman >/dev/null 2>&1 || :
/bin/systemctl try-restart mailman.service >/dev/null 2>&1 || :