xref: /onnv-gate/usr/src/cmd/bnu/Teardown (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!/usr/bin/sh
2*0Sstevel@tonic-gate#
3*0Sstevel@tonic-gate# CDDL HEADER START
4*0Sstevel@tonic-gate#
5*0Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*0Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*0Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*0Sstevel@tonic-gate# with the License.
9*0Sstevel@tonic-gate#
10*0Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*0Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*0Sstevel@tonic-gate# See the License for the specific language governing permissions
13*0Sstevel@tonic-gate# and limitations under the License.
14*0Sstevel@tonic-gate#
15*0Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*0Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*0Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*0Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*0Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*0Sstevel@tonic-gate#
21*0Sstevel@tonic-gate# CDDL HEADER END
22*0Sstevel@tonic-gate#
23*0Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"	/* from SVR4 bnu:Teardown 1.5 */
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gateexport IFS PATH
26*0Sstevel@tonic-gateIFS="
27*0Sstevel@tonic-gate"
28*0Sstevel@tonic-gatePATH="/usr/bin"
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gate#
31*0Sstevel@tonic-gate#	This shell tries to convert uucp from the QFT format back to the
32*0Sstevel@tonic-gate#	the regular HoneyDanBer format and removes all sub directories
33*0Sstevel@tonic-gate#	that created while running the QFT version of uucp.
34*0Sstevel@tonic-gate#
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gateecho "Converting uucp from QFT Format back to HoneyDanBer format\n"
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gateSPOOL=/var/spool/uucp
39*0Sstevel@tonic-gate#	chdir to remote spool directory
40*0Sstevel@tonic-gatecd $SPOOL
41*0Sstevel@tonic-gateif [ `pwd` != "$SPOOL" ]
42*0Sstevel@tonic-gatethen
43*0Sstevel@tonic-gate	echo "CAN'T cd to $SPOOL"
44*0Sstevel@tonic-gate	echo "$0 failed."
45*0Sstevel@tonic-gate	exit 0
46*0Sstevel@tonic-gatefi
47*0Sstevel@tonic-gatefor d in */?
48*0Sstevel@tonic-gatedo
49*0Sstevel@tonic-gate#	chdir to grade directories of the remote
50*0Sstevel@tonic-gate	cd $d
51*0Sstevel@tonic-gate	if [ "$?" = 0 ]
52*0Sstevel@tonic-gate	then
53*0Sstevel@tonic-gate#	   move everything to parent (machine) directory
54*0Sstevel@tonic-gate	   find . -print | cpio -pdvm ..
55*0Sstevel@tonic-gate	   if [ "$?" = 0 ]
56*0Sstevel@tonic-gate	   then
57*0Sstevel@tonic-gate#		now remove everything in this directory
58*0Sstevel@tonic-gate		rm -rf *
59*0Sstevel@tonic-gate	   fi
60*0Sstevel@tonic-gate	   cd $SPOOL
61*0Sstevel@tonic-gate#	   if grade directory is now empty, remove it.
62*0Sstevel@tonic-gate	   rmdir $d
63*0Sstevel@tonic-gate	fi
64*0Sstevel@tonic-gatedone >/dev/null 2>&1
65