Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
 
3
# This file must be executable to work! chmod 755!
4
 
5
# Look at what a host is exporting to determine what we can mount.
6
# This is very simple, but it appears to work surprisingly well
7
 
8
key="$1"
9
 
10
# add "nosymlink" here if you want to suppress symlinking local filesystems
11
# add "nonstrict" to make it OK for some filesystems to not mount
12
opts="-fstype=nfs,hard,intr,nodev,nosuid"
13
 
14
# Showmount comes in a number of names and varieties.  "showmount" is
15
# typically an older version which accepts the '--no-headers' flag
16
# but ignores it.  "kshowmount" is the newer version installed with knfsd,
17
# which both accepts and acts on the '--no-headers' flag.
18
#SHOWMOUNT="kshowmount --no-headers -e $key"
19
#SHOWMOUNT="showmount -e $key | tail -n +2"
20
 
21
for P in /bin /sbin /usr/bin /usr/sbin
22
do
23
	for M in showmount kshowmount
24
	do
25
		if [ -x $P/$M ]
26
		then
27
			SMNT=$P/$M
28
			break
29
		fi
30
	done
31
done
32
 
33
[ -x $SMNT ] || exit 1
34
 
35
# Newer distributions get this right
36
SHOWMOUNT="$SMNT --no-headers -e $key"
37
 
38
$SHOWMOUNT | LC_ALL=C cut -d' ' -f1 | LC_ALL=C sort -u | \
39
	awk -v key="$key" -v opts="$opts" -- '
40
	BEGIN	{ ORS=""; first=1 }
41
		{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
42
	END	{ if (!first) print "\n"; else exit 1 }
43
	' | sed 's/#/\\#/g'