xref: /titanic_50/usr/src/cmd/bnu/Cvt (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
1#!/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 1988 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#ident	"%Z%%M%	%I%	%E% SMI"
28
29# NOTE:	This script has probably outlived its usefulness, but in
30#	case it hasn't, it still references "old" pathnames,
31#	allowing it to work on any system.
32
33#	execute this as root and in the /usr/spool/uucp directory.
34#	execute
35#	    Cvt
36#	This will create required directories and move the
37#	C. and D. files to the proper place.
38#
39#	use this after running the SetUp script.
40#
41#	use -n option to tell what will be done, but without doing it
42#
43# NOTE!!
44#	It does not take care of X. files yet.
45
46set +e
47SPOOL=/usr/spool/uucp
48TMP=/tmp/CVT
49
50NC=`ls $SPOOL/C. | grep -c "^C."`
51if [ $NC -eq 0 ]
52then
53  echo "There are no old C. files in /usr/spool/uucp/C."
54  echo "exiting"
55  exit
56fi
57
58echo "
59This shell (Cvt) will attempt to take the old C. and D. files
60that are in $SPOOL and put them in the proper directories for
61the new version of uucp.
62
63If the files are not moved, they will never get executed after the
64new uucp is installed.
65
66There are $NC C. files in $SPOOL.
67
68Do you wish to continue (Type y to continue)? \
69\c"
70
71read A
72if [ x$A != "xy" ]; then exit; fi
73
74while [ $# -gt 0 ]
75do
76	case $1 in
77	-n)	ECHO=echo
78		shift
79		;;
80
81	*)	break
82		;;
83
84	esac
85done
86
87cd $SPOOL/C.
88for i in C*
89do
90# S is the 6 character system name
91# E is the last 5 characters of C. name
92
93  echo Processing: $i
94  S=`echo $i | sed "s/..\(.*\)....../\1/"`
95  E=`echo $i | sed "s/.*\(.....\)/\1/"`
96  DIR=
97  DIR=`uuname | grep "^$S"`
98  if [ -z "$DIR" ]
99  then
100	echo "*****Warning: There is no system=$S in the /etc/uucp/Systems file. ******"
101	DIR=$S
102  fi
103  DIR=`echo $DIR | sed "s/ .*//"`
104  if [ ! -d $SPOOL/$DIR ]
105	then
106	    $ECHO  mkdir $SPOOL/$DIR
107	    $ECHO  chmod 755 $SPOOL/$DIR
108	    $ECHO  chown uucp $SPOOL/$DIR
109  fi
110
111    cat $i | while read AA ; do
112	D=`echo $AA | cut -d" " -f6`
113	if [ -n "$D" -a -f "$SPOOL/D./$D" ]
114	    then $ECHO mv $SPOOL/D./$D $SPOOL/$DIR/$D
115	elif [ -n "$D" -a -f "$SPOOL/D.`uuname -l`/$D" ]
116	    then $ECHO mv $SPOOL/D.`uuname -l`/$D $SPOOL/$DIR/$D
117	fi
118    done
119    S=`echo $DIR | sed "s/\(.......\).*/\1/"`
120    $ECHO mv $i $SPOOL/$DIR/C.$S$E
121
122done
123