home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12ort1.exe / bin / oddesk.cmd < prev    next >
OS/2 REXX Batch file  |  1997-04-02  |  7KB  |  211 lines

  1. /* Hi Rexx!
  2.  * 
  3.  * @(#) 1.28 os2/src/tools/oddesk.cmd, odtools, od96os2, odos29712d 3/13/97 00:00:39 [ 3/21/97 17:44:55 ]
  4.  * 
  5.  */
  6.  
  7. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8. call SysLoadFuncs
  9. env = 'OS2ENVIRONMENT'
  10. n = setlocal()
  11.  
  12. /*
  13.  * Setup catgets macro
  14.  */
  15. ODBase = value('ODBASE',,env)
  16. LANG = value('LANG',,env)
  17. if LANG = '' then LANG = en_US
  18. CATFile=ODBase || '\locale\' || LANG || '\oddesk.cmd'
  19. call SysFileTree CATFile, 'file', 'FO'
  20. if file.0 = 0 then
  21.     catgets = '@echo'
  22. else
  23.     catgets = '@call 'CATFile
  24.  
  25.  
  26. catgets 'ODDESK_Start' 'OpenDoc Desktop Reconstruction Facility'
  27.  
  28. /*:Step1
  29.  * 
  30.  * Make sure environment is set up by testing for ODCFG, ODPARTS,
  31.  * and ODBASE. If they are not set then report error and terminate.
  32.  * 
  33.  */
  34. catgets 'ODVARS_Check' 'o Checking for OD environment variables...'
  35. ODCfg = value('ODCFG',,env)
  36. ODParts = value('ODPARTS',,env)
  37.  
  38. if ODBase = '' then AbortNoEnv()
  39. if ODCfg = '' then AbortNoEnv()
  40. if ODParts = '' then AbortNoEnv()
  41. catgets 'ODVARS_Found' 'Found it.'
  42.  
  43. /*:Step2
  44.  *
  45.  * Now make sure the ODBASE directory exists.
  46.  *
  47.  */
  48. catgets 'ODBASE_Check' 'o Checking for the ODBASE directory...'
  49. dir = directory(ODBase)
  50. if dir = '' then AbortNoBase()
  51. catgets 'ODBASE_Found' 'Found it.'
  52.  
  53. /*
  54.  * Make sure, if ODCFG or ODPARTS exist, they are writable
  55.  */
  56. call SysFileTree ODCfg, 'file', 'D', '***+*'
  57. if file.0 \= 0 then AbortReadOnly(ODCfg)
  58. call SysFileTree ODParts, 'file', 'D', '***+*'
  59. if file.0 \= 0 then AbortReadOnly(ODParts)
  60.  
  61. /*:Step3
  62.  *
  63.  * Now make sure %ODBASE%\bin\odinst.exe exists.
  64.  *
  65.  */
  66. catgets 'ODINST_Check' 'o Checking for the editor installer (odinst.exe)...'
  67. ODInst=ODBase || '\bin\odinst.exe'
  68. call SysFileTree ODInst, 'file', 'FO'
  69. if file.0 = 0 then AbortNoODInst()
  70. catgets 'ODINST_Found' 'Found it.'
  71.  
  72. /*:Step4
  73.  *
  74.  * Create the ODCFG and ODPARTS directories if they do not exist
  75.  *
  76.  */
  77. catgets 'DIRS_Create' 'o Creating ODCFG and ODPARTS directories...'
  78. ODLang = value('ODLANG',,env)
  79. if ODLANG = '' then ODLANG = en_US
  80.  
  81. Dir.1  =  ODCfg || '\tmp'
  82. Dir.2 =   ODCfg || '\work\docs'
  83. Dir.3 =   ODCfg || '\work\plugins'
  84. Dir.4 =   ODCfg || '\work\editors'
  85. Dir.5 =   ODCfg || '\work\statry'
  86. Dir.6 = ODParts || '\bin'
  87. Dir.7 = ODParts || '\dll'
  88. Dir.8 = ODParts || '\doc'
  89. Dir.9 = ODParts || '\include'
  90. Dir.10 = ODParts || '\locale'
  91. Dir.11 = ODParts || '\lib'
  92. Dir.13 = ODParts || '\src'
  93. Dir.12 = ODParts || '\pkg'
  94. Dir.12 = ODParts || '\pkg\' || ODLang
  95. Dir.14 = ODParts || '\work\docs'
  96. Dir.15 = ODParts || '\work\plugins'
  97. Dir.16 = ODParts || '\work\editors'
  98. Dir.17 = ODParts || '\work\statry'
  99. do i=1 to 17
  100.    if MakeDir(Dir.i) \= 0 then AbortInvalidDir(Dir.i)
  101. end
  102. catgets 'DIRS_Complete' 'Done.'
  103.  
  104. /*:Step5
  105.  *
  106.  * Install the shipped part editors
  107.  * Note: BaseContainer and SimplePart should be installed before
  108.  * the rest.
  109.  *
  110.  */
  111. catgets 'PE_Install' 'o Installing part editors...'
  112.  
  113. Pkg.1 = ODBase || '\pkg\' || ODLang || '\iodbasec.odz'
  114. Pkg.2 = ODBase || '\pkg\' || ODLang || '\iodsimpl.odz'
  115. Pkg.3 = ODBase || '\pkg\' || ODLang || '\iodshape.odz'
  116. Pkg.4 = ODBase || '\pkg\' || ODLang || '\iodlinkc.odz'
  117. Pkg.5 = ODBase || '\pkg\' || ODLang || '\iodtext.odz'
  118.  
  119. do i=1 to 5
  120.    call value 'PKG', Pkg.i, env
  121.    call SysFileTree Pkg.i, 'file', 'FO'
  122.    if file.0 = 0 then
  123.       catgets 'PKG_Warning' 'Warning! Part editor package "'Pkg.i'" was not found.'
  124.    else
  125.       catgets 'PKG_Install' '...Installing 'Pkg.i'.'
  126.       '@ODInst -q' Pkg.i
  127. end
  128.  
  129. /*:Step6
  130.  *
  131.  * Build the IBM OpenDoc folder and populate it.
  132.  *
  133.  */
  134. rc = SysCreateObject("WPFolder", "IBM OpenDoc", "<WP_DESKTOP>", "OBJECTID=<OD_OPENDOC>", "Fail")
  135.  
  136. rc = SysCreateShadow(ODBase"\readme.txt", "<OD_OPENDOC>")
  137. rc = SysCreateShadow(ODBase"\readme.htm", "<OD_OPENDOC>")
  138. rc = SysCreateShadow(ODBase"\license.txt", "<OD_OPENDOC>")
  139. rc = SysCreateShadow(ODBase"\doc\"ODLang"\index.htm", "<OD_OPENDOC>")
  140.  
  141. rc = SysCreateObject("WPProgram", "OpenDoc", "<OD_OPENDOC>", "OBJECTID=<OD_DOCSHELL>;EXENAME="ODBase"\bin\docshell.exe;STARTUPDIR="ODCfg"\work\docs;ASSOCTYPE=OpenDoc Document;ASSOCFILTER=*.od")
  142. rc = SysCreateObject("WPProgram", "Preference Editor", "<OD_OPENDOC>", "OBJECTID=<OD_PREFEDIT>;EXENAME="ODBase"\bin\prefedit.exe;STARTUPDIR="ODCfg"\work\docs")
  143. rc = SysCreateObject("WPProgram", "Part Meister", "<OD_OPENDOC>", "OBJECTID=<OD_PMEISTER>;EXENAME="ODBase"\bin\pmeister.exe;STARTUPDIR="ODBase"\pmeister")
  144. rc = SysCreateObject("WPProgram", "Install Editor", "<OD_OPENDOC>", "OBJECTID=<OD_ODINST>;EXENAME="ODBase"\bin\odinst.exe")
  145. rc = SysCreateObject("WPProgram", "Uninstall Editor", "<OD_OPENDOC>", "OBJECTID=<OD_ODUNINST>;EXENAME="ODBase"\bin\oduninst.exe")
  146.  
  147. rc = SysCreateObject("WPProgram", "UnInstall OpenDoc", "<OD_OPENDOC>", "PROGTYPE=WINDOWABLEVIO;EXENAME=CMD.EXE;OBJECTID=<OD_OPENDOCNSTS>;STARTUPDIR="ODBase"\INSTALL;PARAMETERS=/C "ODBase"\INSTALL\EPFINSTS.EXE /C:"ODBase"\INSTALL\locale /A:D /P:'IBM OpenDoc (R) Version 1.1' /O:"ODBase";MINIMIZED=YES;ICONFILE="ODBase"\INSTALL\EPFIICIS.ICO")
  148.  
  149. rc = SysCreateObject("WPProgram", "Build OpenDoc Desktop", "<OD_OPENDOC>", "PROGTYPE=WINDOWABLEVIO;EXENAME=CMD.EXE;OBJECTID=<OD_OPENDOCREG>;STARTUPDIR="ODBase"\BIN;PARAMETERS=/C "ODBase"\BIN\ODDESK.CMD;MINIMIZED=NO")
  150.  
  151. /*
  152.  * 
  153.  * End of Program
  154.  * 
  155.  */
  156. n = endlocal()
  157. catgets 'ODDESK_Finish' '...End of ODDESK Command...'
  158. exit
  159.  
  160.  
  161. /*
  162.  *
  163.  * Make a directory path
  164.  *
  165.  */
  166. MakeDir: Procedure
  167.    Arg dirPath
  168.    parse value dirPath with driveRoot ':\' dirPath
  169.    if driveRoot \= '' then curDir = directory(driveRoot':\')
  170.    do while dirPath \= ''
  171.       parse value dirPath with segment '\' dirPath
  172.       rc = SysMkDir(segment)
  173.       curDir = directory(segment)
  174.    end
  175.    if curDir \= '' then return 0
  176.    return 1
  177.  
  178. /*
  179.  * 
  180.  * Routines to display error messages
  181.  * 
  182.  */
  183. AbortNoEnv:
  184.    catgets 'AbortNoEnv' 'OpenDoc environment not setup.'
  185.    exit 1
  186.  
  187. AbortNoBase:
  188.    catgets 'AbortNoBase' 'No 'ODBase' OpenDoc directory.'
  189.    exit 1
  190.  
  191. AbortNoODInst:
  192.    catgets 'AbortNoODInst' 'Missing 'ODBase'\bin\ODINST.EXE (OpenDoc Part Installer)'
  193.    exit 1
  194.  
  195. AbortInvalidDir:
  196.    Arg aDir
  197.    value('DIR', aDir, env)
  198.    catgets 'AbortInvalidDir' 'Creation of directory 'aDir' failed.'
  199.    exit 1
  200.  
  201. AbortNoCMGRCMD:
  202.    catgets 'AbortNoCMGRCMD' 'Missing 'ODBase'\bin\cmgrcmd.exe (Lotus Script registration)'
  203.    exit 1
  204.  
  205. AbortReadOnly:
  206.    Arg aDir
  207.    value('DIR', aDir, env)
  208.    catgets 'AbortReadOnly' 'Directory 'aDir' must be writable.'
  209.    exit 1
  210.  
  211.