freebsd-dev/contrib/amd/scripts/fixrmtab.in
Cy Schubert 449287a2a5 MFV r305100: Update amd from am-utils 6.1.5 to 6.2.
Used extensively on my network over the past month.

Reviewed by:	pfg, brooks
Suggested by:	pfg
Obtained from:	ftp://ftp.am-utils.org/pub/am-utils/
MFC after:	6 weeks
Relnotes:	yes
Differential Revision:	D8405
2016-11-11 02:42:53 +00:00

33 lines
557 B
Bash
Executable File

#!/bin/sh
#
# Invalidate /etc/rmtab entries for hosts named.
# Restart mountd for changes to take effect.
#
# usage: fixrmtab host1 host2 ...
#
# Package: am-utils-6.x
# Author: Andreas Stolcke <stolcke@icsi.berkeley.edu>
#set -x
# allow user to pass RMTAB file name from environment
if test -z "${RMTAB}" ; then
RMTAB=/etc/rmtab
fi
if [ ! -f "$RMTAB" ]; then
exit 0
fi
TMP="$(mktemp ${RMTAB}.XXXXXX)"
if [ -z "$TMP" ]; then
exit 1
fi
trap "rm -f $TMP" 0 1 2 3 15
for host
do
sed -e "/^$host:/s/^./#/" "$RMTAB" > "$TMP" && cp "$TMP" "$RMTAB"
done