]> git.decadent.org.uk Git - nfs-utils.git/blob - debian/nfs-common.postinst
866c066186302b3ee5bd454dbdacd3d3e2afdf82
[nfs-utils.git] / debian / nfs-common.postinst
1 #!/bin/sh
2
3 set -e
4
5 #DEBHELPER#
6
7 case "$1" in
8     configure)
9         ucf --three-way /usr/share/nfs-common/conffiles/idmapd.conf /etc/idmapd.conf
10         ucf --three-way /usr/share/nfs-common/conffiles/nfs-common.default /etc/default/nfs-common
11
12         if [ "$2" != "" ] && dpkg --compare-versions "$2" lt 1:1.1.0-10; then
13             update-rc.d -f nfs-common remove >/dev/null
14         fi
15         update-rc.d nfs-common start 20 2 3 4 5 . stop 20 0 1 6 . start 44 S . >/dev/null
16
17         if ! getent passwd statd >/dev/null; then
18             adduser --system --home /var/lib/nfs --no-create-home statd
19         fi
20         if dpkg --compare-versions "$2" ge 1:1.0.7-10 && dpkg --compare-versions "$2" lt 1:1.0.7-13; then
21             usermod --home /var/lib/nfs statd || true
22             if [ -d /home/statd ]; then
23                 rmdir --ignore-fail-on-non-empty /home/statd
24             fi
25         fi
26
27         chown statd: /var/lib/nfs/sm \
28             /var/lib/nfs/sm.bak \
29             /var/lib/nfs
30         if [ -f /var/lib/nfs/state ]; then
31             chown statd /var/lib/nfs/state
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         # Migrate /lib/init/rw/sendsigs.omit.statd to /run.
41         if [ -f /lib/init/rw/sendsigs.omit.d/statd ]; then 
42             mv /lib/init/rw/sendsigs.omit.d/statd /run/sendsigs.omit.d/statd
43         fi
44     ;;
45 esac
46
47 act="restart"
48 [ "$1:$2" = "configure:" ] && act="start"
49 invoke-rc.d nfs-common $act