summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-05-21 13:42:37 +0000
committertrasz <trasz@FreeBSD.org>2015-05-21 13:42:37 +0000
commitdf07ae934badb6dfd9eae100255fb6b85b28e20c (patch)
tree52fa51ead684722dd412c37753187c4a59e65199
parent792cf9363b321087fc99f20d2f47f07354761498 (diff)
downloadFreeBSD-src-df07ae934badb6dfd9eae100255fb6b85b28e20c.zip
FreeBSD-src-df07ae934badb6dfd9eae100255fb6b85b28e20c.tar.gz
MFC r279955:
Add -noauto autofs map, for automatic handling of fstab entries marked "noauto". Relnotes: yes Sponsored by: The FreeBSD Foundation
-rw-r--r--etc/auto_master1
-rw-r--r--etc/autofs/Makefile2
-rwxr-xr-xetc/autofs/special_noauto29
-rw-r--r--usr.sbin/autofs/auto_master.57
4 files changed, 37 insertions, 2 deletions
diff --git a/etc/auto_master b/etc/auto_master
index 0083b18..255b7f8 100644
--- a/etc/auto_master
+++ b/etc/auto_master
@@ -6,3 +6,4 @@
# When using the -media special map, make sure to edit devd.conf(5)
# to move the call to "automount -c" out of the comments section.
#/media -media -nosuid
+#/- -noauto
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
+
diff --git a/usr.sbin/autofs/auto_master.5 b/usr.sbin/autofs/auto_master.5
index 5aa389e..89100f7 100644
--- a/usr.sbin/autofs/auto_master.5
+++ b/usr.sbin/autofs/auto_master.5
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 9, 2015
+.Dd March 13, 2015
.Dt AUTO_MASTER 5
.Os
.Sh NAME
@@ -260,6 +260,11 @@ when they are automatically created.
.It Li -media
Query devices that are not yet mounted, but contain valid filesystems.
Generally used to access files on removable media.
+.It Li -noauto
+Mount filesystems configured in
+.Xr fstab 5
+as "noauto".
+This needs to be set up as a direct map.
.It Li -null
Prevent
.Xr automountd 8
OpenPOWER on IntegriCloud