ce8d59b24d2e3e1c6dadb26f73993f12bdb2cdd1
[nfs-utils.git] / debian / nfs-common.postinst
1 #!/bin/sh -e
2
3 #DEBHELPER#
4
5 case "$1" in
6     configure)
7         update-rc.d nfs-common defaults 21 79 >/dev/null
8
9         if ! getent passwd statd >/dev/null; then
10             adduser --system --home /var/lib/nfs --no-create-home statd
11         fi
12         if dpkg --compare-versions "$2" ge 1:1.0.7-10 && dpkg --compare-versions "$2" lt 1:1.0.7-13; then
13             usermod --home /var/lib/nfs statd || true
14             if [ -d /home/statd ]; then
15                 rmdir --ignore-fail-on-non-empty /home/statd
16             fi
17         fi
18         if [ "$2" = "" ] || dpkg --compare-versions "$2" lt 1:1.0.7-13; then
19             chown statd /var/lib/nfs/sm \
20                 /var/lib/nfs/sm.bak \
21                 /var/lib/nfs/state \
22                 /var/lib/nfs/rpc_pipefs
23         fi
24     ;;
25 esac
26
27 act="restart"
28 [ "$1:$2" = "configure:" ] && act="start"
29 invoke-rc.d nfs-common $act