freebsd-nq/contrib/amd/scripts/fixrmtab.in

33 lines
557 B
Plaintext
Raw Normal View History

1998-11-14 03:11:37 +00:00
#!/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
1998-11-14 03:11:37 +00:00
# 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
1998-11-14 03:11:37 +00:00
if [ ! -f "$RMTAB" ]; then
1998-11-14 03:11:37 +00:00
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
1998-11-14 03:11:37 +00:00
do
sed -e "/^$host:/s/^./#/" "$RMTAB" > "$TMP" && cp "$TMP" "$RMTAB"
1998-11-14 03:11:37 +00:00
done