freebsd-dev/etc/autofs/special_noauto
Edward Tomasz Napierala 286c4906d6 Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 12:44:46 +00:00

30 lines
405 B
Bash
Executable File

#!/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