1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00
freebsd/etc/autofs/special_hosts
Edward Tomasz Napierala e299e01f56 Make the autofs(5) -hosts map more robust, primarily to make it correctly
handle NFS shares containing whitespace. This also adds the -E parameter
to showmount(8).

Reviewed by:	emaste@, jhibbits@, wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5649
2016-03-23 12:13:53 +00:00

18 lines
302 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
if [ $# -eq 0 ]; then
out=`getent hosts`
[ $? -eq 0 ] || exit 1
echo "$out" | awk '{ print $2 }' | sort -u
exit 0
fi
out=`showmount -E "$1"`
[ $? -eq 0 ] || exit 1
echo "$out" | awk -v host="$1" \
'{ printf "\"%s\"\t\"%s:%s\" ", $0, host, $0 } END { printf "\n" }'