summaryrefslogtreecommitdiffstats
path: root/etc/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-03-13 12:44:46 +0000
committertrasz <trasz@FreeBSD.org>2015-03-13 12:44:46 +0000
commit7d384a730d948641100cfd48e162ca4e46dcf75e (patch)
tree7fbd17f4a9fe8d40add1703bef923576bf8c9f60 /etc/autofs
parent712aeceb146987c92c7c68a844428d1fb9d782ae (diff)
downloadFreeBSD-src-7d384a730d948641100cfd48e162ca4e46dcf75e.zip
FreeBSD-src-7d384a730d948641100cfd48e162ca4e46dcf75e.tar.gz
Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto". MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc/autofs')
-rw-r--r--etc/autofs/Makefile2
-rwxr-xr-xetc/autofs/special_noauto29
2 files changed, 30 insertions, 1 deletions
diff --git a/etc/autofs/Makefile b/etc/autofs/Makefile
index 3aa7e03..6d1c9e8 100644
--- a/etc/autofs/Makefile
+++ b/etc/autofs/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-FILES= include_ldap special_hosts special_media special_null
+FILES= include_ldap special_hosts special_media special_noauto special_null
NO_OBJ=
FILESDIR= /etc/autofs
diff --git a/etc/autofs/special_noauto b/etc/autofs/special_noauto
new file mode 100755
index 0000000..219ec7e
--- /dev/null
+++ b/etc/autofs/special_noauto
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+print_available() {
+ sed 's/#.*//' /etc/fstab | awk '$4 ~ /noauto/ { print $2 }'
+}
+
+print_one() {
+ local _mntpoint
+
+ _mntpoint="${1%/}"
+
+ sed 's/#.*//' /etc/fstab | awk '
+ $2 == "'"${_mntpoint}"'" && $4 ~ /noauto/ {
+ if ($1 ~ /:/) { dev=$1 } else { dev=":"$1 }
+ print "-fstype=" $3 "," $4, dev
+ }'
+}
+
+if [ $# -eq 0 ]; then
+ print_available
+ exit 0
+fi
+
+print_one "$1"
+exit 0
+
OpenPOWER on IntegriCloud