Gentoo Archives: gentoo-dev

From: Nicolas Bonnefon <nickobnf@×××××××.com>
To: gentoo-dev@g.o
Subject: [gentoo-dev] Autodetecting NFS maps with autofs
Date: Sat, 10 May 2003 19:40:16
Message-Id: b9j0d0$1hs$1@main.gmane.org
1 Hi everybody!
2
3 I'm trying to use the executable (shell script) map from debian for
4 autofs. This script autodetects exported filesystems on a remote host.
5 But I can't get it to work on my gentoo box.
6
7 Here is the messages i've got from /var/log/messages when i try to 'ls
8 /var/autofs/net/outerspace/home': (outerspace is the remote box)
9
10 May 10 15:50:19 blackbox automount[60]: attempting to mount entry
11 /var/autofs/net/outerspace
12 May 10 15:50:19 blackbox automount[1567]: lookup(program): looking up
13 outerspace
14 May 10 15:50:19 blackbox automount[1567]: lookup(program): outerspace ->
15 -fstype=nfs,hard,intr,nodev,nosuid /home outerspace:/home /tmp
16 outerspace:/tmp
17 May 10 15:50:19 blackbox automount[1567]: expanded entry:
18 -fstype=nfs,hard,intr,nodev,nosuid /home outerspace:/home /tmp
19 outerspace//tmp
20 May 10 15:50:19 blackbox automount[1567]: parse(sun): gathered options:
21 fstype=nfs,hard,intr,nodev,nosuid
22 May 10 15:50:19 blackbox automount[1567]: parse(sun): entry outerspace
23 is a multipath entry
24
25
26 This is the script I use (/etc/autofs/auto.net):
27
28 #!/bin/sh
29
30 # Look at what a host is exporting to determine what we can mount.
31 # This is very simple, but it appears to work surprisingly well
32
33 key="$1"
34
35 opts="-fstype=nfs,hard,intr,nodev,nosuid"
36
37
38 # Newer distributions get this right
39 SHOWMOUNT="/usr/sbin/showmount --no-headers -e $key"
40
41 $SHOWMOUNT | sort +0 | \
42 awk -v key="$key" -v opts="$opts" -- '
43 BEGIN { ORS=""; first=1 }
44 { if (first) { print opts; first=0 }; print "
45 \t" $1, key ":" $1 }
46 END { if (!first) print "\n"; else exit 1 }
47 '
48
49
50 Do we need a patched version of autofs to handle these generated maps?
51 Does anybody have experience with this?
52 The manpage for autofs(5) seems to tell it should work this way....
53
54
55 --
56 Nicolas Bonnefon
57
58
59
60 --
61 gentoo-dev@g.o mailing list