#!/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 case "$1" in configure) n4d-modules enable-plugin /etc/n4d/conf.d/NfsManager || true if dpkg --compare-versions "$2" lt 0.6.5; then EXPORTS_FILE="/etc/exports.d/net.exports" if [ -e "$EXPORTS_FILE" ]; then rc=0 grep "async" "$EXPORTS_FILE" 1> /dev/null || rc=1 if [ $rc -eq 1 ]; then echo "[NfsManager] Replacing sync with async in export options..." python -c "import imp;imp.load_source('NfsManager','/usr/share/n4d/python-plugins/NfsManager.py').NfsManager().fix_async()" || true # let's not restart nfs server for now fi fi fi if dpkg --compare-versions "$2" lt 0.4; then EXPORTS_FILE="/etc/exports.d/net.exports" if [ -e "$EXPORTS_FILE" ]; then rc=0 grep "no_root_squash" "$EXPORTS_FILE" 1> /dev/null || rc=1 if [ $rc -eq 1 ]; then python -c "import imp;imp.load_source('NfsManager','/usr/share/n4d/python-plugins/NfsManager.py').NfsManager().fix_missing_no_root_squash()" exportfs -ra || true fi fi fi if dpkg --compare-versions "$2" lt 0.5; then SYSTEMD_FILE="/lib/systemd/system/net-server\x2dsync.mount" NEW_OPTIONS="Options = rw,hard,intr,nosuid,nfsvers=3" if [ -e "$SYSTEMD_FILE" ]; then rc=0 grep "nfsvers" "$SYSTEMD_FILE" 1> /dev/null || rc=1 if [ $rc -eq 1 ]; then echo "Fixing net-server sync systemd unit..." sed -i "s/^Options.*/$NEW_OPTIONS/g" $SYSTEMD_FILE systemctl daemon-reload || true systemctl restart net-server\\x2dsync.mount || true fi fi fi ;; 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