[comp.bugs.4bsd] bugs in SUN 3.4 upgrade script

cyrus@hi.UUCP (Tait Cyrus) (07/15/87)

Well, last week I was presented with the task of upgrading from 
SUN UNIX 3.3 to SUN UNIX 3.4 on our 3/160.  I was hoping that
this upgrade would go smoothly because previous upgrades did not.
Needless to say the 3.4 upgrade DID NOT go smoothly, because,
as with previous upgrades, the UPGRADE shell script was screwed up.

I posted, to the net, the problems I had with the 3.3 upgrade shell
script, and now I am going to post the problems I had with the
3.4 shell script in an attempt to help those folks who have not
made the upgrade yet.

FLAME ON!!!!!!

The following problems are the SAME, repeat the SAME ones that
I fought with in the 3.3UPGRADE.  When will SUN produce a shell
script that works!!!!!  Even after telling them about it, they
still haven't fixed them.

FLAME OFF

There are several problems which I would like to mention.  This
is not a complete list nor are some of the fixes optimal.  I
did not, nor do I care to, go through the entire script looking
for problems, although I did change some of the more obvious ones.

The main problems with the 3.4UPGRADE shell script have to deal
with upgrading clients, although there is one BIG bug that has
nothing to do with clients.

PROBLEM 1.

First of all, if you are on a 'tapeless' sun and have a 'remote'
tapedrive, SUN "assumes" that the ethernet board to go through
to get to the 'remote' tapedrive is zero (0).  In our (UNM's)
case, this is an INCORRECT assumption.  Two of our systems have
two ethernet boards in them.  One for clients and one for talking
to the rest of the world.  Our board 0 is what we have our clients
on, and our board 1 is what the rest of the world is on.  

SUN "ifconfig"s {ie,le,ec,...}0 when attempting to make connection with
the 'remote' tape server.  The way I fixed this was to allow the user
to specify the FULL device name; i.e. ie0, ie1, ec0, ec1, le0 etc.
In this way, there is NO question as to which ethernet board to use.

PROBLEM 2.

This problem, as above, also has to deal with a configuration in which
you have to use a 'remote' tape server.  In this case, if your system
is ALSO the ypserver, the problem is that the shell script DOES NOT
start the ypserver.  It then trys to find, via ypmatch, the name of the
'remote' tape server machine.  Since there is NO ypserver running,
ypmatch timeouts.

I fixed this by adding an if which starts the ypserver if the machine
you are upgrading is a ypserver.

PROBLEM 3.

The upgrade script incorrectly parses the lines of /etc/nd.local.

	PROBLEM 3a

	First of all, the script trys to find the names of all 'active'
	clients.  It does this with a bit of code which I REFUSE to try
	to understand.  There are A LOT of inconsistencies is this code,
	but it appeared to work (sort of).  This code first does a grep.
	If the return status says that grep found something, then the
	output of that SAME grep 'should' be used as an argument to a
	'set' which immediately follows the initial grep.  Well, if
	you look at the code, the second grep (the one as the arg to set)
	does NOT have the SAME search pattern.  I tried to come up with
	something that was A LOT more clean, but gave up (to busy :^) ).

	The problem with this code is when $ind is 1.  In this case grep
	found two lines which matched (on out system).  The 1st was the
	"version 1" and the 2nd was the one it was 'really' looking for.
	The problem that results is the $1, which is supposed to be the
	name of the client, is "1". 

	I fixed this by checking to see if $1 was "version", in which
	case I did a 'shift 2'.

                      grep " $ind    $endsym" $NDLOCAL > /dev/null 2>&1
                      case "$?" in
                         0)
                            set `grep " $ind $endsym" $NDLOCAL` ;;
                         1)
				.
				.
		   			grep " $ind  [0-9]$endsym" $NDLOCAL > /dev/null 2>&1
                                        case "$?" in
                                           0)
                                              set `grep " $ind       [0-9]$endsym" $NDLOCAL` ;;

	
	PROBLEM 3b
	
	The second problem is that once the names of the clients are
	known, the nd partition that that client uses needs to be found.
	The script did use:
                 set `grep "user $CLIENT 0" $NDLOCAL | sed s,\/," ",g`
                 ndl=ndl${8}
	The problem we had is that we had 'prettied up' /etc/nd.local
	so that the fields all lined up and were easy to read.  The above
	code FORCED the fields to be separated by spaces.

	I fixed this by using awk.

PROBLEM 4.

This is not really a problem, but I will mention it anyway.  I don't
like to use SUN's standard scheme of mounting /dev/xy?? on /usr.MC68020
or what ever because it makes 'df' look dirty.  As a result, I went 
through and replaced ALL references to /xxx.MC68020 with /xxx.  Since
our system only servers 68020 machines, this caused not problems.
Well, you guessed it, the 3.xUPGRADE looks specifically for /xxx.MC680x0.
This was an easy fix.  I just put in symbolic links from /xxx to
/xxx.MC68020.  These links are not used for anything, df produces nice
readable output and 3.xUPGRADE worked.

END PROBLEMS

I hope you do not construe the above to say that I hate SUN's.  Quite the
contrary, because I would rether have a SUN than a vax, unless of course
some kind sole gave me a vax in which case I would use the vax :^).

Following is a diff of the original 3.4UPGRADE and the one I modified.
As I mentioned above, I did not attempt to check to see if there were
any other problems, just those that affected our systems (3/160's serving
3/50's and  3/75's).

