#!/bin/sh
# postinst script for slurmdbd
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
    configure)
      chown slurm:slurm /var/log/slurm-llnl
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# Those using dependency based boot sequencing with sysv-rc and
# installing slurm-llnl-slurmdbd before version 2.0.5-1 would miss the
# runlevel 4 symlink.
# Recover from this.
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le "2.0.5-1" \
   && [ -f /etc/rc2.d/K[0-9][0-9]slurm-llnl-slurmdbd ] \
   && ! [ -f /etc/rc4.d/S[0-9][0-9]slurm-llnl-slurmdbd ] \
   && ! [ -f /etc/rc2.d/S[0-9][0-9]slurm-llnl-slurmdbd ] ; then
      update-rc.d -f slurm-llnl-slurmdbd remove
fi



# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

