xref: /netbsd-src/external/bsd/am-utils/dist/scripts/fixrmtab.in (revision 8bae5d409deb915cf7c8f0539fae22ff2cb8a313)
1a53f50b9Schristos#!/bin/sh
2a53f50b9Schristos#
3a53f50b9Schristos# Invalidate /etc/rmtab entries for hosts named.
4a53f50b9Schristos# Restart mountd for changes to take effect.
5a53f50b9Schristos#
6a53f50b9Schristos# usage: fixrmtab host1 host2 ...
7a53f50b9Schristos#
8a53f50b9Schristos# Package:	am-utils-6.x
9a53f50b9Schristos# Author:	Andreas Stolcke <stolcke@icsi.berkeley.edu>
10a53f50b9Schristos
11a53f50b9Schristos#set -x
12a53f50b9Schristos
13*8bae5d40Schristos# allow user to pass RMTAB file name from environment
14*8bae5d40Schristosif test -z "${RMTAB}" ; then
15a53f50b9Schristos	RMTAB=/etc/rmtab
16*8bae5d40Schristosfi
17a53f50b9Schristos
18*8bae5d40Schristosif [ ! -f "$RMTAB" ]; then
19a53f50b9Schristos	exit 0
20a53f50b9Schristosfi
21a53f50b9Schristos
22*8bae5d40SchristosTMP="$(mktemp ${RMTAB}.XXXXXX)"
23*8bae5d40Schristosif [ -z "$TMP" ]; then
24*8bae5d40Schristos	exit 1
25*8bae5d40Schristosfi
26*8bae5d40Schristos
27*8bae5d40Schristostrap "rm -f $TMP" 0 1 2 3 15
28*8bae5d40Schristos
29*8bae5d40Schristosfor host
30a53f50b9Schristosdo
31*8bae5d40Schristos	sed -e "/^$host:/s/^./#/" "$RMTAB" > "$TMP" && cp "$TMP" "$RMTAB"
32a53f50b9Schristosdone
33