File: diff

package info (click to toggle)
autofs 3.1.4-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 416 kB
  • ctags: 291
  • sloc: ansic: 2,941; sh: 323; makefile: 164
file content (86 lines) | stat: -rw-r--r-- 1,876 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--- /etc/init.d/autofs	Thu Jul  6 19:52:59 2000
+++ rc.autofs	Sun Jul 16 19:53:35 2000
@@ -70,7 +70,11 @@
 #
 function getmounts()
 {
-    getmounts_file /etc/auto.master
+    if ! getmounts_file /etc/auto.master; then
+	if ! getnismounts auto.master; then
+	    echo "no autofs mounts configured!"
+	fi
+    fi
 }
 
 function getmounts_file()
@@ -93,6 +97,7 @@
     local line_options="$@" daemon_options
     while read dir map options
     do
+	options="$line_options $options"
 	case "$dir" in
 	    +*)	getnismounts "${dir/+/}" $map $options
 		continue;
@@ -111,14 +116,14 @@
 	    else
 		type=yp
 	    fi
-	    daemon_options=`echo " $line_options " | sed -e 's/ \(-[^-][^ ]*\)//g'`
-	    line_options=`echo " $line_options " | sed -e 's/ \(--[^ ]*\)//g;s/ -\([^ ]*\)/\1/g'`
+	    daemon_options=`munge_options daemon $options`
+	    options=`munge_options mount $options`
 	    if [ -n "$daemon_options" ]; then
 		daemon_options="$daemon_options "
 	    fi
 
 	    if [ "$type" ]; then
-		echo "$DAEMON $daemon_options-- $dir $type $map $local_options $line_options"
+		echo "$DAEMON $daemon_options-- $dir $type $map $local_options $options"
 	    fi
 	fi
     done
@@ -163,6 +168,44 @@
     echo "Active Mount Points:"
     echo "--------------------"
     active
+}
+
+function munge_options()
+{
+	local which="$1"
+	shift
+	echo "$@" | awk -v which="$which" '
+BEGIN {
+	RS="[, \n-]"
+	FS="="
+	daemon_opts[ "timeout" ] = "timeout"
+	daemon_opts[ "t" ] = "timeout"
+}
+{
+	if ( $0 ~ /^$/ )
+		next
+	if ( $1 in daemon_opts ) {
+		daemon[ daemon_opts[ $1 ] ] = $2
+	} else {
+		mount[$0] = 1
+	}
+}
+END {
+	if ( which ~ "^daemon$" ) {
+		if ( daemon["timeout"] ) {
+			printf "--timeout=%s\n", daemon["timeout"]
+		}
+	} else {
+		for ( a in mount ) {
+			if ( length( out ) )
+				out=out "," a
+			else
+				out=a
+		}
+		printf "%s\n", out
+	}
+}
+'
 }
 
 #