]> git.decadent.org.uk Git - nfs-utils.git/blob - debian/nfs-common.postinst
654a5835b8e950011259e82bfbf911aeade651f6
[nfs-utils.git] / debian / nfs-common.postinst
1 #!/bin/sh -e
2
3 #DEBHELPER#
4
5 case "$1" in
6     configure)
7         ucf --three-way /usr/share/nfs-common/conffiles/idmapd.conf /etc/idmapd.conf
8         ucf --three-way /usr/share/nfs-common/conffiles/nfs-common.default /etc/default/nfs-common
9
10         if [ "$2" != "" ] && dpkg --compare-versions "$2" lt 1:1.1.0-10; then
11             update-rc.d -f nfs-common remove >/dev/null
12         fi
13         update-rc.d nfs-common start 20 2 3 4 5 . stop 20 0 1 6 . start 44 S . >/dev/null
14
15         if ! getent passwd statd >/dev/null; then
16             adduser --system --home /var/lib/nfs --no-create-home statd
17         fi
18         if dpkg --compare-versions "$2" ge 1:1.0.7-10 && dpkg --compare-versions "$2" lt 1:1.0.7-13; then
19             usermod --home /var/lib/nfs statd || true
20             if [ -d /home/statd ]; then
21                 rmdir --ignore-fail-on-non-empty /home/statd
22             fi
23         fi
24         if [ "$2" = "" ] || dpkg --compare-versions "$2" lt 1:1.0.7-16; then
25             chown statd /var/lib/nfs/sm \
26                 /var/lib/nfs/sm.bak \
27                 /var/lib/nfs/rpc_pipefs \
28                 /var/lib/nfs
29             if [ -f /var/lib/nfs/state ]; then
30                 chown statd /var/lib/nfs/state
31             fi
32         fi
33         
34         if [ "$2" != "" ] || dpkg --compare-versions "$2" lt 1:1.1.0-14; then
35             if dpkg-statoverride --list /sbin/mount.nfs >/dev/null 2>&1; then
36                 dpkg-statoverride --remove /sbin/mount.nfs
37             fi
38         fi
39     ;;
40 esac
41
42 act="restart"
43 [ "$1:$2" = "configure:" ] && act="start"
44 invoke-rc.d nfs-common $act