set QUIET
set CONSOLE LOG=install.log
mkdir dsk
attach RQ0 -iy dsk/ulx0.dsk
attach RQ1 -iy dsk/ulx1.dsk
attach RQ2 -iy dsk/ulx2.dsk
set TQ0 lock
:SETUP
echo ************************************************************************
set ENV -p "root Password" SYSPWD=Digital1977
set ENV -p "Field Service Password" FLDPWD=%SYSPWD%
set ENV -p "Username" USER=dcutler
set ENV -p "Name" NAME=Dave N. Cutler
echo ************************************************************************
echo * The pre-configured IP address and subnet mask are illustrative only  *
echo * and should be replaced with actual, usable, addresses -- either a    *
echo * publicly routable address, or one within the three available private *
echo * address ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16            *
echo *                                                                      *
echo * Note that Ultrix's "netsetup install" command neither accepts subnet *
echo * masks in neither the dot-decimal nor the CIDR notation, and -- more  *
echo * importantly -- has no concept of CIDR at all, instead it is a fully  *
echo * classful networking architecture system.                             *
echo *                                                                      *
echo *                                                                      *
echo *         Network |           Address           |    Default           *
echo *          Class  |            Range            |    Netmask           *
echo *        ---------+-----------------------------+--------------        *
echo *            A    |           0. - 127.         |   255.0.0.0          *
echo *            B    |     128.  0. - 191.255.     |  255.255.0.0         *
echo *            C    | 192.  0.  0. - 223.255.255. | 255.255.255.0        *
echo *                                                                      *
echo *                                                                      *
echo * Ultrix requires one specify the network and host sections of the IP  *
echo * address separately, and that any subnet mask beyond the default for  *
echo * the address class be specified as the number of bits taken from the  *
echo * host segment of the address. Three worked examples are given below.  *
echo *                                                                      *
echo *                                                                      *
echo *           IP Address   |   Subnet Mask   |  Segments  | Bits         *
echo *         ---------------+-----------------+------------+-----         *
echo *         16.166.224.90  | 255.248.  0.  0 | 16         | 5            *
echo *                        |                 | 166.224.90 |              *
echo *         172.16.173.130 | 255.255.252.  0 | 172.16     | 6            *
echo *                        |                 | 173.130    |              *
echo *         203.0.113.240  | 255.255.255.192 | 203.0.113  | 2            *
echo *                        |                 | 240        |              *
echo *                                                                      *
echo *                                                                      *
echo ************************************************************************
set ENV -p "Host Name" HOSTNAME=service
set ENV -p "Network Address" NETWADDR=203.0.113
set ENV -p "Host Address" HOSTADDR=32
set ENV -p "Subnet Bits" NETMASK=0
echo ************************************************************************
set ENV -p "DMS VAXstation 3100 Client Name" VSTANAME=vs3100m30
echo DMS VAXstation 3100 Client Network Address > %NETWADDR% <
set ENV -p "DMS VAXstation 3100 Client Host Address" VSTAADDR=40
echo ************************************************************************
set ENV -p "DMS microVAX II Client Name" MVAXNAME=mv2
echo DMS microVAX II Client Network Address > %NETWADDR% <
set ENV -p "DMS microVAX II Client Host Address" MVAXADDR=50
echo ************************************************************************
set ENV -p "Are you satisfied with your setup options? [Y/N]" REDOSETUP=N
if -i REDOSETUP geq "Y" goto EOI
else goto SETUP
:EOI
echo ************************************************************************
echo * End of user input; please wait until the installation is complete.   *
echo *                                                                      *
echo *     INSTALLATION STARTED AT %TIME%                                 *
echo ************************************************************************
:MINIROOT
noexpect
attach TQ0 -er dist/AQ-HN73D-BE.tk5
expect ">>>" send -t after=250k "boot MUA0:\r"; continue
expect "Enter your choice: " send "1 "; continue
expect "tms0" send -t after=100k "\r"; continue
expect "Enter your choice: " send "2\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Press the RETURN key when you are ready to continue. " send "\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Press the RETURN key when you are ready to continue. " send "\r"; continue
expect "?06 HLT INST" goto KERNEL_BUILD
boot CPU
goto EOS
:KERNEL_BUILD
noexpect
expect ">>>" send -t after=250k "boot DUA0:\r"; continue
expect "Enter your system name:  " send "%HOSTNAME%\r"; continue
expect "You selected service as the name of your system.  Is this\r\ncorrect? (y/n) [y]: " send "\r"; continue
expect "Enter the date and time: " send "%DATE_19XX_YY%%DATE_MM%%DATE_DD%%TIME_HH%%TIME_MM%\r"; continue
expect "Enter your choice: " send "e\r"; continue
expect "Does your area alternate between Daylight Savings and Standard\r\ntime? (y/n) [y]: " send "y\r"; continue
expect "Enter your choice [u]: " send "u\r"; continue
expect "New password:" send "%SYSPWD%\r"; continue
expect "Retype new password:" send "%SYSPWD%\r"; continue
expect "New password:" send "%FLDPWD%\r"; continue
expect "Retype new password:" send "%FLDPWD%\r"; continue
expect "Do you want to choose the default file system layout? (y/n): " send "n\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Type the letter of the partition on which you want\r\nto allocate the /usr file system [d]: " send "g\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Type the letter of the partition on which you want\r\nto allocate the swap1 space [b]: " send "b\r"; continue
expect "Do you want to allocate a second swap space? (y/n) [n]: " send "n\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Type the letter of the partition on which you want\r\nto allocate the crash dump space [b]: " send "b\r"; continue
expect "Enter your choice: " send "1\r"; continue
expect "Type the letter of the partition on which you want\r\nto allocate the var file system [ ]: " send "h\r"; continue
expect "Enter the name of the /usr/users directory\r\n[/usr/users]: " send "/usr/users\r"; continue
expect "Is this correct? (y/n) [n]: " send "y\r"; continue
expect "Enter your choice: " send "2\r"; continue
expect "Type the letter of the partition on which you want\r\nto allocate the /usr/users file system [ ]: " send "c\r"; continue
expect "Do you want to initialize the /usr/users file system? (y/n) []: " send "y\r"; continue
expect "Are you ready? (y/n): " send "y\r"; continue
expect "Enter your choice(s): " send "20\r"; continue
expect "Is this correct? (y/n): " send "y\r"; continue
expect "Enter the selection number for each kernel option you want.\r\nFor example, 1 3 :  " send "1 2\r"; continue
expect "Is this correct? (y/n) [n]: " send "y\r"; continue
expect "Do you want to edit the configuration file? (y/n) [n]: " send "n\r"; continue
expect "?06 HLT INST" goto SETUP1
goto EOS
:SETUP1
noexpect
expect ">>>" send -t after=250k "boot DUA0:\r"; continue
expect "Ultrix-32 V3.0 (Rev 64) (%HOSTNAME%)" goto SETUP2
goto EOS
:SETUP2
noexpect
expect "login: " send "root\r"; continue
expect "Password:" send "%SYSPWD%\r"; continue
expect "#" continue
expect "#" attach TQ0 -er dist/AQ-KU57B-BE.tk5; send -t after=5m "setld -l /dev/nrmt0h\r"; continue
expect "Are you ready? (y/n): " send "y\r"; continue
expect "Enter your choice(s): " send "24\r"; continue
expect "Is this correct? (y/n): " send "y\r"; continue
expect "#" attach TQ0 -er dist/AQ-JU88A-BE.tk5; send -t after=5m "/etc/install_upgrade /dev/nrmt0h\r"; continue
expect "Is the correct capacity upgrade kit loaded on /dev/nrmt0h at service <y/n>? " send "y\r"; continue
expect "#" send "netsetup install\r"; continue
expect "Your system's name is \"%HOSTNAME%\".  Is this correct [yes]? " send "yes\r"; continue
expect "Press the RETURN key if you do not want any abbreviation names for\r\n%HOSTNAME%.  Otherwise, enter one or more abbreviation names, separated by\r\nblank spaces: " send "\r"; continue
expect "You do not want any abbreviation names for %HOSTNAME%.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the network number for %HOSTNAME%: " send "%NETWADDR%\r"; continue
expect "The network number is %NETWADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "Are you setting up %HOSTNAME% on a network that uses subnet routing [no]? " send "yes\r"; continue
expect "Is this correct [yes]? " send "yes\r"; continue
expect "Enter the host number (including the subnet number) for %HOSTNAME%: " send "%HOSTADDR%\r"; continue
expect "The Host number is %HOSTADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "How many bits of the host number will be used for subnets? " send "6\r"; continue
expect "Is this correct [yes]? " send "yes\r"; continue
expect "Enter a \"1\" if you use all ones, or \"0\" if you use all zeros [1]: " send "1\r"; continue
expect "Is this correct [yes]? " send "yes\r"; continue
expect "What is the device name of your Network Interface [qe0]? " send "qe0\r"; continue
expect "Your Network interface is \"qe0\".  Is this correct [yes]? " send "yes\r"; continue
expect -r "What is the name of network [0-9.]* \[ethernet\]\? " send "\r"; continue
expect "The network name for %HOSTNAME% is \"ethernet\".  Is this correct [yes]? " send "yes\r"; continue
expect "Enter any aliases for ethernet:  " send "\r"; continue
expect "You do not have any aliases for ethernet.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the name of the host you want to add to /etc/hosts: " send "%VSTANAME%\r"; continue
expect "You want to add host \"%VSTANAME%\".  Is this correct [yes]? " send "yes\r"; continue
expect "If you do not want any abbreviation names, press the RETURN key: " send "\r"; continue
expect "You do not want any abbreviation names for \"%VSTANAME%\".  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the network number for %VSTANAME%: " send "%NETWADDR%\r"; continue
expect "The network number is %NETWADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the host number (including the subnet number) for %VSTANAME%: " send "%VSTAADDR%\r"; continue
expect "The Host number is %VSTAADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the name of the host you want to add to /etc/hosts: " send "%MVAXNAME%\r"; continue
expect "You want to add host \"%MVAXNAME%\".  Is this correct [yes]? " send "yes\r"; continue
expect "If you do not want any abbreviation names, press the RETURN key: " send "\r"; continue
expect "You do not want any abbreviation names for \"%MVAXNAME%\".  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the network number for %MVAXNAME%: " send "%NETWADDR%\r"; continue
expect "The network number is %NETWADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the host number (including the subnet number) for %MVAXNAME%: " send "%MVAXADDR%\r"; continue
expect "The Host number is %MVAXADDR%.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the name of the host you want to add to /etc/hosts: " send "\r"; continue
expect "Are you finished adding hosts [yes]? " send "yes\r"; continue
expect "Enter the name of a trusted host: " send "%VSTANAME%\r"; continue
expect "\"%VSTANAME%\" is a trusted host.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the name of a trusted host: " send "%MVAXNAME%\r"; continue
expect "\"%MVAXNAME%\" is a trusted host.  Is this correct [yes]? " send "yes\r"; continue
expect "Enter the name of a trusted host: " send "\r"; continue
expect "Have you finished entering the names of trusted hosts [yes]? " send "yes\r"; continue
expect "#" send "ed /etc/ttys\r"; send -t after=1000k delay=500k "1,$s/off nomodem/on secure modem\r1,$s/vt100/dialup\rw\rq\r"; continue
expect "#" continue
expect "#" continue
expect "#" send "adduser\r"; continue
expect "Enter login name for new user (initials, first or last name): " send "guest\r"; continue
expect "Enter full name for new user: " send "Guest User\r"; continue
expect "What login group should this user go into [ users ] ? " send "\r"; continue
expect "Enter another group that 'guest' should be a member of\r\n(<RETURN> only if none): " send "guest\r"; continue
expect "Enter another group that 'guest' should be a member of\r\n(<RETURN> only if no more): " send "\r"; continue
expect "Enter parent directory for guest [/usr/users]: " send "\r"; continue
expect "#" send "adduser\r"; continue
expect "Enter login name for new user (initials, first or last name): " send "%USER%\r"; continue
expect "Enter full name for new user: " send "%NAME%\r"; continue
expect "What login group should this user go into [ users ] ? " send "\r"; continue
expect "Enter another group that '%USER%' should be a member of\r\n(<RETURN> only if none): " send "staff\r"; continue
expect "Enter another group that '%USER%' should be a member of\r\n(<RETURN> only if no more): " send "\r"; continue
expect "Enter parent directory for %USER% [/usr/users]: " send "\r"; continue
expect "#" send "shutdown -h now\r"; continue
expect "?06 HLT INST" goto SETUP3
goto EOS
:SETUP3
noexpect
expect ">>>" send -t after=250k "boot DUA0:\r"; continue
expect "Ultrix-32 V3.0 (Rev 64) (%HOSTNAME%)" goto SETUP4
goto EOS
:SETUP4
noexpect
expect "login: " send "root\r"; continue
expect "Password:" send "%SYSPWD%\r"; continue
expect "#" continue
expect "#" send "/etc/nfssetup\r"; continue
expect "\tNFS locking to be enabled [n] ? " send "y\r"; continue
expect "\tWill you be exporting any directories [n] ? " send "y\r"; continue
expect "\tEnter the number of nfsd servers to run [4] : " send "4\r"; continue
expect "\tEnter the number of block I/O daemons to run [4] : " send "4\r"; continue
expect "\tWould you like to run the rwalld daemon [n] ? " send "y\r"; continue
expect "Enter the directory pathname: " send "/usr/users\r"; continue
expect "\tNetgroup/Machine name: " send "%MVAXNAME%\r"; continue
expect "\tNetgroup/Machine name: " send "%VSTANAME%\r"; continue
expect "\tNetgroup/Machine name: " send "\r"; continue
expect "Enter the directory pathname: " send "\r"; continue
expect "Enter the remote host name: " send "\r"; continue
expect "Enter \"c\" to CONFIRM the information, \"q\" to QUIT nfssetup\r\nwithout making any changes, or \"r\" to RESTART the procedure [no default]: " send "c\r"; continue
expect "Would you like nfssetup to start the daemons automatically [y]? " send "y\r"; continue
expect "***** NFSSETUP COMPLETE *****" goto SETUP5
goto EOS
:SETUP5
noexpect
expect "#" send "dms\r"; continue
expect "To continue please enter the superuser password:" send "%SYSPWD%\r"; continue
expect "Enter your choice: " send "c\r"; continue
expect "Enter your choice: " send "d\r"; continue
expect "Do you want to continue? (y/n) [n]: " send "y\r"; continue
expect "Enter the raw device special file name of the \"c\" partition of\r\nthe desired disk, for example /dev/rra2c: " send "/dev/rra2c\r"; continue
expect "Press RETURN when /dev/rra2c is ready." send "\r"; continue
expect "Enter your selection: " send "1\r"; continue
expect "Enter the swap file size in Mbytes: " send "24\r"; continue
expect "Enter the propagated root area size in Mbytes: " send "10\r"; continue
expect "Enter the size of the sharable usr portion in Mbytes: " send "400\r"; continue
expect "Enter a number between 1 and 4: " send "4\r"; continue
expect "Disk partitioning is completed." goto SETUP6
goto EOS
:SETUP6
noexpect
expect "#" send "dms\r"; continue
expect "To continue please enter the superuser password:" send "%SYSPWD%\r"; continue
expect "Enter your choice: " send "c\r"; continue
expect "Enter your choice: " send "i\r"; continue
expect "Are you installing ULTRIX-32 supported software? (y/n) [n]: " send "y\r"; continue
expect "Enter the device special file name or mount point of the\r\ndistribution media, for example, /dev/rmt0h: " attach TQ0 -er dist/AQ-HN73D-BE.tk5; send -t after=5m "/dev/rmt0h\r"; continue
expect "Are you ready? (y/n): " send "y\r"; continue
expect "Enter your choice(s): " send "1 2 5 7 9 10 12 13 14 15 16\r"; continue
expect "Is this correct? (y/n): " send "y\r"; continue
expect "Build SETEVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build SESMVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build SESGVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build QETEVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build QEQVVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build QEQDVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build QEQD2VAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build PVSMVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build PVSGVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build LNTEVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "Build LNFGVAX kernel? (y/n) [n]: " send "y\r"; continue
expect "*** PERFORMING SYSTEM CONFIGURATION ***" goto SETUP7
goto EOS
:SETUP7
noexpect
expect "#" send "dms\r"; continue
expect "To continue please enter the superuser password:" send "%SYSPWD%\r"; continue
expect "Enter your choice: " send "c\r"; continue
expect "Enter your choice: " send "i\r"; continue
expect "Are you installing ULTRIX-32 supported software? (y/n) [n]: " send "n\r"; continue
expect "Enter the device special file name or mount point of the\r\ndistribution media, for example, /dev/rmt0h: " attach TQ0 -er dist/AQ-KU57B-BE.tk5; send -t after=5m "/dev/rmt0h\r"; continue
expect "Are you ready? (y/n): " send "y\r"; continue
expect "Enter your choice(s): " send "1 2 3 4 5 7 8 10 12 14 18 19 20 21 23\r"; continue
expect "Is this correct? (y/n): " send "y\r"; continue
;;;;;
;;;;;
;;;;; TODO: Finalize
;;;;;
;;;;;
expect "#" send "dms\r"; continue
expect "To continue please enter the superuser password:" send "%SYSPWD%\r"; continue
expect "Enter your choice: " send "c\r"; continue
expect "Enter your choice: " send "s\r"; continue
expect "Enter your choice []: " send "1\r"; continue
expect "Enter your choice []: " send "1\r"; continue
expect "Enter your choice []: " send "1\r"; continue
expect "Select the swap file system location, 0-client (disk), 1-server []: " send "1\r"; continue
expect "Enter swap file size, in 1/2-Mbyte increments []: " send "16\r"; continue
expect "Do you want clients to dump across the network?\r\nEnter n (no dump), f (full dump), p (partial dump) []: " send "n\r"; continue
expect "Enter your selection []: " send "4\r"; continue
expect "Link to a default kernel? (y/n) []: " send "y\r"; continue
expect "#" send "dms\r"; continue
expect "To continue please enter the superuser password:" send "%SYSPWD%\r"; continue
expect "Enter your choice: " send "a\r"; continue
expect "Do you want to continue? (y/n) [y]: " send "y\r"; continue
expect "Enter the client processor's hostname: " send "%VSTANAME%\r"; continue
expect "Enter the client processor's hardware Ethernet address, for\r\nexample, 08-00-2B-02-67-E1 []: " send "08-00-2B-BD-55-6D\r"; continue
expect "Enter your choice [1]: " send "1\r"; continue
expect "New password:" send "%SYSPWD%\r"; continue
expect "Retype new password:" send "%SYSPWD%\r"; continue
expect "Select the swap file system location, 0-client (disk), 1-server [1]: " send "1\r"; continue
expect "Enter your choice [1]: " send "1\r"; continue
expect "For example, enter 16 for an 8-Mbyte swap file [16]: " send "16\r"; continue
expect "Do you want the client to dump across the network to service?\r\nEnter n (no dump), f (full dump), p (partial dump) [n]: " send "n\r"; continue
expect "Enter your selection [4]: " send "13\r"; continue
expect "Link to a default kernel? (y/n) [y]: " send "y\r"; continue
expect "Do you want to add another client processor to the\r\n/var/diskless/clients directory? (y/n) [n]: " send "y\r"; continue
expect "Enter the client processor's hostname: " send "%MVAXNAME%\r"; continue
expect "Enter the client processor's hardware Ethernet address, for\r\nexample, 08-00-2B-02-67-E1 []: " send "08-00-2B-1E-8B-91\r"; continue
expect "Enter your choice [1]: " send "1\r"; continue
expect "New password:" send "%SYSPWD%\r"; continue
expect "Retype new password:" send "%SYSPWD%\r"; continue
expect "Select the swap file system location, 0-client (disk), 1-server [1]: " send "1\r"; continue
expect "Enter your choice [1]: " send "1\r"; continue
expect "For example, enter 16 for an 8-Mbyte swap file [16]: " send "16\r"; continue
expect "Do you want the client to dump across the network to service?\r\nEnter n (no dump), f (full dump), p (partial dump) [n]: " send "n\r"; continue
expect "Enter your selection [4]: " send "4\r"; continue
expect "Link to a default kernel? (y/n) [y]: " send "y\r"; continue
expect "Do you want to add another client processor to the\r\n/var/diskless/clients directory? (y/n) [n]: " send "n\r"; continue
expect "#" send "mkdir /var/diskless/dlenv0/root0.vax/usr/users\r"; continue
expect "#" send "ed /var/diskless/dlclient0/%VSTANAME%.root/etc/fstab\r"; send -t after=1000k delay=500k "a\r/usr/users@%HOSTNAME%:/usr/users:rw:0:0:nfs:hard:\r\004w\rq\r"; continue
expect "#" send "ed /var/diskless/dlclient0/%MVAXNAME%.root/etc/fstab\r"; send -t after=1000k delay=500k "a\r/usr/users@%HOSTNAME%:/usr/users:rw:0:0:nfs:hard:\r\004w\rq\r"; continue
expect "#" send "ed /etc/passwd\r"; send -t after=1000k delay=500k "1,$s/ris:Nologin:/ris::\rw\rq\r"; continue
expect "#" send "shutdown -h now\r"; continue
goto EOS
:EOS
continue
:STOP
echo 
