#       INSTALL 2.0                                             1/16/1995
#       Installation/menu system to install certain 3B2 software from
#       a CTC ctccpio archive on tape.
#
#       History:  1.0    1/15/94  Cleaned up some errors and added
#                        additional packages to fill the tape up
#################################################################################
#       Warning: Use at your own risk.  All attempts have been made to be sure
#       the major BUGS are out of these scripts but no guarantees. THERE IS NO
#       CHECK DONE TO SEE IF THE ARCHIVED FILES WILL FIT ON THE HARD DISK.  This
#       needs to be addressed in release 2.1 if I ever get around to it.
#
#       This files is executed as follows:
#       From root:      # sysadm installpkg <cr>
#
#                       Choose install from diskette drive
#                       You will then be prompted to put the tape in
#                       and just follow the directions on the Screen
#
#################################################################################
#       The files on the tape can be installed manually as follows:
#
#       From root:      # sysadm restore
#                       Choose to restore from ctape1
#                       Choose which pkg to restore
#                       Once it is restored
#                       # cd /usr/tmp
#                       # gzip.bin -d *.gz
#                       # cpio -idv < (name of file restored)
#                       # sh /install/install/INSTALL
#                       # cd /install
#                       # pwd  (Be absolutely sure you are in /isntall)
#                       #rm -fr *
#                       ALL DONE
#       This is a basic overview of what this script does.  Use the script
#       if possible.  Oracle is a little different.
#
#       PLEASE report any bugs to me so I can work on fixing them.
#############################################################################
#
#
trap 'exit 0' 1 2 15
INSPATH=/install/new
insdirpath=/install/new/usr/tmp
LAST=1
PKGBIN=/install/install/bin

tput clear

echo "\n\n\n\tINSERT the CTC Tape in the drive and wait\n\tfor the retension pass to complete.\n\n\t (Press enter when retension has completed) \c"
read junk;

if [ ! -f /tmp/INSTALL ]
then
       cp /install/install/INSTALL /tmp/INSTALL
fi
if [ ! -f /tmp/MKINSTALL ]
then
cp /install/install/MKINSTALL /tmp/MKINSTALL
fi


if [ ! -f /tmp/INSTALL2 ]
then
cp /install/install/INSTALL2 /tmp/INSTALL2
fi

if [ ! -f /tmp/ctccpio ]
then
cp /install/install/bin/ctccpio /tmp/ctccpio
fi


if [ ! -f /tmp/gzip.bin ]
then
cp $PKGBIN/gzip.bin /tmp/gzip.bin
fi

