svn commit: r279955 - in head: etc etc/autofs usr.sbin/autofs
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Mar 13 12:44:48 UTC 2015
Author: trasz
Date: Fri Mar 13 12:44:46 2015
New Revision: 279955
URL: https://svnweb.freebsd.org/changeset/base/279955
Log:
Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Added:
head/etc/autofs/special_noauto (contents, props changed)
Modified:
head/etc/auto_master
head/etc/autofs/Makefile
head/usr.sbin/autofs/auto_master.5
Modified: head/etc/auto_master
==============================================================================
--- head/etc/auto_master Fri Mar 13 12:27:59 2015 (r279954)
+++ head/etc/auto_master Fri Mar 13 12:44:46 2015 (r279955)
@@ -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
Modified: head/etc/autofs/Makefile
==============================================================================
--- head/etc/autofs/Makefile Fri Mar 13 12:27:59 2015 (r279954)
+++ head/etc/autofs/Makefile Fri Mar 13 12:44:46 2015 (r279955)
@@ -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
Added: head/etc/autofs/special_noauto
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/etc/autofs/special_noauto Fri Mar 13 12:44:46 2015 (r279955)
@@ -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
+
Modified: head/usr.sbin/autofs/auto_master.5
==============================================================================
--- head/usr.sbin/autofs/auto_master.5 Fri Mar 13 12:27:59 2015 (r279954)
+++ head/usr.sbin/autofs/auto_master.5 Fri Mar 13 12:44:46 2015 (r279955)
@@ -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
More information about the svn-src-all
mailing list