home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / binsuk18.zip / install.cmd < prev   
OS/2 REXX Batch file  |  1999-08-23  |  6KB  |  144 lines

  1. /*
  2.   REXX Script to install BinSuk and create a desktop folder and objects.
  3. */
  4.  
  5.   appName="BinSuk 1.80"
  6.   DefaultDir="C:\BinSuk"
  7.  
  8.   say'Unzipping the 'appName' distribution...'
  9.   say''
  10.  
  11.   '@unzip -oC BinSuk.zip 1>nul 2>nul'
  12.  
  13.   if rc\=0 then do
  14.     rc=errorSound(1)
  15.     say'There has been an error in unzipping the 'appName' distribution archive!'
  16.     say''
  17.     say'Good luck!'
  18.     say
  19.     exit 1
  20.     end /* if rc */
  21.  
  22.   SIGNAL ON ERROR NAME Err
  23.  
  24.   say'Installing 'appName'...'
  25.  
  26.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  27.   Call SysLoadFuncs;
  28.  
  29.   Question:
  30.     say''
  31.     say'Where do you wish to copy the files for 'appName' ?'
  32.     say'(e.g. 'DefaultDir')  '
  33.     PARSE PULL path
  34.  
  35.     IF path = "" THEN path=DefaultDir
  36.  
  37.     say''
  38.     say appName' files will be copied to 'path
  39.     say''
  40.     say'Press <return> to continue, <E> to enter a new location or'
  41.     say'<C> to cancel.'
  42.     pull answer
  43.  
  44.   if answer="C" then exit
  45.   if answer="E" then signal Question
  46.  
  47.   if pos(':',path) \=2 then do
  48.    say'Sorry, but this install routine requires that you enter a COMPLETE path,'
  49.    say'including a legal drive assignment!'
  50.    rc=erroSound(1)
  51.    signal Question
  52.    end /* if pos */
  53.  
  54.   if pos('\',path) \=3 then do
  55.    say'Sorry, but 'appName' should not be installed to a root directory!'
  56.    rc=erroSound(1)
  57.    signal Question
  58.    end /* if pos */
  59.  
  60.   parse var path drive '\' dir.1 '\' dir.2 '\' dir.3 '\' dir.4 '\' dir.5 '\' dir.6
  61.  
  62.   rc=sysDriveInfo(drive)
  63.   if rc='' then do
  64.     say'Sorry, not able to find the 'drive' drive!'
  65.     say''
  66.     rc=errorSound(1)
  67.     signal Question
  68.     end /* if rc */
  69.  
  70.   say'Creating the target path: 'path
  71.   say''
  72.   NewDir=drive
  73.  
  74.   do i = 1 to 6
  75.     if dir.i='' then leave
  76.     NewDir=NewDir||'\'||dir.i
  77.     rc=SysMkDir(NewDir)
  78.     if rc\=0 then leave
  79.     end /* do i */
  80.  
  81.   if rc\= 0 then do
  82.     say"Sorry, there's a problem creating the supplied path: "path
  83.     say
  84.     signal Question
  85.     end
  86.  
  87.   say'Copying the 'appName' files to 'path
  88.   '@copy *.* 'path' 1>nul 2>nul'
  89.  
  90.   path=path||'\'
  91.  
  92.   say "Creating the 'appName' main folder..."
  93.   call SysCreateObject "WPFolder", appName, "<WP_DESKTOP>",        "OBJECTID=<BINSUKFOLDER>;    ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;ICONFONT=10.Helv;BACKGROUND=" || path || "back.bmp,T;ICONFILE=" || path || "FOLDER.ICO", "REPLACE"
  94.   call SysCreateObject "WPFolder", "Utility programs", "<BINSUKFOLDER>", "OBJECTID=<BINSUKUTILFOLDER>;ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;ICONFONT=10.Helv;BACKGROUND=" || path || "back.bmp,T", "REPLACE"
  95.   call SysCreateObject "WPFolder", "Information",      "<BINSUKFOLDER>", "OBJECTID=<BINSUKINFOFOLDER>;ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;ICONFONT=10.Helv;BACKGROUND=" || path || "back.bmp,T", "REPLACE"
  96.   call SysCreateObject "WPFolder", "Binaries",         "<BINSUKFOLDER>", "OBJECTID=<BINSUKBINARIES>;  ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;ICONFONT=10.Helv;BACKGROUND=" || path || "back.bmp,T", "REPLACE"
  97.  
  98.   say "Creating program objects in the BinSuk utility folder..."
  99.   call SysCreateObject "WPProgram", "BinSuk.cmd",      "<BINSUKUTILFOLDER>", "EXENAME=" || path || "BINSUK.CMD;     STARTUPDIR=" || path || ";ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;", "REPLACE"
  100.   call SysCreateObject "WPProgram", "BSParse.cmd",     "<BINSUKUTILFOLDER>", "EXENAME=" || path || "BSPARSE.CMD;    STARTUPDIR=" || path || ";ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;", "REPLACE"
  101.   call SysCreateObject "WPProgram", "AgeDupeLogs.cmd", "<BINSUKUTILFOLDER>", "EXENAME=" || path || "AGEDUPELOGS.CMD;STARTUPDIR=" || path || ";PARAMETERS=" || " 60 " || ";ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;", "REPLACE"
  102.   call SysCreateObject "WPProgram", "doit.cmd",        "<BINSUKUTILFOLDER>", "EXENAME=" || path || "DOIT.CMD;       STARTUPDIR=" || path || ";ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;", "REPLACE"
  103.   call SysCreateObject "WPProgram", "MakeList.cmd",    "<BINSUKUTILFOLDER>", "EXENAME=" || path || "MAKELIST.CMD;   STARTUPDIR=" || path || ";ICONVIEW=NONGRID,NORMAL;ALWAYSSORT=YES;", "REPLACE"
  104.  
  105.   say "Creating information objects in the BinSuk information folder..."
  106.   call SysCreateObject "WPProgram", "File_ID.DIZ",          "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "FILE_ID.DIZ",              "REPLACE"
  107.   call SysCreateObject "WPProgram", "BinSuk.Read.Me",       "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "BINSUK.READ.ME",           "REPLACE"
  108.   call SysCreateObject "WPProgram", "BinSuk.trash",         "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "BINSUK.TRASH",             "REPLACE"
  109.   call SysCreateObject "WPProgram", "BinSuk.fetch",         "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "BINSUK.FETCH",             "REPLACE"
  110.   call SysCreateObject "WPProgram", "BSParse.txt",          "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "BSPARSE.TXT",              "REPLACE"
  111.   call SysCreateObject "WPProgram", "The Future Plans",     "<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "GOING.TO.DO.THIS.SOMEDAY", "REPLACE"
  112.   call SysCreateObject "WPProgram", "GNU COPYRIGHT LICENSE","<BINSUKINFOFOLDER>", "EXENAME=E.EXE;PARAMETERS=" || path || "COPYING.TXT",              "REPLACE"
  113.  
  114.   call SysIni , 'BinSuk', 'InstallDirectory', path
  115.  
  116.   say'Installation completed - 'appName
  117.   say''
  118.  
  119.   exit 0
  120.  
  121. Err:
  122.   say ""
  123.   say "An error has occured. Possible causes are:"
  124.   say ""
  125.   say " - You have interrupted installation by pressing CTRL-BREAK."
  126.   say " - A file is missing in the package. Try to unpack the archive file again."
  127.   say " - A file cannot be replaced because it is in use. Make sure the program"
  128.   say "   you're about to install is not running currently."
  129.   say ""
  130.   say "Please try again later."
  131. exit 1
  132.  
  133. errorSound: procedure
  134.  
  135.   SOUND=arg(1)
  136.  
  137.   if SOUND = 1 then do
  138.     call beep 400, 25
  139.     call beep 500, 25
  140.     end /* if sound */
  141.  
  142.     return 0
  143.  
  144.