I hope this is of some help to those people who have not made the upgrade
to SUN UNIX 3.4.

Happy computing :-)


------- diff follows ------- diff follows -------- diff follows -------
*** /etc/3.4UPGRADE.org	Thu Jul  9 15:02:23 1987
--- /etc/3.4UPGRADE	Tue Jul 14 21:05:18 1987
***************
*** 100,109 ****
                          read TAPEHOST;
                          while true; do
                                  echo
!                                 echo -n "Enter ethernet type of this system ? [ec | ie | le] :"
                                  read ETHER;
                                  case "$ETHER" in
!                                         "ec" | "ie" | "le" )
                                                  break ;;
                                          * )
                                                  echo "${CMDNAME}: invalid ether type \"${ETHER}\"." ;;
--- 100,110 ----
                          read TAPEHOST;
                          while true; do
                                  echo
! 				echo "Enter the ethernet device to use to get to"
! 				echo -n "    the remote host [ecX, ieX or leX where X is 0, 1, etc]: "
                                  read ETHER;
                                  case "$ETHER" in
!                                         "ec0" | "ec1" | "ie0" | "ie1" | "le0" | "le1" )
                                                  break ;;
                                          * )
                                                  echo "${CMDNAME}: invalid ether type \"${ETHER}\"." ;;
***************
*** 296,301 ****
--- 297,305 ----
  		/bin/domainname ${DOMAIN}
  		/etc/portmap
  		/etc/ypbind
+ 		if [ "$MACHINE"  = "server" ]; then
+ 			/usr/etc/ypserv
+ 		fi
  		ypmatch $TAPEHOST hosts > /dev/null 2>&1
  	fi
  	if [ "$?" != 0 ]; then
***************
*** 302,308 ****
  		echo "${CMDNAME}: can't reach tapehost \"${TAPEHOST}\" !!"
  		exit 1
  	fi
! 	/etc/ifconfig ${ETHER}0 ${HOST} -trailers up
  fi
  
  if [ "$MACHINE" = "server" ]; then
--- 306,312 ----
  		echo "${CMDNAME}: can't reach tapehost \"${TAPEHOST}\" !!"
  		exit 1
  	fi
! 	/etc/ifconfig ${ETHER} ${HOST} -trailers up
  fi
  
  if [ "$MACHINE" = "server" ]; then
***************
*** 353,358 ****
--- 357,365 ----
                              esac ;;
                        esac ;;
                  esac
+ 		if [ $1 = "version" ] ; then
+ 			shift 2
+ 		fi
                  CLIENT=$2
                  case "$1" in
                       "#user" )
***************
*** 366,373 ****
          done
  	for CLIENT in $CLIENTLIST
          do
!                 set `grep "user $CLIENT 0" $NDLOCAL | sed s,\/," ",g`
!                 ndl=ndl${8}
                  cd /dev
                  /dev/MAKEDEV ${ndl} 2> /dev/null
          done
--- 373,380 ----
          done
  	for CLIENT in $CLIENTLIST
          do
! 		set `grep $CLIENT $NDLOCAL | awk '$3 == "0" { print $0 }'`
!                 ndl=ndl${7}
                  cd /dev
                  /dev/MAKEDEV ${ndl} 2> /dev/null
          done
***************
*** 380,387 ****
                  fi
  	elif [ "$SERVERTYPE" = "heter" ]; then
  		for HOSTNAME in ${CLIENTLIST}; do
!                         set `grep "user $HOSTNAME 0" $NDLOCAL | sed s,\/," ",g`
!                         DISK=ndl${8}
                          mkdir /${HOSTNAME}
                          if mount /dev/${DISK} /${HOSTNAME}; then
                                  cd /${HOSTNAME}
--- 387,394 ----
                  fi
  	elif [ "$SERVERTYPE" = "heter" ]; then
  		for HOSTNAME in ${CLIENTLIST}; do
! 			set `grep $HOSTNAME $NDLOCAL | awk '$3 == "0" { print $0 }'`
!                         DISK=ndl${7}
                          mkdir /${HOSTNAME}
                          if mount /dev/${DISK} /${HOSTNAME}; then
                                  cd /${HOSTNAME}
***************
*** 529,536 ****
                  	CLIENTLIST=${CLIENTLIST20}
  		fi
          	for HOSTNAME in ${CLIENTLIST}; do
! 			set `grep "user $HOSTNAME 0" $NDLOCAL | sed s,\/," ",g`
!                 	DISK=ndl${8}
          		mkdir /${HOSTNAME}
                  	if mount /dev/${DISK} /${HOSTNAME}; then
  	
--- 536,543 ----
                  	CLIENTLIST=${CLIENTLIST20}
  		fi
          	for HOSTNAME in ${CLIENTLIST}; do
! 			set `grep $HOSTNAME  $NDLOCAL | awk '$3 == "0" { print $0 }'`
!                 	DISK=ndl${7}
          		mkdir /${HOSTNAME}
                  	if mount /dev/${DISK} /${HOSTNAME}; then
  	
-- 
    @__________@    W. Tait Cyrus   (505) 277-0806
   /|         /|    University of New Mexico
  / |        / |    Dept of EECE - Hypercube Project
 @__|_______@  |    Albuquerque, New Mexico 87131
 |  |       |  |
 |  |  hc   |  |    e-mail:
 |  @.......|..@       cyrus@hc.dspo.gov or
 | /        | /        seismo!unmvax!hi!cyrus
 @/_________@/