MFC r279955:

Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".

Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
trasz 2015-05-21 13:42:37 +00:00
parent 792cf9363b
commit df07ae934b
4 changed files with 37 additions and 2 deletions

View File

@ -6,3 +6,4 @@
# When using the -media special map, make sure to edit devd.conf(5) # 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. # to move the call to "automount -c" out of the comments section.
#/media -media -nosuid #/media -media -nosuid
#/- -noauto

View File

@ -1,6 +1,6 @@
# $FreeBSD$ # $FreeBSD$
FILES= include_ldap special_hosts special_media special_null FILES= include_ldap special_hosts special_media special_noauto special_null
NO_OBJ= NO_OBJ=
FILESDIR= /etc/autofs FILESDIR= /etc/autofs

29
etc/autofs/special_noauto Executable file
View File

@ -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

View File

@ -27,7 +27,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 9, 2015 .Dd March 13, 2015
.Dt AUTO_MASTER 5 .Dt AUTO_MASTER 5
.Os .Os
.Sh NAME .Sh NAME
@ -260,6 +260,11 @@ when they are automatically created.
.It Li -media .It Li -media
Query devices that are not yet mounted, but contain valid filesystems. Query devices that are not yet mounted, but contain valid filesystems.
Generally used to access files on removable media. 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 .It Li -null
Prevent Prevent
.Xr automountd 8 .Xr automountd 8