~ubuntu-branches/ubuntu/precise/nfs-utils/precise-proposed

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
# idmapd - NFSv4 id <-> name mapper

# rpc.idmapd is the NFSv4 ID <-> name mapping daemon.  It provides
# functionality to the NFSv4 kernel client and server, to which it
# communicates via upcalls, by translating user and group IDs to names, and
# vice versa.

description	"NFSv4 id <-> name mapper"
author		"Steve Langasek <steve.langasek@canonical.com>"

start on (local-filesystems or mounting TYPE=nfs4)
stop on runlevel [06]

expect fork
respawn

env PIPEFS_MOUNTPOINT=/run/rpc_pipefs

pre-start script
	do_modprobe() {
		modprobe -q "$1" || true
	}

	do_modprobe nfs
	do_modprobe nfsd

	do_modprobe sunrpc

	if ! mountpoint -q "$PIPEFS_MOUNTPOINT"
	then
		mkdir -p "$PIPEFS_MOUNTPOINT"
		mount -t rpc_pipefs rpc_pipefs "$PIPEFS_MOUNTPOINT" || true
	fi
end script

exec rpc.idmapd

post-stop script
	if mountpoint -q "$PIPEFS_MOUNTPOINT"
	then
		# ignore any failures caused by the filesystem still
		# being in use
		umount "$PIPEFS_MOUNTPOINT" || true
	fi
end script