source: n4d-nfs/trunk/fuentes/debian/postinst

Last change on this file was 7264, checked in by hectorgh, 22 months ago

adding or true and an echo to inform the user export options are being modified

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#!/bin/sh
2# postinst script for n4d-ldap
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20
21case "$1" in
22    configure)
23
24
25        n4d-modules enable-plugin /etc/n4d/conf.d/NfsManager || true
26
27        if dpkg --compare-versions "$2" lt 0.6.5; then
28                EXPORTS_FILE="/etc/exports.d/net.exports"
29                if [ -e "$EXPORTS_FILE" ]; then
30                        rc=0
31                        grep "async" "$EXPORTS_FILE" 1> /dev/null || rc=1
32                        if [ $rc -eq 1  ]; then
33                                echo "[NfsManager] Replacing sync with async in export options..."
34                                python -c "import imp;imp.load_source('NfsManager','/usr/share/n4d/python-plugins/NfsManager.py').NfsManager().fix_async()" || true
35                                # let's not restart nfs server for now
36                        fi
37                fi
38
39        fi
40
41
42        if dpkg --compare-versions "$2" lt 0.4; then
43                EXPORTS_FILE="/etc/exports.d/net.exports"
44                if [ -e "$EXPORTS_FILE" ]; then
45                        rc=0
46                        grep "no_root_squash" "$EXPORTS_FILE" 1> /dev/null || rc=1
47                        if [ $rc -eq 1  ]; then
48                                python -c "import imp;imp.load_source('NfsManager','/usr/share/n4d/python-plugins/NfsManager.py').NfsManager().fix_missing_no_root_squash()"
49                                exportfs -ra || true
50                        fi
51                fi
52
53        fi
54
55        if dpkg --compare-versions "$2" lt 0.5; then
56                SYSTEMD_FILE="/lib/systemd/system/net-server\x2dsync.mount"
57                NEW_OPTIONS="Options = rw,hard,intr,nosuid,nfsvers=3"
58                if [ -e "$SYSTEMD_FILE" ]; then
59                        rc=0
60                        grep "nfsvers" "$SYSTEMD_FILE" 1> /dev/null || rc=1
61                        if [ $rc -eq 1 ]; then
62                                echo "Fixing net-server sync systemd unit..."
63                                sed -i "s/^Options.*/$NEW_OPTIONS/g" $SYSTEMD_FILE
64                                systemctl daemon-reload || true
65                                systemctl restart net-server\\x2dsync.mount || true
66                        fi
67                fi
68        fi
69
70        ;;
71
72
73    abort-upgrade|abort-remove|abort-deconfigure)
74    ;;
75
76    *)
77        echo "postinst called with unknown argument \`$1'" >&2
78        exit 1
79    ;;
80esac
81
82# dh_installdeb will replace this with shell code automatically
83# generated by other debhelper scripts.
84
85#DEBHELPER#
86
87exit 0
Note: See TracBrowser for help on using the repository browser.