;
; Jennifer Harrington
; Hewlett-Packard (RND)
; October, 1990
;
; Modified by Tamra Perez
; January 13, 1992

; An installation program for loading any application with
; the following limitations:

;     * The application must be contained on 1 or 2 floppy disks.
;     * Each disk must contain 4 or fewer subdirectories.
;     * All files to be loaded must be in the subdirectories
;       except the setup programs themselves (setup.exe and setup.txt)
;       and one or more batch files (*.bat).

; To use this program for your application: 

;     * Edit the MESSAGE section below, making sure to keep the 
;       same content on the same lines.  Do not add lines or delete
;       lines.  Change text within the quotes only.

;     * Edit the DIRECTORIES section, following the instructions
;       exactly.  Do not add or delete data lines.  Use the exact
;       directory format described.  Instructions are written after
;       the semicolons.
   
;     * Include setup.exe and setup.txt (this file)
;       in the root directory of disk 1 of your application.

;     * Make sure there is at least one batch file in the root
;       directory of disk 1 of your application.  These batch files 
;       will be loaded to the root directory of the destination drive
;       on the hard disk.  (Generally, these batch files are
;       the application start-up files.)

;      * Make sure ALL other files to be copied are located in
;        subdirectories on the floppy disks (NOT in the root
;        directories).

;      * To run the setup procedure, go to the drive containing
;        disk 1 of your application and enter SETUP.
                           



; ************************************************************
;   MESSAGES: Edit these lines for your application.  Do not move
;   any messages to different lines.  Do not add or delete
;   lines.  

;   CHANGE THE TEXT WITHIN THE QUOTES ONLY.  
;   Do not delete quote marks.

; ************************************************************

data var1 "This will install the HP EtherTwist Network Management"
data var2 "Computer-Based Training on any hard disk drive on your PC."
data var3 "The drive must have at least 1 MByte of free disk space.  Your"
data var4 "PC must have at least 145K of conventional memory available."
data var5 " "
data var6 "To install the course, you will need the HP EtherTwist"
data var7 "Network Management Computer-Based Training disk."
data var8 "Do you want to install the course now? "

data var13 "Enter the letter of the hard disk drive where"
data var14 "you would like the course installed. " 

data var15 "Copying to "

data var16 "Please remove disk 1 and insert disk 2."
data var17 "Press any key when ready . . ."

data var18 "The installation is complete."
data var19 " "
data var20 "To start the course, go to drive and enter NETMGMT"

data var21 "Please make sure the HP EtherTwist Network Management"
data var22 "Computer-Based Training disk is correctly inserted in drive "

data var26 "Please make sure disk 2 of the HP Managing Your Network"
data var27 "Computer-Based Training is correctly inserted in drive "

data var28 "Please make sure you are entering the letter of a valid"
data var29 "hard disk drive on your PC and that the drive has at least"
data var30 "1 MByte of hard disk space.  Press Ctrl-C to quit now."

data var31 "The training has NOT been installed.  Please check"
data var32 "the following and try again."
data var33 "   * Is there at least 1 MByte of disk space on your"
data var34 "     hard disk?"
data var35 "   * Was the HP EtherTwist Network Management CBT disk"
data var36 "     correctly inserted in the disk drive?"   
data var37 "   * Try running CHKDSK on the hard disk and floppy disk"
data var38 "     to be sure there are no errors on any disks."
data var39 "   * If you pressed CTRL-C or CTRL-Break, the installation"
data var40 "     was interrupted and must be started again." 

; **************************************************************
;   DIRECTORIES: Follow the instructions exactly.
;                Do not change the format of directory listings.
;                Be sure to leave the first two words ("data varxx")
;                the same.  Change the last part only, according
;                to the instructions.  Instructions are written
;                after the semicolons.
; **************************************************************

data var50 1000            ; This is the amount of hard disk space  
                           ; needed for the application.
                           ; Express the disk space in Kbytes.

                           ; Example:
                           ;     data var50 1600

                           ; means 1600 Kbytes of hard disk space 
                           ; is needed. 
                    
                           
