home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 29 Fixes_o
/
29-Fixes_o.zip
/
ap8152b1.dsk
/
RPLDOS7.ZIP
/
RPLDOS7.CMD
Wrap
OS/2 REXX Batch file
|
1995-03-03
|
12KB
|
395 lines
/* RPLDOS7.CMD */
/* This procedure installs the IBM PC DOS 7.0 */
/* for LAN Server remote IPL. */
/* */
/* Copyright: (C) Copyright IBM Corp. 1995 */
/* DPD */
/* load REXX utilities, requires OS/2 2.0 or above */
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
nummsglines = 0
drive = 'A'
numdosdiskettes = 5
nuloutput = ' 1>nul 2>nul'
unpackflags = ' /V /P /C'
/* Process any command line parameters, none required - all optional */
Parse Arg parm.1 parm.2 parm.3 .
Call Get_Input_Parameters
If result <> 0 Then Exit
/* determine path to CONFIG.SYS and \IBMLAN tree */
Call Find_Path_Info
If result <> 0 Then Exit
/* check for PROTECTONLY=NO and BASEDEV=XDFLOPPY.FLT in CONFIG.SYS */
Call Check_CONFIG_SYS
If result <> 0 Then Exit
/* Get the version of LAN Server installed on the Remote IPL server. */
Call Get_LAN_Server_Version
If result <> 0 Then Exit
Call Verify_Server_Started
If result <> 0 Then return error_access_denied_in_use
Call Verify_Admin_Privilege
If result <> 0 Then return error_access_denied_in_use
/* verify existance of \IBMLAN\INSTALL\RIB2.EXE file */
Call Get_RIB2_EXE
If result <> 0 Then Exit
/* copy all files from the DOS diskettes */
Call Copy_DOS_disks
If result <> 0 Then Exit
/* find DOS bundle files in \IBMLAN\DOSLAN\DOS and build BAT file */
Call Build_BAT_file
If result <> 0 Then Exit
/* launch DOS box and call d:\IBMLAN\DOSLAN\DOS\UNPACK7.BAT */
Call Run_BAT_file
If result <> 0 Then Exit
/* set Access Control Profiles for new subdirs under IBMLAN\DOSLAN\DOS */
Call Set_ACLs
If result <> 0 Then Exit
Say ' '
Say 'Installation of IBM PC DOS 7.0 for remote IPL is complete.'
Say ' '
Say 'NOTE: Remote IPL DOS images file must be rebuilt to include this DOS version.'
return
/* end of main function */
/* find path to CONFIG.SYS and \IBMLAN directory tree */
Find_Path_info:
os2path = value('PATH',,'OS2ENVIRONMENT')
ibmlanp = pos(':\IBMLAN', translate(os2path))
if ibmlanp = 0 Then Do
Say 'Could not determine location of \IBMLAN directory.'
Beep(100,500)
return 4
end
os2p = pos(':\OS2', translate(os2path))
if os2p = 0 Then Do
Say 'Could not determine OS/2 boot drive letter.'
Beep(100,500)
return 4
end
/* set up paths required for this program */
landrv = substr(os2path, ibmlanp-1, 1)
lanpath = landrv':\IBMLAN'
imagespath = lanpath'\DCDB\IMAGES'
dospath = lanpath'\DOSLAN\DOS'
installpath = lanpath'\INSTALL'
rib2path = installpath'\RIB2.EXE'
pkunzippath = installpath'\PKUNZIP2.EXE'
unpackpath = dospath'\UNPACK2'
batfile = dospath'\UNPACK7.BAT'
os2drv = substr(os2path, os2p-1, 1)
configsys = os2drv':\CONFIG.SYS'
return 0
/* check for PROTECTONLY=NO and BASEDEV=XDFLOPPY.FLT in CONFIG.SYS */
Check_CONFIG_SYS:
retf = 0
protectonly_found = FALSE
xdfloppy_found = FALSE
do until lines(configsys) = 0
data = linein(configsys)
/* read CONFIG.SYS looking for the PROTECTONLY entry */
protectonly = pos('PROTECTONLY=NO', translate(data))
/* read CONFIG.SYS looking for the BASEDEV=XDFLOPPY entry */
basedev = pos('XDFLOPPY.FLT', translate(data))
if protectonly <> 0 then do
protectonly_found = TRUE;
end
if basedev <> 0 then do
xdfloppy_found = TRUE;
end
if protectonly_found = TRUE & xdfloppy_found = TRUE then do
leave
end
end
Call stream configsys,C,'close'
if protectonly_found = FALSE then do
Say 'VDM support was not found.'
Beep(100,500)
retf = 4
end
if xdfloppy_found = FALSE then do
Say 'Support for XDF formatted diskettes was not found.'
Beep(100,500)
retf = 4
end
return retf
/* Get the version of LAN Server installed on the Remote IPL server. */
Get_LAN_Server_Version:
/* Read the first 60 bytes of SYSLEVEL.SRV and check the current server level*/
filename = lanpath'\SYSLEVEL.SRV'
syslevel = ''
/* read syslevel file, try to get it with a single linein call */
syslevel = Linein(filename)
Call Lineout filename /* close file */
If Length(syslevel) < 60 Then Do
/* single linein did not get enought of file, get syslevel */
/* character at a time */
syslevel = ''
Do i = 1 to 60
syslevel = syslevel || charin(filename)
end
Call Charout filename
end
verp = pos('IP', syslevel)
If verp <> 0 Then LS_version = substr(syslevel, verp+3, 4)
If LS_version = '' Then Do
Say 'Could not determine IBM LAN Server version.'
Beep(100,500)
return 4
end
Else do
If substr(LS_version, 1, 1) = '8' Then LS_Version_4 = TRUE
Else LS_Version_4 = FALSE
end
return 0
/* verify server started, must set ACL's on new directories */
Verify_Server_Started:
'@NET CONFIG SERVER 1>NUL'
If rc <> 0 Then Do
Say 'The SERVER service must be started to set Access Control Profiles.'
Beep(100,500)
return 4
end
return 0
/* verify administrator privilege, must set ACL's on new directories */
Verify_Admin_Privilege:
/* issue NET SESS which requires administrator privilege */
'@NET SESS 1>NUL'
If rc <> 0 Then Do
Say 'You must be logged on with Administrator privilege to set Access Control Profiles.'
Beep(100,500)
return 4
end
return 0
/* Copy required LAN Server installation files if not found */
Get_RIB2_EXE:
If stream(rib2path, 'C', 'QUERY EXISTS') = '' | stream(pkunzippath, 'C', 'QUERY EXISTS') = '' Then Do
/* make sure IBMLAN\INSTALL directory exists */
Call SysMkDir installpath
/* prompt for SERVER 1 diskette */
Say 'Insert LAN Server diskette SERVER 1 into drive' drive
Beep(1000,300)
Pull dummy .
/* copy PKUNZIP2.EXE and then unzip RIB2.EXE from SRVRINST.ZIP */
'@copy ' || drive || ':\PKUNZIP2.EXE ' || installpath || nuloutput
'@' || pkunzippath || ' -o ' || drive || ':\SRVRINST.ZIP ' || installpath || ' IBMLAN\INSTALL\RIB2.EXE' || nuloutput
end
return 0
/* copy all files from the DOS diskettes */
Copy_DOS_disks:
Do i = 1 to numdosdiskettes
/* process DOS diskette i */
diskettevalid = 0
Do while diskettevalid = 0
srcfile = drive || ':'
Say 'Insert IBM PC DOS 7.0 diskette' i 'into drive' drive
Beep(1000,300)
Pull dummy .
driveinfo = SysDriveInfo(srcfile)
drivelabel = word(driveinfo, 4) || ' ' || word(driveinfo, 5)
If drivelabel = ('DISK ' || i) Then diskettevalid = 1
end
Say 'Copying files . . .'
'@copy ' || drive || ':\*.* ' || dospath || nuloutput
If i = 1 Then Do
/* call RIB2.EXE to get system files and boot sector */
'@' || rib2path || ' ' || imagespath || nuloutput
end
Say ' '
end
return 0
/* find DOS bundle files in \IBMLAN\DOSLAN\DOS and build BAT file */
Build_BAT_File:
/* get list of all DOS bundle files in \IBMLAN\DOSLAN\DOS directory */
srcdir = dospath || '\*.'
Call SysFileTree srcdir, filelist, 'FO'
If filelist.0 <> 0 Then Do
/* build \IBMLAN\DOSLAN\DOS\UNPACK7.BAT file */
Call stream batfile,'c','open write'
/* put REM statements in BAT file */
Call lineout batfile, 'REM ****************************************************************'
Call lineout batfile, 'REM * This file is used by LAN Server Installation/Configuration *'
Call lineout batfile, 'REM * Program(LANINST) to decompress DOS files for remote IPL. *'
Call lineout batfile, 'REM ****************************************************************'
/* put APPEND /PATH:OFF in BAT file to prevent overwrite of OS/2 files */
Call lineout batfile, 'APPEND /PATH:OFF'
Do j = 1 to filelist.0
/*build unpack bundle file lines into the BAT file */
bundlefile = translate(filelist.j)
batfilestring = unpackpath || ' ' || bundlefile || ' ' || dospath || unpackflags
Call lineout batfile, batfilestring
end /* end of record scan */
Call lineout batfile, 'EXIT'
/* close the BAT file */
Call stream batfile,'c','close'
end
else Do
Say 'DOS bundle files could not be found.'
Beep(100,500)
return 4
end
return 0
/* launch DOS box and call d:\IBMLAN\DOSLAN\DOS\UNPACK7.BAT */
Run_BAT_file:
Say 'Starting a DOS session to decompress DOS bundle files . . .'
/* start a VDM to run UNPACK7.BAT file to decompress bundles */
'@' || batfile
return 0
/* must set ACL's on new directories under \IBMLAN\DOSLAN\DOS */
Set_ACLs:
Say ' '
Say 'Creating Access Control Profiles for RPLGROUP . . .'
'@NET ACCESS ' || dospath || ' /ADD ' || 'RPLGROUP:RX 1>NUL 2>' || retmsg
If rc <> 0 Then Do
data = linein(retmsg)
If substr(data, 1, 3) = 'NET' Then Do
errornum = substr(data, 4, 4)
/* error NET2225 is OK, access controls already exist */
If errornum <> '2225' Then Do
Say 'Error NET' errornum 'occurred while creating Access Control Profiles.'
Beep(100,500)
return 4
end
end
Else do
errornum = substr(data, 4, 4)
Say 'Error' errornum 'occurred while creating Access Control Profiles.'
Beep(100,500)
return 4
end
end
/* apply access controls to all new subdirs under \IBMLAN\DOSLAN\DOS */
If LS_Version_4 = TRUE Then
'@NET ACCESS ' || dospath || ' /APPLY 1>NUL 2>' || retmsg
Else
If rc <> 0 Then Do
data = linein(retmsg)
If substr(data, 1, 3) = 'NET' Then Do
errornum = substr(data, 4, 4)
Say 'Error NET' errornum 'occurred while creating Access Control Profiles.'
Beep(100,500)
return 4
end
Else do
errornum = substr(data, 4, 4)
Say 'Error' errornum 'occurred while creating Access Control Profiles.'
Beep(100,500)
return 4
end
end
return 0
/* Process any command line parameters, none required - all optional */
Get_Input_Parameters:
Do i = 1 to 3
If parm.i = '' Then Leave
parmtype = translate(substr(parm.i,1,2))
select
when parmtype = '/?' Then Call Display_Syntax
when parmtype = '?' Then Call Display_Syntax
when parmtype = '/D' Then Do
if substr(parm.i, 3, 1) = ':' Then drive = substr(parm.i, 4)
else drive = substr(parm.i, 3)
drive = translate(drive)
end
when parmtype = '/N' Then Do
if substr(parm.i, 3, 1) = ':' Then numdosdiskettes = substr(parm.i, 4)
else numdosdiskettes = substr(parm.i, 3)
end
otherwise Do
Say parm.i 'is not a valid option.'
Beep(100,500)
return 4
end
end
end
return 0
/* Display the command syntax for this program */
Display_Syntax:
Say ' '
Say 'RPLDOS7 [/D:source_drive_letter] [/N:number_dos_diskettes]'
Say ' default source_drive_letter = A:'
Say ' default number_dos_diskettes = 5'
Say ' '
exit 0