echo "\n\tWARNING...DO NOT REMOVE THE TAPE OR DISK UNTIL THE INSTALL\n\tPROGRAM HAS TERMINATED AND THE TAPE AND DISK ARE NOT RUNNING."
sleep 8;
while :
do
tput clear
echo "******************************************************************************"
echo "\t\tATT 3B2 Software Load01 CTC Tape--INSTALL  Page 1"
echo "\tEnter the Number of the Package you want to install.\n"
echo " 1.  Job Accounting            2.  Calculation/Shell/User Environment "
echo " 3.  C Compiler 4.2            4.  Cobol and Basic Language"
echo " 5.  Crack (passwd utility)    6.  Cartridge Tape Utility v2.0"
echo " 7.  Directory/File Mgmt. 3.1  8.  Editing 3.2"
echo " 9.  Eports Utility/Driver1.3 10.  Extended Software Generation"
echo "11.  FSD Utility 1.23         12.  Interprocess Comm.  3.2 & 3.2.2"
echo "13.  Line Printer Util. 3.2   14.  Multiprocessor Enhancements 3.1.1/3.2.2"
echo "15.  Microsoft Word 1.5       16.  Microsoft Word Conversion"
echo "17.  Network Interface NI     18.  Network Support Utilities"
echo "19.  Oracle RDBMS             20.  PCDisk 1.09"
echo "21.  PC Interface 2.6.4       22.  System Performance Analysis"
echo "23.  Prelude Database 2.1     24.  Remote File Sharing"
echo "25.  Remote Console           26.  SCSI Utilities (Host Adapt/Tape/Mirror)"
echo "27.  SPECIAL SELECTIONS       28.  Software Generation 4.2 "
echo "29.  Spell Utilities          30.  Sysadm Administration 3.2"
echo "31.  System Header Files      32.  Terminal Information 3.2"
echo "33.  Basic Networking 3.2     34.  FACE 1.1"
echo "35.  TCPIP-Win 3B             36.  Windowing 3.1"
echo " Q   QUIT Exit to UNIX        MORE Go to Page 2--More selections "
echo "******************************************************************************"
echo "\tEnter your selection now (1-36, Q, or MORE): \c"
rm /usr/tmp/* 2> /dev/null
read response
tput clear;
pwait=`echo "\n\tPlease wait while the Software archive is loaded from the Tape.\n\tDO NOT REMOVE THE TAPE OR DISK until ALL Installation is complete"`

case $response in
#menu options

1)      echo "$pwait";  PKGINSTALL=acc*; break;;
2)      echo "$pwait";  PKGINSTALL=cal*; break;;
3)      echo "$pwait";  PKGINSTALL=cc*; break;;
4)      echo "$pwait";  PKGINSTALL=cob*; break;;
5)      echo "$pwait";  PKGINSTALL=cra*; break;;
6)      echo "$pwait";  PKGINSTALL=cta*; break;;
7)      echo "$pwait";  PKGINSTALL=dfm*; break;;
8)      echo "$pwait";  PKGINSTALL=ed*; break;;
9)      echo "$pwait";  PKGINSTALL=epo*; break;;
10)     echo "$pwait";  PKGINSTALL=esg*; break;;
11)     echo "$pwait";  PKGINSTALL=fsd*; break;;
12)     echo "$pwait";
               tput clear; echo "\n\nWhich IPC PKG do you wish to install (3.2 or 3.2.2): \c"; read input; case $input in
                       3.2)    PKGINSTALL=ipc1-.2*; break;;
                       3.2.2)  PKGINSTALL=ipc1.cpio*; break;;
                       *)      echo "You must either enter 3.2 or 3.2.2";
                               sleep 10; exit;;
                       esac;;

13)     echo "$pwait";  PKGINSTALL=lp*; break;;

14)     echo "$pwait"; tput clear;
               echo "\n\nWhich Multiprocessor PKG do you wish to install (3.1.1 or 3.2.2): \c"; read input; case $input in
                       3.1.1) PKGINSTALL=mpb1*; break;;
                       3.2.2) PKGINSTALL=mpbe*; break;;
                       *)      echo "You must either enter 3.1.1 or 3.2.2";
                               sleep 10; exit;;
                       esac;;

15)     echo "$pwait";  PKGINSTALL=mw*; break;;
16)     echo "$pwait";  PKGINSTALL=mwc*; break;;
17)     echo "$pwait";  PKGINSTALL=ni*; break;;
18)     echo "$pwait";  PKGINSTALL=nsu*; break;;

19)     echo "$pwait"; sleep 5; tput clear; cat /install/install/ORACLE.wait; \
        PKGINSTALL=ora*; break;;

20)     echo "$pwait";  PKGINSTALL=pcd*; break;;
21)     echo "$pwait";  PKGINSTALL=pci*; break;;
22)     echo "$pwait";  PKGINSTALL=per*; break;;
23)     echo "$pwait";  PKGINSTALL=pre*; break;;
24)     echo "$pwait";  PKGINSTALL=rfs*; break;;
25)     echo "$pwait";  PKGINSTALL=rmp*; break;;
26)     echo "$pwait"; tput clear; echo "\n\n\tA. SCSI HOST ADAPTER\n\tB. SCSI TAPE DRIVE \n\tC. SCSI MIRROR UTILITY\n\nEnter the Letter of the SCSI Pkg. you want to install: \c"
               read input;
               case $input in

       [A,a])   PKGINSTALL=scsi*; break;;
       [B,b])   PKGINSTALL=sd011*; break;;
       [C,c])   PKGINSTALL=st?11*; break;;
       *)      echo "Please enter only A, B, or C"; sleep 5; exit;;
       esac;;

27)     tput clear; echo "\n\tSwitching Menu's ...Please wait"; \
        exec /tmp/MKINSTALL; exit;;

28)     echo "$pwait";  PKGINSTALL=sgs*; break;;
29)     echo "$pwait";  PKGINSTALL=spe*; break;;
30)     echo "$pwait";  PKGINSTALL=sysa*; break;;
31)     echo "$pwait";  PKGINSTALL=sys1*; break;;
32)     echo "$pwait";  PKGINSTALL=ter*; break;;
33)     echo "$pwait";  PKGINSTALL=uuc*; break;;
34)     echo "$pwait";  PKGINSTALL=vm*; break;;
35)     echo "$pwait";  PKGINSTALL=win?.cpio*; break;;
36)     echo "$pwait";  PKGINSTALL=wind*; break;;

       [q,Q]*) echo "\n\tDO NO REMOVE TAPE or DISK until they are NOT running."; exit;;

       More|MORE|more)
tput clear
echo "******************************************************************************"
echo "\t\tATT 3B2 Software Load01 CTC Tape--INSTALL  Page 2"
echo "\tEnter the Number of the Package you want to install.\n"
echo "37.  Form & Menu Lang 1.1     38.  CPIO patch 3.2.3"
echo "39.  Security Admin. 3.0      40.  Source Code Control System Util. "
echo "41.  Help Utility (UNIX)      42.  Cart. Tape Controller Util. 3.0"
echo "43.  Graphic Utilities        44.  Performance Meas. Util."
echo "45.  Enhanced Ports 1.3 EPORT 46.  Expanded IO (PORTS for HPP)"
echo "47.  Int. Serial Cont. Diag.  48.  Assist/Astgen (Help Utility)"
echo "49.  DMD Complete Package     50.  Documentors Work Bench"
echo "51.  Advanced Editing Utility 52.  EXB8200 8mm Tape Controller"
echo "53.  Fiber Expansion          54.  Fortran Programming Language"
echo "55.  Int. Serial Cont. Pkg.   56.  Jetcom (Communications)"
echo "57.  Multi-Processor Support  58.  Network Access Utility-Starlan"
echo "59.  Starlan Drivers          60.  Twin Spreadsheet (Lotus Clone)"
echo "61.  Text Support             62.  3B2 Verification (300 & 400) "
echo "63.  Writers Work Bench       64.  X25 Network Driver"
echo "65.  XDC Driver               66.  XDC Toolbox"
echo "\n\n Q   QUIT Exit to UNIX       MORE  Go to Page 1--Previous Page"
echo "                      SHELL  Execute /bin/sh temporarily"
echo "******************************************************************************"
echo "\tEnter your selection now (37-46, Q, SHELL or MORE): \c"
rm /usr/tmp/* 2> /dev/null
read resp
tput clear;

case $resp in

       37)     echo "$pwait";  PKGINSTALL=fmli*; break;;
       38)     echo "$pwait";  PKGINSTALL=cpio1*; break;;
       39)     echo "$pwait";  PKGINSTALL=crypt2*; break;;
       40)     echo "$pwait";  PKGINSTALL=sccs1*; break;;
       41)     echo "$pwait";  PKGINSTALL=help1.2*; break;;
       42)     echo "$pwait";  PKGINSTALL=ctc1*; break;;
       43)     echo "$pwait";  PKGINSTALL=graph*; break;;
       44)     echo "$pwait";  PKGINSTALL=perf1*; break;;
       45)     echo "$pwait";  PKGINSTALL=eports.2*; break;;
       46)     echo "$pwait";  PKGINSTALL=hpports*; break;;

#              NEW PACKAGES ADDED 1/16/95

       47)     echo "$pwait"; PKGINSTALL=isc.dia*; break;;
       48)     echo "$pwait"; PKGINSTALL=assist*; break;;
       49)     echo "$pwait"; PKGINSTALL=dmd*; break;;
       50)     echo "$pwait"; PKGINSTALL=dwb*; break;;
       51)     echo "$pwait"; PKGINSTALL=edu*; break;;
       52)     echo "$pwait"; PKGINSTALL=exb*; break;;
       53)     echo "$pwait"; PKGINSTALL=fib*; break;;
       54)     echo "$pwait"; PKGINSTALL=fortr*; break;;
       55)     echo "$pwait"; PKGINSTALL=isc?.*; break;;
       56)     echo "$pwait"; PKGINSTALL=jetcom*; break;;
       57)     echo "$pwait"; PKGINSTALL=mpb*; break;;
       58)     echo "$pwait"; PKGINSTALL=nau*; break;;
       59)     echo "$pwait"; PKGINSTALL=starla*; break;;
       60)     echo "$pwait"; PKGINSTALL=twin*; break;;
       61)     echo "$pwait"; PKGINSTALL=txtsup*; break;;
       62)     echo "$pwait"; PKGINSTALL=verif*; break;;
       63)     echo "$pwait"; PKGINSTALL=wwb*; break;;
       64)     echo "$pwait"; PKGINSTALL=x25ni*; break;;
       65)     echo "$pwait"; PKGINSTALL=xdc*; break;;
       66)     echo "$pwait"; PKGINSTALL=xdtools*; break;;

#               END NEW PACKAGES 1/16/95

       more|More|MORE) ;;
       SHELL|Shell|shell)      echo "Type exit to return to menu"; /bin/sh;;
       [q,Q]*) echo "\n\tDO NO REMOVE TAPE or DISK until they are NOT running."; exit;;

       *)      echo "\n\n\n\tINCORRECT RESPONSE PLEASE TRY AGAIN"; sleep 2 ;;

esac;;


       SHELL|Shell|shell)      echo "Type exit to return to menu"; /bin/sh;;
       *)      echo "\n\n\n\tINCORRECT RESPONSE PLEASE TRY AGAIN"; sleep 2;;
esac
done
       cd /usr/tmp
       echo "PKGINSTALL is $PKGINSTALL"
       export PKGINSTALL
       echo "\nThe following file(s) are being loaded from the tape:\n...(Please wait...about 10 minutes)"
       /tmp/ctccpio -iduvm -T/dev/rSA/ctape1 /usr/tmp/${PKGINSTALL}

echo "\nUNZIPPING the archived file, this will several minutes...Please be patient."
cd /usr/tmp
/tmp/gzip.bin -d /usr/tmp/*.gz
exec /tmp/INSTALL2