data var60 "NETMGMT.BAT"   ; This is the name of a batch file that will be
                           ; loaded to the root directory of the 
                           ; destination drive.  This file MUST reside
                           ; in the root directory of disk 1 of the
                           ; application.  You can have more than one
                           ; batch file loaded to the root of the
                           ; destination.  All must be in the root of
                           ; the application disk, but you only need to
                           ; list one of them, here.  (This file is used
                           ; to test to be sure the correct disk is in
                           ; the drive.)
                           
                           ; Be sure to put the filename in quotes and
                           ; include the extension.  Do not include a
                           ; drive or path designation.

                           ; Example:    
                           ;    data var60 "HPROUT.BAT"
                           
                           ; will copy the file, HPROUT.BAT to the
                           ; root directory of the destination drive.



             ; The following lines are used to list each directory
             ; that will be created on the destination hard disk
             ; drive.  Be sure to list each parent directory and
             ; each subdirectory, starting FROM THE TOP DOWN.  For
             ; example, if you have a directory, HPROUTER, with two
             ; subdirectories under it, list HPROUTER first.  These
             ; directories will be created in the order listed.

             ; Put the directory name in quotes.  Do NOT include
             ; a drive letter or initial slash.  Do NOT include a
             ; slash at the end.

             ; Example:
             ;    data var110 "HPROUTER\STUDENT"

             ; will create a subdirectory under HPROUTER
             ; named STUDENT.

             ; The line following each directory name must indicate
             ; the number of files to be copied into that directory.
             ; This number should represent the number of files
             ; in that directory only, NOT including files in
             ; subdirectories under it.  Designate 0 here if you
             ; want the subdirectory created but no files copied
             ; to it. 

             ; Example:
             ;    data var111 30

             ; will copy 30 files into the subdirectory.

             ; There is room for 4 directories on each source disk.
             ; Be sure disk 1 directories are in the "disk 1" 
             ; section (var110 through var141) and disk 2
             ; directories are in the "disk 2" section (var210
             ; through 241).  List all directories in sequence.
             ; If you have fewer than 4 directories for a disk,
             ; complete the rest with "NULL" as the directory name
             ; and 0 as the number of files.



; DISK 1 directories

data var110 "NETMGMT"           ; directory for disk 1 in quotes
data var111 19                  ; number of files to be copied
data var120 "NETMGMT\STUDENT"   ; disk 1 directory
data var121 0                   ; number of files
data var130 "NETMGMT\GRAPH_1"   ; disk 1 directory
data var131 131                 ; number of files
data var140 "NULL"              ; disk 1 directory ("NULL" for none)
data var141 0                   ; number of files (0 for none)


; DISK 2 directories

data var210 "NULL"              ; directory for disk 2 in quotes
data var211 0                   ; number of files to be copied
data var220 "NULL"              ; disk 2 directory
data var221 0                   ; number of files
data var230 "NULL"              ; disk 2 directory
data var231 0                   ; number of files
data var240 "NULL"              ; disk 2 directory ("NULL" for none)
data var241 0                   ; number of files (0 for none)


; ************************************************************ 
;     PROGRAM CODE: Do not edit beyond this point 
;                   unless you want to change the way
;                   this program actually works. 
; ************************************************************

;  VARIABLES
;     answer: user answer to a Y/N question
;     status: result of a test command
;     sdrive: source drive for copying, eg. "A:\" 
;     ddrive: destination drive for copying
;     source: source directory or file for copying
;       dest: destination directory for copying



;  MAIN PROGRAM

; intro, do you want to continue?

cls
print "~" "~" var1 "~" var2 "~" var3 "~" var4 "~" "~" 
print var5 "~" var6 "~" var7 "~" "~" var8
input 1 answer "Y"                                    
if answer = "N" stop
if answer = "n" stop

; get source drive

whichdrive sdrive
strcat sdrive ":\"

; is the right disk in?

set source sdrive
strcat source var60
exist source status
if status != 1 gosub wrongsource1

