home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************/
- /* SAMPINST.CMD */
- /* */
- /* Purpose: Uses XCOPY to install all files from a sub directory */
- /* into a user specified destination directory. */
- /* */
- /* Parameters: BootDrive: Drive letter where system boots */
- /* Install Drive: Drive letter and path of CDROM */
- /* Program Name: Name of the program to install. */
- /* Source: Directory where program is located. */
- /* Destination: Default installation directory. */
- /* Options: any options */
- /***********************************************************************/
- /* (C) Copyright IBM Corporation 1993 */
- /***********************************************************************/
- parse upper arg Ctl.!BDr Ctl.!CDr Ctl.!ProgName Ctl.!Source Ctl.!Destination Ctl.!Options
- trace 'o'
- call on halt
- Globals = 'Ctl.' 'RXCADD.'
-
- call Initialize
-
- if RxCaDD.OpType = 'REMOVE'
- then do
- call 'MessageBox' Ctl.!ProgName, 'Remove is not supported. Add the application',
- 'again to recreate the program object.'
- call 'CaDDExit'
- exit 0
- end /* Do */
-
- if substr(Ctl.!BDr,2,1) <> ':' | substr(Ctl.!CDr,2, 1) <> ':'
- then call MyExit 302
- if \Ctl.!Quiet
- then call PromptDestination Ctl.!Destination
- Resp = MakeDestination(Ctl.!Destination)
- Ctl.!CurDir = directory()
- temp = directory(Ctl.!Destination)
- if temp <> Ctl.!Destination
- then call MyExit 303
- call directory(Ctl.!CurDir)
- call CopyFiles
- call MyExit 0
- exit
-
- Initialize: procedure expose (Globals)
- CurDir = directory()
- call directory Ctl.!CDr'INSTALL'
- call Rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
- Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
- Call SysLoadFuncs
- signal on syntax
- ver = 'CAddInit'()
- signal off syntax
- if abbrev(ver, 'ERROR:')
- then call syntax
- Ctl.!Valid = 0
- Ctl.!Quiet = (wordpos('/N', Ctl.!Options) <> 0)
- Ctl.!NoComp = (wordpos('/C', Ctl.!Options) <> 0)
- return 0
-
- CopyFiles: procedure expose (Globals)
- '@ECHO OFF'
- if \Ctl.!Quiet
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('Copying files for 'Ctl.!Progname' Please wait...',76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* Do */
- do while queued() <> 0
- pull .
- end /* do */
- 'XCOPY 'Ctl.!Source'\*.*' Ctl.!Destination'\*.* /s /e >nul 2>nul'
- 'MKDIR 'Ctl.!Destination'\OS2LIB 2>NUL'
-
- /* Register the class with the Workplace Shell */
- if SysRegisterObjectClass( 'Browse_O_Matic', Ctl.!Destination'\BROWSE\BROWSE.DLL')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('Browse_O_Matic class registered sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error registering the Browse_O_Matic class.'
- /* Create an object instance of the class */
- if SysCreateObject( 'Browse_O_Matic', 'Browse-O-Matic', '<DEVCON_OS2_FOLDER>', 'OBJECTID=BROWSE001', 'R')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('Browse-O-Matic instance created sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error creating Browse-O-Matic instance.'
-
- /* Register the class with the Workplace Shell */
- if SysRegisterObjectClass( 'TextFolder', Ctl.!Destination'\TEXTFLDR\TEXTFLDR.DLL')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('TextFolder class registered sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error registering the TextFolder class.'
-
- /* Create an object instance of the class */
- if SysCreateObject( 'TextFolder', 'TextOnlyFolder', '<DEVCON_OS2_FOLDER>', 'OBJECTID=TEXTFLDR001', 'R')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('TextFolder instance created sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error creating TextFolder instance.'
-
- /* Register the class with the Workplace Shell */
- if SysRegisterObjectClass( 'WPSTutorial', Ctl.!Destination'\WPSTUTOR\WPSTUTOR.DLL')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('WPSTutorial class registered sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error registering the WPSTutorial class.'
-
- /* Create an object instance of the class */
- if SysCreateObject( 'WPSTutorial', 'WPSTutorial', '<DEVCON_OS2_FOLDER>', 'OBJECTID=WPSTUT001', 'R')
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('WPSTutorial instance created sucessfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* do */
- else say 'Error creating WPSTutorial instance.'
- if \Ctl.!Quiet
- then do
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│'center('Installation completed successfully.', 76)'│'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- end /* Do */
- return 0
-
- PromptDestination: procedure expose (Globals)
- parse arg path
- '@ECHO OFF'
- do until answer = 'Y'
- 'cls'
- say
- say '┌────────────────────────────────────────────────────────────────────────────┐'
- say '│ The Developer Connection │'
- say '│ 'right(Ctl.!ProgName,20)' Installation │'
- say '│ (C) Copyright IBM Corporation 1994 │'
- say '└────────────────────────────────────────────────────────────────────────────┘'
- say
- say 'The installation path for 'Ctl.!ProgName' is 'path
- say
- say 'To ONLY change the drive, enter d: (where d is the new drive letter)'
- say 'To ONLY change the path, enter \path (where path is the new path)'
- say
- say 'Enter a new destination for 'Ctl.!ProgName', hit enter for default path, or Q to QUIT:'
-
- tmppath = translate(linein(STDIN))
- if tmppath = 'Q'
- then call MyExit 300
- if tmppath \= ''
- then do
- if (length(tmppath)=2) & (substr(tmppath,2,1)=':') then
- tmppath = tmppath||substr(path,3)
- else if substr(tmppath,1,1)='\' then
- tmppath=substr(path,1,2)||tmppath
- say
- say tmppath' is the new path. Is this correct (Yes/No)?'
- answer = translate(linein(STDIN))
- l1 = substr(answer, 1, 1)
- do while l1 \= 'Y' & l1 \= 'N'
- say beep(450,150)'Please enter Y(es) or N(o)'
- answer = translate(linein(STDIN))
- l1 = substr(answer, 1, 1)
- end /* do */
- parse value reverse(RxCadd.ProgInfo.4) with fname'\'.
- RxCadd.ProgInfo.4='EXE='tmppath'\'reverse(fname)
- RxCadd.ProgInfo.6='WORKDIR='tmppath
- if right(tmppath,1) = '\'
- then tmppath = strip(tmppath, 'T', '\')
- Ctl.!Destination = tmppath
- end
- else return path
- end /* Do */
- return
-
- MakeDestination: procedure expose (Globals)
- parse arg subdir
- dirty = 0
- '@ECHO OFF'
- do forever
- 'mkdir 'subdir' >nul 2>nul'
- if rc = 0 | dirty = 1 | length(subdir) <= 2
- then return rc
- else do
- call MakeDestination(substr(subdir,1,(lastpos('\',subdir)-1)))
- Dirty = 1
- end /* Do */
- end /* do */
- return rc
-
- MyExit: procedure expose (Globals)
- parse arg Resp
-
- select
- when Resp = 300 & \Ctl.!Quiet
- then do
- call 'MessageBox' Ctl.!ProgName, 'Installation ended by user.'
- end /* Do */
- when Resp = 301 & \Ctl.!Quiet
- then do
- call 'MessageBox' Ctl.!ProgName, 'Installation failed when copying files to 'Ctl.!Destination'.'
- end /* Do */
- when Resp = 302 & \Ctl.!Quiet
- then do
- call 'MessageBox' Ctl.!ProgName,'Could not find OS/2 2.0 Boot Drive or CD-ROM path.',
- 'Make sure that INSTALL was run from the drive letter of the CD-ROM.'
- end /* Do */
- when Resp = 303 & \Ctl.!Quiet
- then do
- call beep 250, 150
- call 'MessageBox' Ctl.!ProgName, 'Could not create destination directory 'Ctl.!Destination
- end /* Do */
- otherwise
- nop
- end /* select */
- if \Ctl.!NoComp
- then do
- call 'CaddComplete' Resp
- call 'CaDDExit'
- end
- exit Resp
-
-
- Syntax:
-
- call beep 350, 150
- say
- say '┌────────────────────────────────────────────────────────────────────────┐'
- say '│ Dot not found in LIBPATH. A dot will be automatically added to your │'
- say '│ CONFIG.SYS LIBPATH entry. The DOT is necessary for the installation │'
- say '│ to find its DLL files in the current directory. │'
- say '└────────────────────────────────────────────────────────────────────────┘'
- '@echo off'
- 'call LIBADD . 'Ctl.!BDr'\CONFIG.SYS >nul 2>nul'
- Resp = rc
- if rc = 0
- then do
- call beep 350, 150
- say
- say '┌────────────────────────────────────────────────────────────────────────┐'
- say '│ REBOOT the system and try install again. │'
- say '└────────────────────────────────────────────────────────────────────────┘'
- end
- else do
- call beep 350, 150
- say
- say '┌────────────────────────────────────────────────────────────────────────┐'
- say '│ Unable to update CONFIG.SYS please do so manually then REBOOT. │'
- say '└────────────────────────────────────────────────────────────────────────┘'
- end /* Do */
- exit 200
-
- halt:
-
- call MyExit 2
- return
-