home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rdebug21.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1993-04-03  |  8KB  |  324 lines

  1. /*H* INSTALL.REX 01-30-93 14:26*/
  2.  /* comes from an application control file */
  3.  /* Log into target drive:   */
  4.  /* INSTALL drive target product */
  5.  /* INSTALL C:    OS2    rDEBUG  */
  6.  trace ?r
  7.  arg drive target product
  8.  Parse source sys .
  9.  call initial
  10.  call setup
  11.  call install_directories
  12.  call install_files
  13.  drive
  14.  call directory(product)
  15. call install_desktop
  16.  exit 0
  17.  
  18.  INSTALL_DIRECTORIES:
  19.  if sys='OS2'  then do
  20.    if RxMessageBox(product 'will be installed in directory' directory 'on drive' drive'. ',
  21.    'Want to continue?','INSTALL.CMD','YesNo','Query')=7 then answer='N'
  22.  end
  23.  else do
  24.    say product 'will be installed in directory' directory 'on drive' drive
  25.    say 'Want to continue? (Yes/No)'
  26.    answer=inkey()
  27.  end
  28.  if left(answer,1)<>'Y' then exit 100
  29.  rc=MkDir(drive''directory)
  30.  if rc<>0 then do
  31.    msg.1=product 'may already be installed.  Want to continue?'
  32.    if sys='OS2'  then do
  33.      if RxMessageBox(msg.1,'INSTALL.CMD','YesNo','Query')=7 then answer='N'
  34.    end
  35.    else do
  36.      say product 'may already be installed.  Want to continue? (Yes/No)'
  37.      pull answer
  38.    end
  39.    if left(answer,1)<>'Y' then exit 100
  40.  /*
  41.    do i=1 to files
  42.      call DeleteFile drive''directory'\'files.i
  43.    end
  44.  */
  45.  end
  46.  parse value DriveInfo(drive) with . free .
  47.  if free < required_space then do
  48.    msg.1='Product' product 'requires' required_space
  49.    msg.2= 'bytes of storage.  You only have' free 'bytes'
  50.    msg.3= 'available.  Please make more space available on'
  51.    msg.4= 'the drive' drive 'and try again.'
  52.    if sys='OS2'  then do
  53.      if RxMessageBox(msg.1 msg.2 msg.3 msg.4,'INSTALL.CMD','YesNo','Query')=7 then answer='N'
  54.    end
  55.    else do
  56.      say msg.1
  57.      say msg.2
  58.      say msg.3
  59.      say msg.4
  60.    end
  61.    exit 100
  62.  end
  63.  do i=1 to directories
  64.    rc=MkDir(drive''directories.i)
  65.  end
  66.  return
  67.  
  68.  INSTALL_FILES:
  69.  do i=1 to files
  70.    say 'Copying' files.i
  71.    type=right(files.i,4)
  72.    select
  73.      when target='ALL' then
  74.      call quiet 'Copy' files.i drive''directory'\'files.i  '>nul'
  75.      when wordpos(type,'.KEX .CMD .REX')>0 then call edit
  76.      otherwise
  77.      call quiet 'Copy' files.i drive''directory'\'files.i  '>nul'
  78.    end
  79.  end
  80.  return
  81.  
  82.  edit:
  83.  /* remove next if statement when full install is debugged */
  84.  editlist='DEBUGRUN.KEX RDBCMDS.KEX RDBUI.KEX RDBUIEXT.OS2',
  85.  'RDBMENU.KEX RDBTASK.KEX RDBMISC.KEX RDBPROF.KEX'
  86.  if wordpos(files.i,editlist)=0 then do
  87.    call quiet 'Copy' files.i drive''directory'\'files.i '>nul'
  88.    return; end
  89.  if sys='OS2' then do
  90.    '@set rdparms=' files.i target bbs? drive''directory'\'
  91.    editor files.i '(PROF rdxGEN'; end
  92.  if sys='DOS' then do
  93.    Queue '        MACRO rdxgen /GEN' files.i target drive''directory'\'
  94.    editor files.i '(PROF rdprofil'; end
  95.  return
  96.  
  97.  QUIET:  arg cmd
  98.  if sys='DOS' then do
  99.    cmd
  100.    return 0; end
  101.  if sys='OS2' then '@'cmd
  102.  return
  103.  
  104.  MkDir: arg dir
  105.  if sys='DOS' then do
  106.    'md' dir
  107.  
  108.    return 0; end
  109.  if sys='OS2' then return SysMkDir(dir)
  110.  return
  111.  
  112.  DeleteFile: arg dfiles
  113.  if sys='DOS' then do
  114.    'del' dfiles
  115.  end
  116.  else call SysFileDelete dfiles
  117.  return
  118.  
  119.  DriveInfo: arg dr
  120.  if sys='DOS' then do
  121.    return 0 1000
  122.  end
  123.  if sys='CMS' then do
  124.    say 'Requires more code in driveinfo rtn'
  125.    return 0 1000
  126.  end
  127.  return SysDriveInfo(dr)
  128.  return 0 1000
  129.  
  130.  SETUP:
  131.  file=product'.CTL'
  132.  files=0
  133.  required_space=0
  134.  directories=0
  135.  line= linein(file)
  136.  do until lines(file)=0
  137.    parse var line type value
  138.    select
  139.      when type='FILE' then do
  140.        parse value value with filename code   /*!1*/
  141.        if code = 'T' then do      /*!1*/
  142.          if state(filename)<>1 then iterate; end /*!1*/
  143.        files=files + 1
  144.        /*!1 files.files= value */
  145.        files.files= filename      /*!1*/
  146.        code.files= code           /*!1*/
  147.      end
  148.      when type ='SUBDIRECTORY' then do
  149.        directories=directories + 1
  150.        directories.directories= value
  151.      end
  152.      when type ='DIRECTORY' then directory=value
  153.      when type ='SPACE'     then required_space=required_space+value
  154.      otherwise nop
  155.    end
  156.    line=linein(file)
  157.  end
  158.  call lineout file
  159.  return
  160.  
  161.  RxMessageBox: parse arg msg.1,, prompt
  162.  say msg.1 prompt
  163.  pull answer
  164.  if left(answer,1)='Y' then answer='Y'
  165.  else answer=7 /*NO*/
  166.  return answer
  167.  
  168. install_desktop:
  169. call createfolder
  170.  
  171. title = program
  172. program = 'rDEBUG.cmd'
  173. fullname = 'C:\'product'\'program
  174. Setup =      ";EXENAME="fullname
  175. Setup = Setup";PARAMETERS=?"
  176. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  177. Setup = Setup";STARTUPDIR=C:\"product
  178. Setup = Setup";WORKINGDIR=C:\"product
  179. call createprogram
  180.  
  181. title   = 'D:\rDEBUG'
  182. program = 'rDEBUG.cmd'
  183. fullname = 'C:\'product'\'program
  184. Setup =      ";EXENAME="fullname
  185. Setup = Setup";PARAMETERS=?"
  186. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  187. Setup = Setup";STARTUPDIR=D:\"product
  188. Setup = Setup";WORKINGDIR=D:\"product
  189. call createprogram
  190.  
  191. title   = 'TESTPROF'
  192. program = 'rDEBUG.cmd'
  193. fullname = 'C:\'product'\'program
  194. Setup =      ";EXENAME="fullname
  195. Setup = Setup";PARAMETERS=profile"
  196. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  197. Setup = Setup";STARTUPDIR=C:\"product
  198. Setup = Setup";WORKINGDIR=C:\"product
  199. call createprogram
  200.  
  201. title   = 'DEMO'
  202. program = 'rDEBUG.cmd'
  203. fullname = 'C:\'product'\'program
  204. Setup =      ";EXENAME="fullname
  205. Setup = Setup";PARAMETERS="
  206. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  207. Setup = Setup";STARTUPDIR=C:\"product
  208. Setup = Setup";WORKINGDIR=C:\"product
  209. call createprogram
  210.  
  211. title   = 'HELP'
  212. program = 'E.exe'
  213. fullname = program
  214. Setup =      ";EXENAME="fullname
  215. Setup = Setup";PARAMETERS=C:\rDEBUG\rDEBUG.hlp"
  216. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  217. Setup = Setup";STARTUPDIR=C:\"product
  218. Setup = Setup";WORKINGDIR=C:\"product
  219. call createprogram
  220. title   = 'README'
  221.  
  222. program = 'E.exe'
  223. fullname = program
  224. Setup =      ";EXENAME="fullname
  225. Setup = Setup";PARAMETERS=C:\rDEBUG\README.OS2"
  226. Setup = Setup";PROGTYPE=OS2FULLSCREEN"
  227. Setup = Setup";STARTUPDIR=C:\"product
  228. Setup = Setup";WORKINGDIR=C:\"product
  229. call createprogram
  230. return
  231.  
  232. CREATEFOLDER:
  233. location='<WP_DESKTOP>'
  234. Setup = "OBJECTID=<"product">"
  235. status='UPDATE'
  236. msg.1='Unable to created folder for' product
  237. if SysCreateObject("WPFolder",product,location,setup,status)=1 then nop
  238. else do
  239.   if sys='OS2'  then call RxMessageBox msg.1,'OK','ERROR'
  240.   else say msg.1
  241.   exit
  242. end
  243. return
  244.  
  245. CREATEPROGRAM:
  246. arg program
  247. location='<UWP_'product'>'
  248. location='<WP_DESKTOP>'
  249. location='<'product'>'
  250. status='FAILIFEXIST'
  251. status='UPDATE'
  252. status=''
  253. msg.1='Unable to created program object:' product 'for' product 'folder'
  254. if SysCreateObject("WPProgram",title,location,setup,)=1 then nop
  255. else do
  256.   if sys='OS2'  then call RxMessageBox msg.1,'OK','ERROR'
  257.   else say msg.1
  258.   exit
  259. end
  260. return
  261.  
  262. LoadFunctions: procedure
  263. /*
  264. **   This will load the DLL for the Rexx system functions supplied
  265. **   with OS/2 v2.0
  266. */
  267. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  268. call SysLoadFuncs
  269. return
  270.  
  271. Return; STATE:
  272. /* To provide compatibility With state module in Cms & OS2 */
  273. Arg specs
  274. If sys.dos Then Do
  275.   If lines(specs) Then src=1
  276.   else src=28; end
  277. else if sys.os2 then do  /*O*/
  278.   If lines(specs) Then src=1
  279.   else src=28; end
  280. Else 'STATE' specs
  281. Return src
  282.  
  283. INITIAL:
  284. Parse source sys .
  285. if      sys='OS/2'  then sys='OS2'
  286. else if sys='PCDOS' then sys='DOS'
  287. if sys='OS2' then call LoadFunctions
  288. sys.=0
  289. if sys='OS2' then sys.os2=1
  290. if sys='DOS' then sys.dos=1
  291. /*!1 drive=left(syssearchpath( 'path', '\nul'),2) */
  292. if drive ='' then  drive='C:'
  293. if right(drive,1)<>':' then  drive=drive':'
  294. if target ='' then  target='ALL'   /*!1*/
  295. bbs?=0
  296. if wordpos(target,'ALL OS2 *DOS *CMS')=0 then do
  297.   msg.1=sys 'system not supported with this version',,
  298.   if sys='OS2'  then call RxMessageBox msg.1, 'INSTALL.CMD','OK','ERROR'
  299.   else say msg.1
  300.   exit
  301. end
  302. if product ='' then  product='rDEBUG'
  303. if sys='CMS' then editor='XEDIT'
  304. if sys='OS2' then editor='KEDIT'
  305. if sys='DOS' then do
  306.   editor='KEDIT'; end
  307. if sys='OS2' then call LoadFunctions
  308. do while target=''
  309.   say 'Indicate what system to generate: OS2 DOS CMS or ALL'
  310.   pull answer
  311.   ans=left(answer,1)
  312.   select
  313.     when ans='O' then target='OS2'
  314.     when ans='D' then target='DOS'
  315.     otherwise
  316.     msg.1='System:' answer 'currently not supported'
  317.     if sys='OS2'  then call RxMessageBox msg.1,'INSTALL.CMD','OK','ERROR'
  318.     else say msg.1
  319.     exit
  320.   end
  321. end
  322. return
  323.  
  324.