File: nfs-common.postinst

package info (click to toggle)
nfs-utils 1%3A2.6.2-4%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,144 kB
  • sloc: ansic: 49,497; sh: 5,200; python: 2,385; makefile: 933
file content (46 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

set -e

case "$1" in
    configure)
        ucf --three-way /usr/share/nfs-common/conffiles/idmapd.conf /etc/idmapd.conf
        ucf --three-way /usr/share/nfs-common/conffiles/nfs-common.default /etc/default/nfs-common
        ucf --three-way /usr/share/nfs-common/conffiles/nfs.conf /etc/nfs.conf

        if ! getent passwd statd >/dev/null; then
            adduser --system --home /var/lib/nfs --no-create-home statd
        fi

        # Don't make /var/lib/nfs owned by statd. Only sm and sm.bak need to be
        # accessible by statd or sm-notify after they drop privileges.
        # https://bugs.debian.org/940848 (CVE-2019-3689)
        if dpkg --compare-versions "$2" lt 1:1.3.4-3; then
                chown root:root /var/lib/nfs
        fi
        chown statd: /var/lib/nfs/sm \
            /var/lib/nfs/sm.bak
        if [ -f /var/lib/nfs/state ]; then
            chown statd /var/lib/nfs/state
        fi

	# Convert default files to /etc/nfs.conf.d/local.conf if they
	# have been modified
	if dpkg --compare-versions "$2" lt 1:2.6.1-1~exp2 &&
	   ! md5sum --status --ignore-missing -c <<EOF
ddcb1fbb90a14ff9850f22eed0127a10  /etc/default/nfs-common
fa4e0530df26499ca3940353fbfbf241  /etc/default/nfs-kernel-server
EOF
	then
	    mkdir -p /etc/nfs.conf.d
	    /usr/share/nfs-common/nfsconvert.py
	fi

	# Remove obsolete symlinks for sysvinit runlevels 2-5
	if dpkg --compare-versions "$2" lt 1:2.6.1-2~; then
	    update-rc.d -f nfs-common remove
	fi
    ;;
esac

#DEBHELPER#