diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-03-13 12:44:46 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2015-03-13 12:44:46 +0000 |
commit | 286c4906d60f90d4e4cf06b6af00a03f7767f886 (patch) | |
tree | 7fbd17f4a9fe8d40add1703bef923576bf8c9f60 /etc | |
parent | 52df29e6a52fefd39b9ad2ea70e9a1bd5a77c50a (diff) | |
download | src-286c4906d60f90d4e4cf06b6af00a03f7767f886.tar.gz src-286c4906d60f90d4e4cf06b6af00a03f7767f886.zip |
Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Notes
Notes:
svn path=/head/; revision=279955
Diffstat (limited to 'etc')
-rw-r--r-- | etc/auto_master | 1 | ||||
-rw-r--r-- | etc/autofs/Makefile | 2 | ||||
-rwxr-xr-x | etc/autofs/special_noauto | 29 |
3 files changed, 31 insertions, 1 deletions
diff --git a/etc/auto_master b/etc/auto_master index 0083b1824bc0..255b7f861b84 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 3aa7e0307a74..6d1c9e85d30b 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 000000000000..219ec7ea6994 --- /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 + |