; input destination drive

print "~" "~" var13 "~" var14
input 1 ddrive "C"
strcat ddrive ":\"

; does destination have enough space?

free ddrive status
if status < var50 gosub wrongdest

; copy batch file

onerror goto diskerror         ;trap errors
onbreak goto diskerror
changedrive sdrive
cd "\"
echo off
copy "*.bat" ddrive status
echo on

; create and copy each directory on disk 1

cls

if var110 = "NULL" goto disk2                 ;done with this disk?
set dest ddrive                               ; create directory
strcat dest var110
mkdir dest status
if var111 != 0 print "~" "~" var15 dest "~"   ; print copy heading
cd "\"                                        ; change to source directory 
cd var110
fcount 0                                      ; copy files
if var111 != 0 copyb "*.*" dest status var111 

if var110 = "NULL" goto disk2
set dest ddrive
strcat dest var120
mkdir dest status
if var121 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var120
fcount 0
if var121 != 0 copyb "*.*" dest status var121 

if var130 = "NULL" goto disk2
set dest ddrive
strcat dest var130
mkdir dest status
if var131 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var130
fcount 0
if var131 != 0 copyb "*.*" dest status var131 

if var140 = "NULL" goto disk2
set dest ddrive
strcat dest var140
mkdir dest status
if var141 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var140
fcount 0
if var141 != 0 copyb "*.*" dest status var141 



disk2

; Tamra Perez 12/4/91
; Added test to see if need second disk.
if var210 = "NULL" goto done

; install and check disk 2 

print "~" "~" var16 "~" var17
echo off
input 1 answer
echo on
set source sdrive
strcat source var210
exist source status
if status != 2 gosub wrongsource2

; create and copy each subdirectory on disk 2

cls

if var210 = "NULL" goto done
set dest ddrive
strcat dest var210
mkdir dest status
if var211 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var210
fcount 0
if var211 != 0 copyb "*.*" dest status var211 

if var220 = "NULL" goto done
set dest ddrive
strcat dest var220
mkdir dest status
if var221 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var220
fcount 0
if var221 != 0 copyb "*.*" dest status var221 

if var230 = "NULL" goto done
set dest ddrive
strcat dest var230
mkdir dest status
if var231 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var230
fcount 0
if var231 != 0 copyb "*.*" dest status var231 

if var240 = "NULL" goto done
set dest ddrive
strcat dest var240
mkdir dest status
if var241 != 0 print "~" "~" var15 dest "~"
cd "\"
cd var240
fcount 0
if var241 != 0 copyb "*.*" dest status var241 

done
changedrive ddrive
cd "\"
print "~" "~" "~" var18 "~" var19 ddrive var20
stop

;  SUBROUTINES
;     wrongsource1: source directory or disk 1 is invalid
;     wrongsource2: source directory or disk 2 is invalid
;        wrongdest: destination directory is invalid
;        diskerror: a disk error encountered during copy

    
wrongsource1
loop1
cls                                    ; error message  
print "~" "~" "~" "~" var21 "~" var22 sdrive "~" "~" var17
input 1 answer
set source sdrive                      ; correct disk in?
strcat source var60
exist source status
if status != 1 goto loop1
cls
return

wrongdest
loop2
cls                                ; error message
print "~" "~" "~" "~" var28 "~" var29 "~" var30 
print "~" "~" var13 "~" var14      ; get drive again
input 1 ddrive "C"
strcat ddrive ":\"
free ddrive status                  ; enough disk space?
if status < var50 goto loop2
return

wrongsource2
loop3
cls                                 ; error message  
print "~" "~" "~" "~" var26 "~" var27 sdrive "~" var17
input 1 answer 
set source sdrive                   ; correct disk in?
strcat source var210
exist source status
if status != 2 goto loop3
return

diskerror
cls                                 ;error message, then quit
print "~" "~" "~" "~" var31 "~" var32 "~" var33 "~" var34 "~" var35 "~" 
print var36 "~" var37 "~" var38 "~" var39 "~" var40 "~"
stop


