#!/bin/sh # postinst script for n4d-ldap # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package PACKAGE_NAME="n4d-ldap" ORIGINAL_FILE="/etc/init.d/slapd" DIVERT_FILE="/usr/share/n4d-ldap/diversions/etc.initd.slapd.divert" LLIUREX_FILE="/usr/sbin/slapd-daemon-starter" case "$1" in configure) if dpkg --compare-versions "$2" lt 0.20; then cp /usr/share/n4d-ldap/one-shots/ldap-fix-epoptes /etc/n4d/one-shot/ deb-systemd-invoke restart n4d || true fi if dpkg --compare-versions "$2" lt 0.21; then echo "Fixing netadmin..." cp /usr/share/n4d-ldap/one-shots/ldap-fix-netadmin /etc/n4d/one-shot/ deb-systemd-invoke restart n4d || true fi if dpkg --compare-versions "$2" lt 0.27; then cp /usr/share/n4d-ldap/one-shots/ldap_update.py /etc/n4d/one-shot/ deb-systemd-invoke restart n4d || true fi if dpkg --compare-versions "$2" lt 0.31; then if [ -e '/var/lib/lliurex-folders/local/students' ]; then cp /usr/share/n4d/templates/folder/students /var/lib/lliurex-folders/local/ fi fi if dpkg --compare-versions "$2" lt 0.43; then if [ -e '/var/lib/n4d/variables-dir/SRV_IP' ]; then echo "Adding roadmin ACLs..." cp /usr/share/n4d-ldap/one-shots/roadmin_acl.py /etc/n4d/one-shot/ invoke-rc.d n4d restart || true fi fi if dpkg --compare-versions "$2" lt 0.44; then if [ -e '/var/lib/n4d/variables-dir/SRV_IP' ]; then if [ ! -e "/var/lib/lliurex-folders/local/admins" ]; then echo "Enabling admins share..." cp /usr/share/n4d/templates/folder/admins /var/lib/lliurex-folders/local/ cp /usr/share/n4d/templates/folder/netadmin /var/lib/lliurex-folders/local/ deb-systemd-invoke restart n4d || true fi fi fi if dpkg --compare-versions "$2" lt 0.51.3; then cp /usr/share/n4d-ldap/one-shots/fix-replication-interface /etc/n4d/one-shot/ deb-systemd-invoke restart n4d || true fi if dpkg --compare-versions "$2" lt 0.56; then if [ -e '/var/lib/lliurex-folders/local/students' ]; then cp /usr/share/n4d/templates/folder/students /var/lib/lliurex-folders/local/ cp /usr/share/n4d/templates/folder/teachers /var/lib/lliurex-folders/local/ deb-systemd-invoke restart n4d || true fi fi if [ -e "$ORIGINAL_FILE" ]; then update-rc.d slapd disable 2 3 4 5 || true dpkg-divert --package ${PACKAGE_NAME} --rename --quiet --add --divert ${DIVERT_FILE} ${ORIGINAL_FILE} ln -s ${DIVERT_FILE} ${LLIUREX_FILE} systemctl daemon-reload || true systemctl enable slapd || true systemctl restart slapd || true fi n4d-modules enable-plugin /etc/n4d/conf.d/SlapdManager || true ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0