/*----------------------------------------------------------------------------*/ /* */ /* Filename: */ /* install.cmd */ /* */ /* Project: AMU 3.10x installation for all AML models */ /* */ /* Description: */ /* Installation of AMU and the environment */ /* Author: */ /* Dirk Hagenberg */ /* History: */ /* 19. Mai 1995 - 8:21,38 */ /* 20. August 1998 changed DLL_BACKUP_DIRECTORY */ /* 04. December 1998 changed AMU-Libpath to .\DLL; */ /* 14. April 1999 additional copy of DDE4*.DLL */ /* 14. June 1999 install from CDROM possible */ /* 21. September 1999 installation of AMU 3.1 with DCI */ /* 21. December 1999 install of SCSI util with each version */ /* 28. March 2000 change patch of set active and KRNLOAD */ /*----------------------------------------------------------------------------*/ /* */ /* (C) Copyright by ADIC/GRAU Storage System 1995 - 2000 */ /* */ /*----------------------------------------------------------------------------*/ InstProgVersion = "3.10.1" /*----------------------------------------------------------------------------*/ /* Definitions and variable initialisation */ /*----------------------------------------------------------------------------*/ Version = "3.10C" /* version number in the form x.xxxx ,e.g. "3.02 " */ Anz_Disks = 6 /* number of disks for AMU */ Backup_Directory = "\B4_x_xx" /* directory for previous installed AMU */ CONFIG_SYS = "C:\CONFIG.SYS" CONFIG_NEW = "C:\CONFIG.NEW" FileName = "AMUDISC" AMUPATH = "C:\AMU" InstallLog = "\install.log" call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' rcy = rxfuncadd('SQLDBS' , 'SQLAR','SQLDBS' ); rcy = rxfuncadd('SQLEXEC', 'SQLAR','SQLEXEC'); call SysLoadFuncs /*----------------------------------------------------------------------------*/ /* Flags for the selection of install options */ /*----------------------------------------------------------------------------*/ InstStart = 0 IniSaved = 0 /* Flag for the saved ini file */ QuadSupport = 0 /* Flag for installation of Quadron software */ PMAC = 0 /* Flag for installation of AML/J software */ SCSI = 0 /* Flag for installation Scalar 1000 software */ New_Inst = 0 /* Flag for general new installation */ ConfigUpdate = 0 /* Flag for Update of config.sys */ UpdOption = 0 Floppy_Inst = 0 /* Installation from floppy */ InstError = 0 /* Failure during installation process */ Dual = 0 /*----------------------------------------------------------------------------*/ /* Definition of the directories */ /*----------------------------------------------------------------------------*/ Install_Directory = directory() Floppy_Inst = compare(Install_Directory, 'A:\') Backup_Directory = overlay(Version, Backup_Directory, 5) Backup_Directory = overlay('_', Backup_Directory, 6) Backup_Directory = insert(AMUPATH,Backup_Directory) InstallLog = insert(AMUPATH,InstallLog) DLL_Backup_Directory = insert(Backup_Directory,"\DLL") CAN_Backup_Directory = insert(Backup_Directory,"\CAN") SCSI_Backup_Directory = insert(Backup_Directory,"\SCSI") lastbs = LASTPOS('\',Install_Directory) inst_di_length = length(Install_Directory) If inst_di_length = lastbs then do inst_di_length = inst_di_length - 1 Install_Directory = substr(Install_Directrory,1,inst_di_length) end SCSI_Install_Dir = insert(Install_Directory,"\SCSI") /*----------------------------------------------------------------------------*/ /* main */ /*----------------------------------------------------------------------------*/ '@echo off' call CreateDir AMUPATH say "" Call LogWrite "---------------------------------------------------" call LogWrite "Start of AMU Installation of version: "Version call LogWrite "Installationprogram version: "InstProgVersion call LogWrite "Installationdate was the "Date() call LogWrite "AMUPATH= ["AMUPATH"]" call LogWrite "Installation Directory= ["Install_Directory"]" call LogWrite "Backup Directory= ["Backup_Directory"]" curdir = directory(AMUPATH) call GetActualVersion if InstOpt <> 1 then call MenuMain /*---------------------------------------------------------------------------*/ /* New Installation */ /*---------------------------------------------------------------------------*/ If InstOpt = 1 then do InstType = "New Installation " do until (InstStart = 1) call MenuRobot call MenuDIM call MenuDAS if RobType <> 3 then do call MenuDCI call MenuDual end call MenuUser end /* while InstStart = 0 */ call PrepareNewInstall call Install call config_update 0 call AmuConf_Update call SetActive call WriteStartup 'C:\STARTUP.CMD' call WriteAmustart call GoodEnd end /*-----------------------------------------------------------------------------*/ /* Update from a previous AMU */ /*-----------------------------------------------------------------------------*/ if InstOpt = "2" then do Call LogWrite "Update with VersOpt="VersOpt if (VersOpt = 4) then /* update from version 3.10 */ /* use of the complete existing configuration, no changes */ do call Update call Backup 1 call Install copy AMUPATH"\AMUCONF.SIC "AMUPATH"\AMUCONF.INI" call AmuConf_Update 2 call config_update call DataBind call DoThePatchesToAMUCONST call SetActive call GoodEnd end if (VersOpt = 3) then /* Update from version 3.02 */ do do until (InstStart = 1) call MenuRobot call MenuDIM call MenuDAS if RobType <> 3 then do call MenuDCI call MenuDual end call MenuUser end call Update call Backup 0 /* no backup of CAN directory */ call Install copy AMUPATH"\AMUCONF.SIC "AMUPATH"\AMUCONF.INI" call AmuConf_Update 2 call config_update curdir = directory(AMUPATH) DBConv call DataBind /* call config_update */ call DoThePatchesToAMUCONST call SetActive /* call UpdateStartup 'C:\STARTUP.CMD' */ call WriteAmustart call GoodEnd end if (VersOpt = 2) then /* Update from AMU 2.40x before */ do do until (InstStart = 1) call MenuRobot call MenuDIM call MenuDAS if RobType <> 3 then do call MenuDCI call MenuDual end call MenuUser end call Update call Backup 0 call Install copy AMUPATH"\AMUCONF.SIC "AMUPATH"\AMUCONF.INI" call AmuConf_Update 2 call config_update curdir = directory(AMUPATH) DBConv call DataBind /* call config_update */ call DoThePatchesToAMUCONST call SetActive /* call UpdateStartup 'C:\STARTUP.CMD' */ call WriteAmustart call GoodEnd end /*-----------------------------------------------------------------------------*/ /* Deinstallation of the AMU */ /*-----------------------------------------------------------------------------*/ if InstOpt = "3" then do call Deinst end /* End of main program -------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* Function: MenuMain */ /* Description: Select the kind of the installation */ /* Argument: Option */ /*----------------------------------------------------------------------------*/ MenuMain: do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N U T I L I T Y �" say " � AMU - V E R S I O N " Version" �" say " � ADIC/GRAU Storage Systems �" say " � �" say " � 1 = New Installation of AML Management Software �" say " � (Installation without backup of an older Version) �" say " � �" say " � 2 = AMU Update from AMU "OldVersion" to AMU" Version" �" say " � �" say " � �" say " � 3 = Deinstallation (Rollback) of a previously installed AMU" Version" �" say " � �" say " � 4 = End �" say " � �" say " � Select an Option: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) do until Option<>'' & verify(Option,'1234')=0 say "Enter only a number 1,2,3 or 4)" pull Option end call LogWrite "Installation Option is: "Option if Option = 1 then do InstType = "New Installation " InstOpt = 1 return end if Option = 2 then do InstType = "Update Installation" InstOpt = 2 return end if Option = 3 then do InstType = "Deinstallation " InstOpt = 3 return end if Option = 4 then do call LogWrite "User end the installation" exit end return end /*----------------------------------------------------------------------------*/ /* Function: MenuRobot */ /* Description: Select the robot */ /* Argument: RobType */ /*----------------------------------------------------------------------------*/ MenuRobot: do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N - Robot selection �" say " � AMU - V E R S I O N " Version" �" say " � �" say " � Please select the kind of robot which you want control with this �" say " � AMU �" say " � �" say " � 1 = Installation for AML/2, AML/E and AML/J �" say " � (AML/2 without IBM-RIC adapter) �" say " � �" say " � 2 = Installation for AML/2 with Quadron Software for RIC adapter �" say " � �" say " � 3 = Installation for Scalar 1000 �" say " � �" say " � Select an Option: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) do until RobType<>'' & verify(RobType,'123')=0 say "Enter only a number 1,2 or 3)" pull RobType end call LogWrite "Roboter type is: "RobType if RobType = 1 then RobotType = "AML/2, AML/E, AML/J without RIC" if RobType = 2 then do RobotType = "AML/2 with RIC " QuadSupport = 1 end if RobType = 3 then do RobotType = "Scalar 1000 " SCSI = 1 end return end /*----------------------------------------------------------------------------*/ /* Function: MenuDCI */ /* Description: Select the DCI usage */ /* Argument: DCI */ /*----------------------------------------------------------------------------*/ MenuDCI: DCI = 0 do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N - Drive Control Interface �" say " � AMU - V E R S I O N " Version" �" say " � �" say " � Please select 'Y' if you want install the Drive Control Interface �" say " � or 'N' for installation without DCI �" say " � �" say " � DCI is necessary for usage of DLT Low Profile drives �" say " � �" say " � Press Y or N: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) if AnswerYN('') = 'Y' then do call LogWrite "Installation with DCI" DCI = 1 end return end /*----------------------------------------------------------------------------*/ /* Function: MenuDual */ /* Description: Select Single or Dual AMU */ /* Argument: Dual */ /*----------------------------------------------------------------------------*/ MenuDual: Dual = 0 do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N - Dual AMU �" say " � AMU - V E R S I O N " Version" �" say " � �" say " � Please select 'Y' if you want install the a Dual AMU �" say " � or 'N' for installation Single AMU �" say " � �" say " � Press Y or N: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) if AnswerYN('') = 'Y' then do call LogWrite "Installation with Dual AMU" Dual = 1 end else Dual = 0 return end /*----------------------------------------------------------------------------*/ /* Function: MenuDas */ /* Description: Select Installation with DAS */ /* Argument: DAS */ /*----------------------------------------------------------------------------*/ MenuDAS: DAS = 0 do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N - Option DAS �" say " � AMU - V E R S I O N " Version" �" say " � �" say " � Please select 'Y' if you want install a AMU with DAS �" say " � or 'N' for installation AMU without DAS �" say " � �" say " � Press Y or N: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) if AnswerYN('') = 'Y' then do call LogWrite "Installation with DAS-Option" DAS = 1 end else DAS = 0 return end /*----------------------------------------------------------------------------*/ /* Function: MenuDIM */ /* Description: Select the robot */ /* Argument: DIM */ /*----------------------------------------------------------------------------*/ MenuDIM: do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � I N S T A L L A T I O N - Optional Modul selection �" say " � AMU - V E R S I O N " Version" �" say " � �" say " � Please select the moduls which you want start with this AMU �" say " � AMU �" say " � �" say " � 1 = Installation without additional moduls �" say " � �" say " � 2 = Installation with Dismount Manager (DIM) �" say " � �" say " � 3 = Installation with Clean Manager (CLM) and DIM �" say " � �" say " � Select an Option: �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) do until DIMOpt<>'' & verify(DIMOpt,'123')=0 say "Enter only a number 1,2 or 3)" pull DIMOpt end call LogWrite "The selected Modul option is: "DIMOpt if DIMOpt = 1 then do DIM = 0 CLM = 0 end if DIMOpt = 2 then do DIM = 1 CLM = 0 end if DIMOpt = 3 then do DIM = 1 CLM = 1 end return end /*----------------------------------------------------------------------------*/ /* Function: MenuUser */ /* Description: Question to the user for selection ok */ /* Argument: */ /*----------------------------------------------------------------------------*/ MenuUser: do call SysCls say " 旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커" say " � Yor Selection are: �" call LogWrite " � Installation Type is: "InstType " �" if Option = 2 then call LogWrite " � Old version is: "OldVersion" New version is: "Version " �" call LogWrite " � Robot type: "RobotType " �" if DCI = 1 then call LogWrite " 쿔nstallation with Drive Control Interface �" if DAS = 1 then call LogWrite " 쿔nstallation with Communication to DAS �" if DIM = 1 then call LogWrite " 쿔nstallation with Dismount Manager Option �" if CLM = 1 then call LogWrite " 쿔nstallation with Clean Manager Option �" if Dual = 1 then call LogWrite " 쿔nstallation of a Dual AMU with Router and Backup Deamon �" say " � �" say " 읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸" cpos = SysCurPos(22,21) if AnswerYN('Accept you this installation options? (Y/N)') = 'Y' then InstStart = 1 else do InstStart = 0 call LogWrite 'INFO: Options by user not accepted.' end return end /*----------------------------------------------------------------------------*/ /* Function: PrepareNewInstall */ /* Description: Prepare for new installation of AMU */ /* */ /*----------------------------------------------------------------------------*/ PrepareNewInstall: do /* cls */ New_Inst = 1 curdir = directory(AMUPATH) Act_AMUPATH = stream('KRN.exe', 'c', 'query exists') if Act_AMUPATH \= "" then /* KRN.EXE exits in any directory */ do call LogWrite 'INFO: There are already AMU configuration files on harddisk' call LogWrite 'With a new installation all configuration files will overwrited or deleted' if AnswerYN('Would you install a New AMU anyway? (Y/N)') = 'N' then SIGNAL Ende else call LogWrite 'INFO: New Installation without update of existing AMU software.' end curdir = directory() call CreateDir AMUPATH del AMUPATH"\*.zip 2> NUL" curdir = directory(AMUPATH) DLL_Path = Insert(AMUPATH,"\DLL") call CreateDir DLL_Path curdir = directory(AMUPATH) CAN_Path = Insert(AMUPATH,"\CAN") call CreateDir CAN_Path curdir = directory(AMUPATH) SCSI_Path = Insert(AMUPATH,"\SCSI") call CreateDir SCSI_Path curdir = directory(AMUPATH) end return /*----------------------------------------------------------------------------*/ /* Function: Update */ /* Description: Update of previous AMU */ /* Argument: Option */ /*----------------------------------------------------------------------------*/ Update: do cls say "" call LogWrite 'INFO: Installation Update for AML Management Software-Fix AMU 'Version curdir = directory() newdir = directory(AMUPATH) if newdir = AMUPATH then call LogWrite 'INFO: Successfully changed to the AMU directory' else do call LogWrite 'ERROR: AMU directory 'AMUPATH' not found' InstError = 3 SIGNAL Ende end end return /*----------------------------------------------------------------------------*/ /* Function: Deinst */ /* Description: Deinstallation of AMU update... */ /* */ /*----------------------------------------------------------------------------*/ Deinst: do If InstOpt = 1 then do call LogWrite "Installtion ended, because of a installation failure" SIGNAL Ende return end else do /* cls */ curdir = directory() newdir = directory(AMUPATH) call LogWrite 'INFO: Deinstallation of previously installed AMU AMU 'Version copy Backup_Directory "." if rc = 0 then call LogWrite 'the files from directory 'Backup_Directory' was succesful copied back to the AMU directory' else do call LogWrite 'ERROR: Rollback failed,rc= 'rc InstError = 4 SIGNAL Ende return end copy DLL_Backup_Directory "DLL" if rc = 0 then call LogWrite 'the files from directory 'DLL_Backup_Directory' was succesful copied back to the AMU directory' else do call LogWrite 'ERROR: Rollback failed,rc= 'rc InstError = 5 SIGNAL Ende return end copy CAN_Backup_Directory "CAN" if rc = 0 then call LogWrite 'the files from directory 'CAN_Backup_Directory' was succesful copied back to the AMU directory' else call LogWrite 'INFO: no Rollback of CAN files (Perhaps installation without DCI),rc= 'rc call LogWrite "" copy SCSI_Backup_Directory "SCSI" if rc = 0 then call LogWrite 'the files from directory 'SCSI_Backup_Directory' was succesful copied back to the AMU directory' else call LogWrite 'INFO: no Rollback of SCSI files (Perhaps no Scalar1000),rc= 'rc call LogWrite "" call LogWrite "INFO: Deleting the AMU Backup Directories" call SysRmDir DLL_Backup_Directory call SysRmDir CAN_Backup_Directory call SysRmDir SCSI_Backup_Directory call SysRmDir Backup_Directory copy AMUPATH'\AMUCONF.SIC 'AMUPATH'\AMUCONF.INI' call DataBind If InstError <> 0 then SIGNAL Ende else call GoodEnd end return end /*----------------------------------------------------------------------------*/ /* Function: Ende */ /* Description: Abnormal end of installation program */ /* */ /*----------------------------------------------------------------------------*/ Ende: do call LogWrite ' The Installation scripts is stopped because of user request' call LogWrite ' or because of failure' call LogWrite ' The installation ended with the ReturnCode ['InstError']' call LogWrite " The Installation procedure was not yet completed" call LogWrite ' Unsuccessful end of installation!!!' say "" newdir = directory(curdir) end exit /*----------------------------------------------------------------------------*/ /* Function: Backup */ /* Description: Backup of current of AMU */ /* */ /*----------------------------------------------------------------------------*/ Backup: parse arg BackupOpt do curdir = directory() newdir = directory(AMUPATH) fspec = SysSearchPath('AMUPATH', 'Krn.exe') if fspec = '' then do call LogWrite 'ERROR: Something is wrong with the AMUPATH Environment' InstError = 6 SIGNAL Ende end /* AMU Database Backup */ call GetDBName call LogWrite 'Database' DBName 'will be saved, please wait' startdbm 'db2 BACKUP DATABASE 'DBName' TO C' If rc = 0 then call LogWrite 'Database Backup was successful' else call LogWrite 'Database was not saved!' /* Prepare the Backup directories */ curdir = directory() call CreateDir Backup_Directory curdir = directory(Backup_Directory) call CreateDir DLL_Backup_Directory curdir = directory(Backup_Directory) call CreateDir SCSI_BACKUP_Directory curdir = directory(Backup_Directory) call CreateDir CAN_BACKUP_Directory curdir = directory(AMUPATH) /* cleaning directory from *.out-files */ del '*.out 2> NUL' if rc = 0 then call LogWrite 'INFO: All out.files deleted' else call LogWrite 'INFO: No out.files found to delete: That is o.k!' /* Saving AMU files */ call LogWrite 'INFO: Start saving AMU-directory ...' copy "." Backup_Directory if rc = 0 then call LogWrite 'INFO: files from AMU directory was saved' else call LogWrite 'INFO: Some files from AMU directory could not be saved' call LogWrite 'INFO: Trying to delete old ZIP Files ... ' del AMUPATH'\*.zip 2> NUL' curdir = directory(AMUPATH) call LogWrite 'INFO: Start saving AMU\DLL directory ...' copy "DLL\*.* " DLL_Backup_Directory if rc = 0 then call LogWrite 'INFO: files from AMU\DLL directory was saved' else call LogWrite 'INFO: Some files from AMU\DLL could not be saved' If BackupOpt = 1 then /* update from AMU 3.10 or higher */ do call LogWrite 'INFO: Start saving AMU\CAN directory ...' copy "CAN\*.* " CAN_Backup_Directory if rc = 0 then call LogWrite 'INFO: files from AMU\CAN directory was saved' else do call LogWrite 'INFO: Some files from AMU\CAN could not be saved' call LogWrite ' Maybe Installation before was without DCI' end end If SCSI = 1 then do call LogWrite 'INFO: Start saving AMU\SCSI directory ...' copy "SCSI\*.* " SCSI_Backup_Directory if rc = 0 then call LogWrite 'INFO: files from AMU\SCSI directory was saved' else do call LogWrite 'INFO: Some files from AMU\SCSI could not be saved' call LogWrite ' Maybe Installation before was without Scalar1000' end end do call LogWrite 'INFO: AMUCONF.INI will be copied to AMUCONF.SIC' copy AMUPATH'\AMUCONF.INI 'AMUPATH'\AMUCONF.SIC' end end return /*----------------------------------------------------------------------------*/ /* Function: Install */ /* Description: Installation of new AMU */ /* */ /*----------------------------------------------------------------------------*/ Install: do Zipper_Found = 0 if Floppy_Inst = 0 then do DiskNumber = 1 do Anz_Disks say '' File = 'a:\*'DiskNumber'.zip' if DiskNumber > 1 then call DiskRequest File DiskNumber say "" call LogWrite 'INFO: Copying from installation disk ...' copy 'a:\AMU*.zip 'AMUPATH if rc = 0 then call LogWrite 'INFO: Diskette 'DiskNumber' successful copied to harddisk' else do call LogWrite 'ERROR: Diskette does not contain AMU Diskette 'DiskNumber'. Installation is stopped! rc=['rc']' InstError = 2 SIGNAL Deinst end if Zipper_Found = 0 then do copy 'a:\unzip.exe 'AMUPATH if rc = 0 then do call LogWrite 'INFO: extract program was founded' Zipper_Found = 1 end end DiskNumber = DiskNumber + 1 end end /* end of floppy installation */ else /* begin CDROM installation */ do say "" call LogWrite 'INFO: Copy the AMU to harddisk ...' DiskNumber = 1 do Anz_Disks ZipFile = Overlay(DiskNumber,FileName,8) call LogWrite 'copy the file 'ZipFile'.zip to the directory 'AMUPATH copy Install_Directory'\'ZipFile'.ZIP' AMUPATH if rc = 0 then call LogWrite 'INFO: AMU file ' DiskNumber ' successful copied to harddisk' else do call LogWrite 'ERROR: Directory does not contain correct AMU software. Installation is stopped! rc=['rc']' InstError = 1 SIGNAL Deinst end if Zipper_Found = 0 then do copy Install_Directory'\unzip.exe' AMUPATH if rc = 0 then do call LogWrite 'INFO: extract program was founded' Zipper_Found = 1 end end /* search unzip program */ DiskNumber = DiskNumber + 1 end /* search AMU zip files */ end /* CDROM installation */ call LogWrite 'INFO: Start extracting new AMU ...' DiskNumber = 1 curdir = directory(AMUPATH) call LogWrite 'The installation starts in the directory:'actdir do Anz_Disks ZipFile = Overlay(DiskNumber,FileName,8) call LogWrite ' INFO: extract 'ZipFile'.zip' unzip '-o 'ZipFile'.zip' if rc = 0 then call LogWrite 'INFO: Software successful extracted' else do if rc = 1 then do call LogWrite "ERROR: Some files could not be extracted" InstError = 6 SIGNAL Deinst end else SIGNAL NoUnzip end DiskNumber = DiskNumber + 1 end copy "*.dll DLL" if rc = 0 then call LogWrite 'INFO: Dynamic Link Libraries copied successful to directory DLL' else do call LogWrite ' ERROR: Some files could not be copied to directory DLL,' call LogWrite ' Retry, but make sure, that no program is runnig or write protected in 'AMUPATH'\DLL.' InstError = 7 SIGNAL Deinst end /* copy dci software into CAN directory */ CAN_Path = Insert(AMUPATH,"\CAN") call CreateDir CAN_Path curdir = directory(AMUPATH) copy "*.ac CAN" if rc = 0 then do call LogWrite 'INFO: Files *.ac was copied to the CAN directory' del '*.ac 2> NUL' end else call LogWrite 'INFO: Files *.ac can not copied to CAN. rc= 'rc copy "dl.bat CAN" if rc = 0 then call LogWrite 'INFO: Files dl.bat was copied to the CAN directory' else call LogWrite 'INFO: Files dl.bat can not copied to CAN. rc= 'rc del 'dl.bat 2> NUL' copy "E_DldPC.exe CAN" if rc = 0 then call LogWrite 'INFO: Files E_DldPC.exe was copied to the CAN directory' else call LogWrite 'INFO: Files E_DldPC.exe can not copied to CAN. rc= 'rc del 'E_DldPC.exe 2>NUL' copy "CANDRV.SYS CAN" if rc = 0 then call LogWrite 'INFO: Files CANDRV.SYS was copied to the CAN directory' else call LogWrite 'INFO: Files CANDRV.SYS can not copied to CAN. rc= 'rc del 'CANDRV.SYS 2>NUL' call LogWrite 'INFO: CAN support copied to harddisk' /* copy SCALAR1000 software to SCSI directory */ SCSI_Path = Insert(AMUPATH,"\SCSI") call CreateDir SCSI_Path curdir = directory(AMUPATH) copy "amls.ico SCSI" if rc = 0 then call LogWrite 'INFO: Files amls.ico was copied to the SCSI directory' else call LogWrite 'INFO: Files amls.ico can not copied to SCSI. rc= 'rc del 'amls.ico 2> NUL' copy "amls.sys SCSI" if rc = 0 then call LogWrite 'INFO: Files amls.sys was copied to the SCSI directory' else call LogWrite 'INFO: Files amls.sys can not copied to SCSI. rc= 'rc del 'amls.sys 2> NUL' copy "scsiutil.dll SCSI" if rc = 0 then call LogWrite 'INFO: Files scsiutil.dll was copied to the SCSI directory' else call LogWrite 'INFO: Files scsiutil.dll can not copied to SCSI. rc= 'rc del 'scsiutil.dll 2> NUL' copy "scsiutil.exe SCSI" if rc = 0 then call LogWrite 'INFO: Files scsiutil.exe was copied to the SCSI directory' else call LogWrite 'INFO: Files scsiutil.exe can not copied to SCSI. rc= 'rc del 'scsiutil.exe 2> NUL' copy "scsiutil.hlp SCSI" if rc = 0 then call LogWrite 'INFO: Files scsiutil.hlp was copied to the SCSI directory' else call LogWrite 'INFO: Files scsiutil.hlp can not copied to SCSI. rc= 'rc del 'scsiutil.hlp 2> NUL' copy "trcclose.exe SCSI" if rc = 0 then call LogWrite 'INFO: Files trcclose.exe was copied to the SCSI directory' else call LogWrite 'INFO: Files trcclose.exe can not copied to SCSI. rc= 'rc del 'trcclose.exe 2> NUL' copy "trcopen.exe SCSI" if rc = 0 then call LogWrite 'INFO: Files trcopen.exe was copied to the SCSI directory' else call LogWrite 'INFO: Files trcopen.exe can not copied to SCSI. rc= 'rc del 'trcopen.exe 2> NUL' if New_Inst = 1 then copy "C:\AMU\AMUCONF.BAS C:\AMU\AMUCONF.INI" del '*.dll 2> NUL' end return /*----------------------------------------------------------------------------*/ /* Function: AmuConf_Update */ /* Description: Changed parameters in the file AMUCONF.INI */ /* */ /*----------------------------------------------------------------------------*/ AmuConf_Update: parse arg UpdateOpt do curdir = directory(AMUPATH) call LogWrite 'INFO: Updating Version String' patstr = "PROC VERSION V0xxxx" patstr = overlay(Version, patstr, 16) patini patstr If RC = 0 then call LogWrite "Versionsstring updated successful" else call LogWrite "INFO: the rc during update of the Version string is "rc /* update the Kernel Load list PROC KRNLOAD */ call LogWrite "INFO: Updating Kernel Load Modules" File = AMUPATH"\AMUCONF.ini" KrnLoad = sysini(File,"PROC","KRNLOAD") Call LogWrite "The actual Kernel Load Modules are: "KrnLoad If (KrnLoad <> 'ERROR:') & (VersOpt = 4) then do Call LogWrite " detect the actual load modules and use this for update " rc= POS("CLM",KrnLoad) if rc = 0 then do CLM = 0 call LogWrite "CLM="CLM end else CLM = 1 rc= POS("DIM",KrnLoad) if rc = 0 then DIM = 0 else DIM = 1 end NumOfAmu = sysini(File,"AMU","NUMOF") If (NumOfAmu <> 'ERROR:') & (VersOpt = 4) then do if NumOfAmu = 2 then do Call LogWrite "INFO: Dual AMU configuration with BUD and Router !!" Dual = 1 end else do Call LogWrite "INFO: Single AMU configuration without BUD and Router !!" Dual = 0 end end else do Call LogWrite "INFO: New Installation or failure in the AMUCONF.INI" end call LogWrite "CLM="CLM", DIM="DIM", Dual="Dual /* prepare the update string like before configured or selected in the menu*/ if ((DIM = 0) & (CLM = 0)) then do patstr = "PROC KRNLOAD ""KNP UPM ARC HOC" call LogWrite "The new Load list is: ["patstr"]" end if ((DIM = 1) & (CLM = 0)) then do patstr = "PROC KRNLOAD ""KNP UPM ARC HOC DIM" call LogWrite "The new Load list is: ["patstr"]" end if (CLM = 1) then do patstr = "PROC KRNLOAD ""KNP UPM ARC HOC DIM CLM" call LogWrite "The new Load list is: ["patstr"]" end if (Dual = 1) then do patstr = Insert(patstr," RTE BUD") call LogWrite "The new Load list is: ["patstr"]" end patstr = Insert(patstr,"""") call LogWrite "INFO: Loadlist update with:["patstr"]" patini patstr If RC = 0 then call LogWrite "Krnload updated successful" else call LogWrite "INFO: the rc during update of the krnload string is "rc end return /*----------------------------------------------------------------------------*/ /* Function: SetActive */ /* Description: Changed status and lasstatus in AMUCONF.INI */ /* */ /*----------------------------------------------------------------------------*/ SetActive: do curdir = directory(AMUPATH) call LogWrite 'INFO: Set AMU to Active' OldStatus = sysini(File,"PROC","STATUS") patstr = "PROC STATUS ACTIVE" patini patstr If RC = 0 then call LogWrite "STATUS updated from "OldStatus" to ACTIVE successful" else call LogWrite "INFO: the rc during update of the STATUS is "rc OldLastStatus = sysini(File,"PROC","LASTSTATUS") patstr = "PROC LASTSTATUS ACTIVE" patini patstr If RC = 0 then call LogWrite "LASTSTATUS updated from "OldLastStatus" to ACTIVE successful" else call LogWrite "INFO: the rc during update of the LASTSTATUS is "rc end return /*----------------------------------------------------------------------------*/ /* Function: DataBind */ /* Description: Link database to AMU */ /* */ /*----------------------------------------------------------------------------*/ DataBind: do logoff call LogWrite "INFO: Binding for the ARC modules" call GetDBName call LogWrite 'Binding of the Arc modules for Database 'DBName startdbm 'db2 CONNECT TO 'DBName If rc = 0 then call LogWrite 'Database Connection established' else call LogWrite 'Database not connected, perhaps database does not exist.rc= 'rc 'db2 RUNSTATS ON TABLE AMU.POOL' If rc = 0 then call LogWrite 'runstats of table POOL was ok' else call LogWrite 'runstats of POOL failed, perhaps database does not exist.rc= 'rc 'db2 RUNSTATS ON TABLE AMU.COORDINATES' If rc = 0 then call LogWrite 'runstats of table COORDINATES was ok' else call LogWrite 'runstats of COORDINATES failed, perhaps database does not exist.rc= 'rc 'db2 RUNSTATS ON TABLE AMU.SCOORDINATES' If rc = 0 then call LogWrite 'runstats of table SCOORDINATES was ok' else call LogWrite 'runstats of SCOORDINATES failed, perhaps database does not exist.rc= 'rc 'db2 connect reset' if rc = 0 then call LogWrite 'database connection reset was ok' else call LogWrite 'database connection reset failed.rc= 'rc 'SQLBIND ArcBack.BND 'DBName' /F=EUR' if rc = 0 then call LogWrite 'sqlbind for ArcBack was ok' else call LogWrite 'sqlbind for ArcBack failed.rc= 'rc 'SQLBIND ArcSQLe.BND 'DBName' /F=EUR' if rc = 0 then call LogWrite 'sqlbind for ArcSQLe was ok' else call LogWrite 'sqlbind for ArcSQLe failed.rc= 'rc 'SQLBIND ArcSQLeN.BND 'DBNAme' /F=EUR' if rc = 0 then call LogWrite 'sqlbind for ArcSQLeN was ok' else call LogWrite 'sqlbind for ArcSQLeN failed.rc= 'rc 'SQLBIND ArcBSQL.BND 'DBName' /F=EUR' if rc = 0 then call LogWrite 'sqlbind for ArcBSql was ok' else call LogWrite 'sqlbind for ArcBSql failed.rc= 'rc end return /*----------------------------------------------------------------------------*/ /* Function: GoodEnd */ /* Description: Normal End of Installatio program */ /* */ /*----------------------------------------------------------------------------*/ GoodEnd: do newdir = directory("C:/") if ConfigUpdate = 1 then do r = stream(CONFIG_NEW, 'c', 'close') copy CONFIG_NEW CONFIG_SYS del CONFIG_NEW end cls say "" call LogWrite 'End of AML Management Software Installation' call LogWrite 'Installation was succcessful' say "" if SCSI = 0 then do say "" call LogWrite 'Are you sure you have the latest AML/2, AML/E or AML/J Robot Software' call LogWrite 'installed? Call Service to inquire about the latest release!' end if ConfigUpdate = 1 then do say "" call LogWrite 'Your CONFIG.SYS was updated.' call LogWrite 'To activate the changes, you need to reboot the AMU.' end say "" end exit /*----------------------------------------------------------------------------*/ /* Function: NoUnzip */ /* Description: Error message because of missing pkunzip */ /* */ /*----------------------------------------------------------------------------*/ NoUnzip: do call LogWrite "ERROR: UNZIP.EXE program not found or did not work correctly." call LogWrite "ERROR: Try to get a copy of UNZIP.EXE. Copy it to C:\AMU and" call LogWrite "ERROR: type UNZIP -o AMUxxxx.ZIP in an os/2 window." InstError = 7 SIGNAL Deinst end /*----------------------------------------------------------------------------*/ /* Function: config_update */ /* Description: change the file config.sys */ /* */ /*----------------------------------------------------------------------------*/ config_update: do ret = 1 actdir =directory('c:\') rc = sysFileDelete(CONFIG_NEW) if rc = 0 then do call LogWrite 'INFO: File Config.new removed' end else call LogWrite 'INFO: Config.new not deleted rc='rc call LogWrite 'INFO: Saving the current CONFIG.SYS file' copy CONFIG_SYS "c:\config.B4A" if rc > 0 then do say "" call LogWrite 'Attention: a backup of your config.sys already exists' call LogWrite 'and it is already write protected!' call LogWrite 'Do you still want to make a backup of the file' if AnswerYN('CONFIG.SYS into the file CONFIG.B4A? (Y/N)') = 'Y' then do attrib 'c:\config.B4A -r' copy CONFIG_SYS "c:\config.B4A" attrib 'c:\config.B4A +r' call LogWrite 'INFO: Backup of CONFIG.SYS written to CONFIG.B4A' call LogWrite ' and set to read only.' end else call LogWrite 'INFO: No new backup of CONFIG.SYS was written to CONFIG.B4A!' end else do call LogWrite 'INFO: Trying to protect the backup config.sys (CONFIG.B4A)' call LogWrite ' from being overwritten' attrib 'c:\config.B4A +r' end say '' /*--------------------------------------------------------------------------*/ /* Check of LIBPATH, PATH and AMUPATH */ /*--------------------------------------------------------------------------*/ i = linein(CONFIG_NEW,1,0) call LogWrite 'i='i LibPathUpdt = 0 PathUpdt = 0 AmuPathSet = 0 ScsiDriverSet = 0 DmdSet = 0 AddSet = 0 QPathSet = 0 CANDriverSet = 0 ConfigNotComplete = 1 do while ConfigNotComplete = 1 DoneAline = 0 aline = linein(CONFIG_SYS) /*------------------------------------------------------------------------*/ /* Set LIBPATH for AMU */ /*------------------------------------------------------------------------*/ if LibPathUpdt = 0 then do if DoneAline = 0 then do i = compare('LIBPATH',aline) if i >= 8 then do p = pos(".\DLL;",aline) if p = 0 then do call LogWrite 'INFO: LIBPATH for AMU not found' call LogWrite 'Line ['aline'], i='i'p='p newline = insert(".\DLL;", aline, 8) call LogWrite 'INFO: LIBPATH for AMU added' i = lineout(CONFIG_NEW, newline) DoneAline = 1 LibPathUpdt = 1 end else do call LogWrite 'INFO: LIBPATH for AMU already exists' end end end end /*------------------------------------------------------------------------*/ /* Check of PATH for Quadron */ /*------------------------------------------------------------------------*/ if DoneAline = 0 then do if QuadSupport = 1 then do if PathUpdt = 0 then do i = compare('SET PATH',aline) if i >= 9 then do p = pos("C:\QCF\OS2EXE;",aline) if p = 0 then do call LogWrite 'INFO: PATH for Quadron not found' i = length(aline) c = substr(aline, i, 1) if c = ';' then do newline = insert( "C:\QCF\OS2EXE;", aline, i ) call LogWrite 'INFO: PATH for Quadron added' end else do newline = insert( ";C:\QCF\OS2EXE;", aline, i ) call LogWrite 'INFO: PATH for Quadron added' end i = lineout(CONFIG_NEW, newline) DoneAline = 1 PathUpdt = 1 end else call LogWrite 'INFO: PATH for Quadron already exists' end end end end /*--------------------------------------------------------------------------*/ /* Check of HELPPATH */ /*--------------------------------------------------------------------------*/ if DoneAline = 0 then do i = compare('SET HELP=',aline) if i >= 10 then do p = pos("C:\AMU;",aline) if p = 0 then do call LogWrite 'INFO: HELP path for AMU not found' i = length(aline) c = substr(aline, i, 1) if c = ';' then do newline = insert( "C:\AMU;", aline, i ) call LogWrite 'INFO: HELP path for AMU added' end else do newline = insert( ";C:\AMU;", aline, i ) call LogWrite 'INFO: HELP path for AMU added' end i = lineout(CONFIG_NEW, newline) DoneAline = 1 end else do call LogWrite 'INFO: HELP path for AMU already exists' end end end /*--------------------------------------------------------------------------*/ /* Check of AMUPATH */ /*--------------------------------------------------------------------------*/ if DoneAline = 0 & AmuPathSet = 0 then do i = compare('SET AMUPATH',aline) if i >= 12 then do AmuPathSet = 1 call LogWrite 'INFO: AMUPATH already exists' end end /*--------------------------------------------------------------------------*/ /* Check of QPATH for Quadron */ /*--------------------------------------------------------------------------*/ if DoneAline = 0 & QPathSet = 0 then do i = compare('SET QPATH',aline) if i >= 10 then do QPathSet = 1 call LogWrite 'INFO: QPATH already exists' end end /*--------------------------------------------------------------------*/ /* Check of SCSI driver settings */ /*--------------------------------------------------------------------*/ if DoneAline = 0 then do if SCSI = 1 then do if ScsiDriverSet = 0 then do i = compare('DEVICE=C:\AMU\SCSI\AMLS.',aline) if i >= 25 then do ScsiDriverSet = 1 call LogWrite 'INFO: SCSI driver path already exists' end end if DmdSet = 0 then do i = compare('BASEDEV=OS2SCSI.',aline) if i >= 17 then do DmdSet = 1 call LogWrite 'INFO: Device Manager Driver path already exists' end end if AddSet = 0 then do i = compare('BASEDEV=AIC7870.',aline) if i >= 17 then do AddSet = 1 call LogWrite 'INFO: Adapter Device Driver path already exists' end end end end /*--------------------------------------------------------------------*/ /* Check of CAN driver settings */ /*--------------------------------------------------------------------*/ if DoneAline = 0 then do if DCI = 1 then do if CANDriverSet = 0 then do i = compare('DEVICE=C:\AMU\CAN\CANDRV.SYS',aline) if i = 0 then do CANDriverSet = 1 call LogWrite 'INFO: CAN driver path already exists' end end end end /*--------------------------------------------------------------------------*/ /* Default for unchanged lines */ /*--------------------------------------------------------------------------*/ if DoneAline = 0 then do i = lineout(CONFIG_NEW, aline) end ConfigNotComplete = lines(CONFIG_SYS) end i = lineout(CONFIG_SYS) call file_close CONFIG_SYS /*--------------------------------------------------------------------------*/ /* set the AMUPATH */ /*--------------------------------------------------------------------------*/ if AmuPathSet = 0 then do i = lineout(CONFIG_NEW, "SET AMUPATH=C:\AMU") call LogWrite 'INFO: AMUPATH added' AmuPathSet = 1 end /* check the CONFIG.SYS */ /*--------------------------------------------------------------------------*/ /* Update CONFIG.SYS */ /*--------------------------------------------------------------------------*/ /* set the SCSI driver */ /*--------------------------------------------------------------------------*/ if SCSI = 1 then do if ScsiDriverSet = 0 then do i = lineout(CONFIG_NEW, "DEVICE=C:\AMU\SCSI\AMLS.SYS") call LogWrite 'INFO: SCSI driver statement added' end if DmdSet = 0 then do i = lineout(CONFIG_NEW, "BASEDEV=OS2SCSI.DMD") call LogWrite 'INFO: Device Manager Driver statement added' end if AddSet = 0 then do i = lineout(CONFIG_NEW, "BASEDEV=AIC7870.ADD") call LogWrite 'INFO: Adapter Device Driver statement added' end end /*--------------------------------------------------------------------------*/ /* set the CAN driver */ /*--------------------------------------------------------------------------*/ if DCI = 1 then do if CANDriverSet = 0 then do i = lineout(CONFIG_NEW, "DEVICE=C:\AMU\CAN\CANDRV.SYS") call LogWrite 'INFO: CAN driver statement added' CANDriverSet = 1 end end /*--------------------------------------------------------------------------*/ /* set the Quadron support */ /*--------------------------------------------------------------------------*/ if QuadSupport = 1 & QPathSet = 0 then do i = lineout(CONFIG_NEW, "SET QPATH=C:\QCF\RICEXE;C:\QCF\OS2EXE") i = lineout(CONFIG_NEW, "DEVICE=C:\QCF\OS2EXE\QCFDEV.SYS C:\QCF\OS2EXE\QPARM.PRM") i = lineout(CONFIG_NEW, "DEVICE=C:\QCF\OS2EXE\QCOMDEV.SYS C:\QCF\OS2EXE\QCOMPARM.PRM") call file_close CONFIG_NEW call LogWrite 'INFO: QPATH and device drivers for Quadron added' call SysFileSearch 'QRESET 0', 'C:\STARTUP.CMD', stamm. if stamm.0 = 0 | RESULT = 3 then do call LogWrite 'INFO: Writing Quadron Initialization into STARTUP.CMD' i = lineout("C:\STARTUP.CMD", "CD \qcf\os2exe ") i = lineout("C:\STARTUP.CMD", "REM *** RESET THE RIC CARD 0 *** ") i = lineout("C:\STARTUP.CMD", "QRESET 0") i = lineout("C:\STARTUP.CMD", "REM *** LOAD REALTIME CONTROL MICROCODE *** ") i = lineout("C:\STARTUP.CMD", "REM *** 512KB RIC cards only *** ") i = lineout("C:\STARTUP.CMD", "REM *** Rem out for 1MB RIC cards *** ") i = lineout("C:\STARTUP.CMD", "QLD ICAAIM.COM /C0") i = lineout("C:\STARTUP.CMD", "REM *** LOAD qCOM ON RIC 0 AS TASK 2 *** ") i = lineout("C:\STARTUP.CMD", "QCOMLOAD 0 2") end else do call LogWrite 'ERROR: Cannot write Quadron Initialization into STARTUP.CMD' InstError = 8 end QPathSet = 1 end ConfigUpdate = 1 end return /*----------------------------------------------------------------------------*/ /* Function: DiskRequest */ /* Description: ask operator for diskette */ /* Argument: DiskName File */ /*----------------------------------------------------------------------------*/ DiskRequest: parse arg File DiskName do call LogWrite 'Please insert diskette' DiskName 'into drive A: and press !' DiskIsCorrect = 0 do until DiskIsCorrect = 1 pull answer call LogWrite 'INFO: Searching for file ' File call SysFileTree file, 'datei', 'F' if datei.0 = 0 then do say '' say 'ERROR: File was not found!' say ' Please ensure that diskette' DiskName say ' is inserted properly in drive A:. Then press !' DiskIsCorrect = 0 end else do DiskIsCorrect = 1 say 'INFO: File was found' end end end return /*----------------------------------------------------------------------------*/ /* Function: AnswerYN */ /* Description: wait for operator input y/n */ /* Argument: question */ /*----------------------------------------------------------------------------*/ AnswerYN: parse arg question do say question AnswerIsYN = 0 do while AnswerIsYN = 0 parse upper pull answer if answer = 'Y' | answer = 'N' then do AnswerIsYN = 1 end else do say "Please enter only Y or N then (CR)" end end end return answer /*----------------------------------------------------------------------------*/ /* Function: file_open */ /* Description: Open a file */ /* Argument: file_name */ /*----------------------------------------------------------------------------*/ file_open: parse arg file_name r = stream(file_name, 'c', 'open read') do while r = 'NOTREADY:32' r = stream(file_name, 'c', 'open read') call LogWrite "File"file_name" opened" end return r /*----------------------------------------------------------------------------*/ /* Function: file_close */ /* Description: Close a file */ /* Argument: file_name */ /*----------------------------------------------------------------------------*/ file_close: parse arg file_name r = stream(file_name, 'c', 'close') return r /*----------------------------------------------------------------------------*/ /* Function: WriteStartup */ /* Description: Crate a new startup.cmd for a AMU */ /* Argument: FILE_TO_READ */ /*----------------------------------------------------------------------------*/ WriteStartup: parse arg FILE_TO_WRITE copy FILE_TO_WRITE "startup.b4a" del FILE_TO_WRITE ' 2> NUL' call LogWrite 'INFO: Writing AMU start into STARTUP.CMD' /* write start entries */ if DAS = 1 | Dual = 1 then do i = lineout(FILE_TO_WRITE, "call TcpStart") end if DAS = 1 then do i = lineout(FILE_TO_WRITE, "cd \DAS") i = lineout(FILE_TO_WRITE, "call DasStart") end i = lineout(FILE_TO_WRITE, "cd \AMU") i = lineout(FILE_TO_WRITE, "call AmuStart") i = lineout(FILE_TO_WRITE, "exit") /* write exit to the file */ call file_close FILE_TO_WRITE /*** close ouput */ return end /*----------------------------------------------------------------------------*/ /* Function: WriteAmustart */ /* Description: Crate a new AMU startup amustart.cmd */ /* Argument: none */ /*----------------------------------------------------------------------------*/ WriteAmustart: do curdir = directory(AMUPATH) Call LogWrite "Write AmuStart.cmd" FILE_TO_READ = AMUPATH"\AmuStart.cmd" FILE_TO_WRITE = "AmuStart.txt" del FILE_TO_READ ' 2> NUL' del FILE_TO_WRITE ' 2> NUL' call file_open FILE_TO_WRITE call LogWrite 'INFO: Writing AMU start into AMUSTART.CMD' /* write start entries */ i = lineout(FILE_TO_WRITE, "@REM --------------------------------------------------------------------------------") i = lineout(FILE_TO_WRITE, "@REM Filename: AmuStart.cmd ") i = lineout(FILE_TO_WRITE, "@REM Description: Start Script for the AMU modules ") i = lineout(FILE_TO_WRITE, "@REM ") i = lineout(FILE_TO_WRITE, "@REM [cd can ") i = lineout(FILE_TO_WRITE, "@REM DL Download binaries to CAN-controller ") i = lineout(FILE_TO_WRITE, "@REM cd ..] ") i = lineout(FILE_TO_WRITE, "@REM start /C /min ""AMU Kernel"" krn [/S] ") i = lineout(FILE_TO_WRITE, "@REM Options: /S AMU with a DAS ") i = lineout(FILE_TO_WRITE, "@REM start con [/L] Option: /L automatic start of Online Log ") i = lineout(FILE_TO_WRITE, "@REM --------------------------------------------------------------------------------") i = lineout(FILE_TO_WRITE, " ") if DCI=1 then do i = lineout(FILE_TO_WRITE, "cd can") i = lineout(FILE_TO_WRITE, "DL") i = lineout(FILE_TO_WRITE, "cd ..") i = lineout(FILE_TO_WRITE, " ") end if DAS=1 then i = lineout(FILE_TO_WRITE, "start /C /min ""AMU Kernel"" krn /S") else i = lineout(FILE_TO_WRITE, "start /C /min ""AMU Kernel"" krn") i = lineout(FILE_TO_WRITE, "start con /L") ret = lines(FILE_TO_READ) /* end while */ Call LogWrite "File_close" FILE_TO_WRITE call file_close FILE_TO_WRITE /*** close ouput */ Call LogWrite "File_close" FILE_TO_READ call file_close FILE_TO_READ /*** close input */ copy FILE_TO_WRITE FILE_TO_READ Call LogWrite "Copy of "FILE_TO_WRITE" ended with rc "rc return end /*----------------------------------------------------------------------------*/ /* Function: DoThePatchesToAMUCONST */ /* Description: Check for necessary updates of AMUCONST.INI */ /* */ /*----------------------------------------------------------------------------*/ /* Do all the patches which have been done before */ /* */ /* Patches do have a "patini PATCH pat pat.cmd" line, that writes the */ /* commandfile to be called during the update of AMU. */ /* So we insure, that all the patches done to the AMUCONST.INI are */ /* done after the update installation happened. */ /* */ /* */ /*----------------------------------------------------------------------------*/ DoThePatchesToAMUCONST: File = "AMUCONF.ini" rc = sysini(File,"PATCH","ALL:","key"); /* Read of all patched lines */ if key.0 <> 0 then do do Line = 1 to key.0 value = sysini(file,"PATCH",key.Line); /* Read of the values in the lines */ if (value <> "") & (value <> "ERROR:") then do call LogWrite "Found: "PATCH" " key.Line": " value ". Doing patch:" cmd "/c" value end end Line end else do call LogWrite "No updates in file " file " neccessary." end return /*----------------------------------------------------------------------------*/ /* Function: GetDBName */ /* Description: Check for the database name from AMUCONF.INI */ /* */ /*----------------------------------------------------------------------------*/ GetDBName: File = AMUPATH"\AMUCONF.ini" DBName = sysini(File,"PROC","DBNAME"); if compare(DBName,'ERROR:') > 0 then call LogWrite "Database Name is " DBName else do Say "Error in AMUCONF.INI, DBNAME=["DBName"]" InstError = 9 Signal ENDE end return /*----------------------------------------------------------------------------*/ /* Function: CreateDir */ /* Description: Create new directories */ /* Argument: directory */ /*----------------------------------------------------------------------------*/ CreateDir: do parse arg NewDir Ret = SysMkDir(NewDir) if Ret = 0 then do call LogWrite "INFO: directory "NewDir" successsful created." return end if Ret = 5 then do actDir = directory() changeDir = directory(NewDir) if changeDir = NewDir then do call LogWrite "INFO: Directory or file already exists" return end else do call LogWrite "ERROR: Directory can not be created, Perhaps a file with the name exists." InstError = 10 SIGNAL Ende return end end else do call LogWrite " ERROR: Unknown error during Create of the directory, RC= "RET Insterror = 11 SIGNAL Ende return end end return /*----------------------------------------------------------------------------*/ /* Function: GetActualVersion */ /* Description: look in the existing file AMUCONF.INI and read version */ /* */ /*----------------------------------------------------------------------------*/ GetActualVersion: do curdir = directory(AMUPATH) File = AMUPATH"\AMUCONF.INI" OldVersion = sysini(File,"PROC","VERSION") If OldVersion <> ' ERROR: ' then do call LogWrite "Previous installed Version was ["OldVersion"]" InstOpt = 2 If (compare('V02.40',OldVersion) > 6) then VersOpt = 2 If (compare('V03.02',OldVersion) > 6) then VersOpt = 3 If (compare('V03.10',OldVersion) > 6) then VersOpt = 4 else InstOpt = 0 call LogWrite "Versionsoption is ["VersOpt"]" end else do call LogWrite "INFO: No previous installed AMU found on the PC" OldVersion ="NO" InstOpt = 1 end end return /*----------------------------------------------------------------------------*/ /* Function: LogWrite */ /* Description: Logwrites and output to standard output */ /* Argument: text */ /*----------------------------------------------------------------------------*/ LogWrite: do parse arg text say text rc = lineout(InstallLog,text) call file_close InstallLog end return /****************** end of AMU install.cmd program *************************/ .