3124 Remove any existing references to utmp, use utmpx instead
[unleashed.git] / usr / src / cmd / bnu / Cvt
blob7d5112e9f5939cb46aa9e8e373e77161d8a04cf4
1 #!/bin/sh
3 # CDDL HEADER START
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.
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.
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]
21 # CDDL HEADER END
24 # Copyright 1988 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #ident "%Z%%M% %I% %E% SMI"
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.
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.
39 # use this after running the SetUp script.
41 # use -n option to tell what will be done, but without doing it
43 # NOTE!!
44 # It does not take care of X. files yet.
46 set +e
47 SPOOL=/usr/spool/uucp
48 TMP=/tmp/CVT
50 NC=`ls $SPOOL/C. | grep -c "^C."`
51 if [ $NC -eq 0 ]
52 then
53 echo "There are no old C. files in /usr/spool/uucp/C."
54 echo "exiting"
55 exit
58 echo "
59 This shell (Cvt) will attempt to take the old C. and D. files
60 that are in $SPOOL and put them in the proper directories for
61 the new version of uucp.
63 If the files are not moved, they will never get executed after the
64 new uucp is installed.
66 There are $NC C. files in $SPOOL.
68 Do you wish to continue (Type y to continue)? \
69 \c"
71 read A
72 if [ x$A != "xy" ]; then exit; fi
74 while [ $# -gt 0 ]
76 case $1 in
77 -n) ECHO=echo
78 shift
81 *) break
84 esac
85 done
87 cd $SPOOL/C.
88 for i in C*
89 do
90 # S is the 6 character system name
91 # E is the last 5 characters of C. name
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
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
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
118 done
119 S=`echo $DIR | sed "s/\(.......\).*/\1/"`
120 $ECHO mv $i $SPOOL/$DIR/C.$S$E
122 done