home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / icbm101.zip / install.cmd < prev   
OS/2 REXX Batch file  |  1994-01-15  |  10KB  |  295 lines

  1. /*
  2.     Program:   ICBM - Installation script
  3.     Copyright: KnowWare Computer Products (c) 1993 all rights reserved
  4.     Author:    Grant Cause
  5.  
  6.     Purpose:   Installs ICBM OS/2 boot-up as part of config.sys
  7.  
  8.     Creation Date:  10/1/94
  9.     Last Updated:   10/1/94
  10. */
  11. trace 'O'                                /* Initialization */
  12. address CMD
  13. Call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  14. Call sysloadfuncs
  15.  
  16. ProgName = "ICBM"                        /* Package to install */
  17. BootDrive = Substr(Translate(Value('PATH',,'OS2ENVIRONMENT')),Pos('\OS2\SYSTEM',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2)
  18. ConfPath=BootDrive||'\'||"Config.Sys"    /* Full Path to Config.sys file */
  19. ConfBack=BootDrive||'\'||"Config.Bak"    /* Full Path to Config.Bak */
  20. InstPath=BootDrive||'\'||"OS2\APPS"        /* Full install Path */
  21. IniPath=BootDrive||'\'                    /* Full Path to install INI file */
  22. CmdPath=BootDrive||"\OS2\CMD.EXE"        /* Full Path to OS/2 CMD.EXE */
  23.  
  24. Main:
  25.   Call DisplayAdvert
  26.   MenuChoice = ''
  27.   do until MenuChoice == "4"
  28.     MenuOption="Installation Menu"
  29.     Call DisplayMenu
  30.     parse Upper Pull MenuChoice
  31.     if MenuChoice == '1' then do
  32.       MenuOption="Display Documentation"
  33.       Call ReadMe
  34.     end
  35.     if MenuChoice == '2' then do
  36.       MenuOption="Installation"
  37.       Call Install
  38.     end
  39.     if MenuChoice == '3' then do
  40.       MenuOption="Registration"
  41.       Call Register
  42.     end
  43.   end
  44.   Call QuitInstall                        /* Display final message */
  45.   exit 0
  46.  
  47. DisplayMenu:
  48.   Call DisplayTitle
  49.   say ""
  50.   say "                        1.  Read" ProgName "Documentation"
  51.   say ""
  52.   say "                        2.  Install" Progname
  53.   say ""
  54.   say "                        3.  Register" Progname
  55.   say ""
  56.   say "                        4.  Quit"
  57.   say ""
  58.   say "═════════════════════════════════════════════════════════════════════════"
  59.   say "Please enter your choice:"
  60.   return
  61.  
  62. ReadMe:                                        /* Read Documentation */
  63.   'attrib icbm.doc +r'
  64.   'e.exe icbm.doc'
  65.   return
  66.  
  67. Install:                                    /* Installation procedure */
  68.   do until response == 'Y'
  69.     Call DisplayInfo                        /* Verify default paths */
  70.     if response == 'Y' then do
  71.       if ConfPath == '' then do
  72.         say "Path to Config.Sys file must be defined!"
  73.         response="N"
  74.         '@pause'
  75.       end
  76.       if InstPath == '' then do
  77.         say "Installation path must be defined!"
  78.         response="N"
  79.         '@pause'
  80.       end
  81.     end
  82.     if response == 'N' then do
  83.       Call DisplayTitle
  84.       Call GetBootDrive                        /* Obtain installation drive */
  85.       Call GetCmdPath                        /* Obtain OS/2 Command Interpreter*/
  86.       IniPath=BootDrive||'\'                /* Full Path to install INI file */
  87.       ConfPath=BootDrive||'\'||"Config.Sys"    /* Full Path to Config.Sys */
  88.       ConfBack=BootDrive||'\'||"Config.Bak"    /* Full Path to Config.Bak */
  89.       Call GetInstallPath                    /* Obtain installation path */
  90.       response="N"
  91.     end
  92.   end
  93.   Call DisplayTitle
  94.   say "About to install" ProgName "to" InstPath
  95.   say ""
  96.   say "Do you wish to continue ? (Y/N)"
  97.   parse Upper Pull response
  98.   if response == 'Y' then do
  99.     Call InstallIt
  100.   end
  101.   return
  102.  
  103. GetInstallPath:                            /* Obtain installation path */
  104.   Call DisplayTitle
  105.   say "Enter the fully qualified path where" ProgName "should be placed,"
  106.   say "ie" BootDrive"\OS2\APPS or leave blank to place in root directory of" BootDrive
  107.   say ""
  108.   say "Place" ProgName "in: "
  109.   parse Upper Pull intpath
  110.   InstPath=intpath
  111.   if intpath == '' then do
  112.     InstPath=BootDrive||'\'
  113.   end
  114.   if intpath <> '' then do
  115.     if Substr(intpath,1,1) <> '\' then do
  116.        if Substr(intpath, 3, 1) <> '\' then do
  117.          InstPath='\'||intpath
  118.        end
  119.     end
  120.     if Substr(InstPath, 2, 1) <> ':' then do
  121.       InstPath=BootDrive||InstPath
  122.     end
  123.   end
  124.   return
  125.  
  126. DisplayInfo:
  127.   Call DisplayTitle
  128.   say "Full path to Config.Sys is:" ConfPath
  129.   say "Your original Config.Sys will be saved as:" ConfBack
  130.   say ProgName "will be installed in: " InstPath
  131.   say ProgName "default INI file will be installed in:" IniPath
  132.   say "Your OS/2 Command Interpreter is:" CmdPath
  133.   say ""
  134.   say "Is this correct? (Y/N)"
  135.   parse Upper Pull response
  136.   return
  137.  
  138. InstallIt:                    /* Install programs */
  139.   Call DisplayTitle
  140.   say "Installing files please wait..."
  141.   'md ' InstPath ' 1>nul 2>nul'
  142.   'copy icbm.exe ' InstPath ' 1>nul'
  143.   if rc <> 0 then do
  144.     say "Problem copying" ProgName "files to" InstPath
  145.     Call Abort
  146.     return
  147.   end
  148.   say "Installing" ProgName "default INI file will be installed in" IniPath
  149.   say "This may be edited using any ASCII text editor."
  150.   'copy icbm.ini ' IniPath ' 1>nul'
  151.   if rc <> 0 then do
  152.     say "Problem copying" ProgName "default INI file to" IniPath
  153.     Call Abort
  154.     return
  155.   end
  156.   Call UpdateConf
  157.   say "Installation sucessfull."
  158.   '@pause'
  159.   return
  160.  
  161. QuitInstall:                                        /* Installation complete */
  162.   Call DisplayTitle
  163.   say "  Please edit " IniPath " to suit your system before using " ProgName"."
  164.   say ""
  165.   say "  If you enjoy using this shareware product, then please do not forget"
  166.   say "  to register.  Select the "Register" option menu, or print and fill"
  167.   say "  out the" ProgName".REG file. And send it to:-"
  168.   Call DisplayAddress
  169.   return
  170.  
  171. Abort:                                                /* Abort installation */
  172.   say "Installation aborted.  Nothing installed."
  173.   '@pause'
  174.   return
  175.  
  176. UpdateConf:                                            /* Update Config.Sys file */
  177.   say "Creating" ConfBack "please wait..."
  178.   'copy ' ConfPath ConfBack ' 1>nul'
  179.   say "Updating" ConfPath "please wait..."
  180.   ConfNew=BootDrive||"\Config.ICB"            /* Full Path to temp Config.Sys */
  181.   ProgPath=InstPath||'\'||ProgName||".EXE"    /* Full Path to ICBM.EXE */
  182.   'echo REM > ICBM.SYS'
  183.   'echo REM' ProgName 'Install >> ICBM.SYS'
  184.   'echo REM >> ICBM.SYS'
  185.   'echo CALL='CmdPath '/C "'ProgPath'" >> ICBM.SYS'
  186.   'copy ' ConfPath'+ICBM.SYS' ConfNew ' 1>nul'
  187.   'copy ' ConfNew ConfPath ' 1>nul'
  188.   return
  189.  
  190. GetBootDrive:                                    /* Obtain installation drive */
  191.   say ""
  192.   say "Installation program has determined that OS/2 boots from drive:" BootDrive
  193.   say ProgName "will be added to the" ConfPath "file."
  194.   say ""
  195.   say "Is this correct? (Y/N)"
  196.   parse Upper Pull response
  197.   if response <> 'Y' then do
  198.     say "Please enter the drive OS/2 boots from: (ie. C:)"
  199.     parse Upper Pull BootDrive
  200.     if BootDrive == '' then do
  201.         say "Boot drive must be entered!"
  202.         Call Abort
  203.     end
  204.     if right(BootDrive, 1)<>':' then do
  205.           BootDrive=BootDrive||':'
  206.     end 
  207.   end
  208.   return 
  209.  
  210. GetCmdPath:                            /* Obtain OS/2 Command Interpreter path */
  211.   Call DisplayTitle
  212.   say "Installation program has determined that" CmdPath
  213.   say "Is the OS/2 Command Interpreter."
  214.   say ""
  215.   say "Is this correct? (Y/N)"
  216.   parse Upper Pull response
  217.   if response <> 'Y' then do
  218.     say "Enter the fully qualified path to your OS/2 Command Interpreter"
  219.     say "ie" BootDrive"\4OS2\COMMAND.COM"
  220.     say ""
  221.     say "Path to OS/2 Command Interpreter: "
  222.     parse Upper Pull NewCmdPath
  223.     CmdPath=NewCmdPath
  224.     if NewCmdPath <> '' then do
  225.       if Substr(NewCmdPath,1,1) <> '\' then do
  226.         if Substr(NewCmdPath, 3, 1) <> '\' then do
  227.           CmdPath='\'||NewCmdPath
  228.         end
  229.      end
  230.      if Substr(CmdPath, 2, 1) <> ':' then do
  231.        CmdPath=BootDrive||CmdPath
  232.      end
  233.   end
  234.   return
  235.  
  236. Register:        /* Print registration form */
  237.   Call DisplayTitle
  238.   say "  About to print the registration form, if this should prove unsuccessful"
  239.   say "  then please print and fill in the file" ProgName".REG and send it to:-"
  240.   Call DisplayAddress
  241.   say "Do you wish to continue ? (Y/N)"
  242.   parse Upper Pull response
  243.   if response <> 'N' then do
  244.     'print ICBM.REG'
  245.   end
  246.   return
  247.  
  248. DisplayCompany:
  249.   '@ECHO OFF'
  250.   'cls'
  251.   say ""
  252.   say "═════════════════════════════════════════════════════════════════════════"
  253.   say ""
  254.   say "       █   █   █▀▀▀▀▀█ █▀▀▀███ █  █  █ █  █  █  █▀▀▀█  █▀▀▀▀█  █▀▀▀▀▀▀"
  255.   say "       █▄▄█▄▄▄ █▄    █ █    ▀█ █▄ █  █ █▄ █  █ ▄█▄▄▄█▄ █▄▄▄▄█▄ █▄▄▄▄▄▄"
  256.   say "       ██    █ ██    █ █     █ ██ █  █ ██ █  █ ██    █ ██    █ ██     "
  257.   say "       ██    █ ██    █ █▄▄▄▄▄█ ██▄█▄▄█ ██▄█▄▄█ ██    █ ██    █ ██▄▄▄▄▄"
  258.   say ""
  259.   return
  260.  
  261. DisplayTitle:
  262.   Call DisplayCompany
  263.   say "                            " MenuOption
  264.   say "═════════════════════════════════════════════════════════════════════════"
  265.   return
  266.  
  267. DisplayAdvert:
  268.   MenuOption="Computer Products"
  269.   Call DisplayTitle
  270.   say " Proudly developing quality shareware for"
  271.   say ""
  272.   say "                     ▀▀▀▀▀    ▀▀▀▀▀      ▀▀  ▀▀▀▀▀▀"
  273.   say "                    ▀▀   ▀▀  ▀▀         ▀▀      ▀▀▀"
  274.   say "                   ▀▀▀   ▀▀▀  ▀▀▀▀▀    ▀▀    ▀▀▀▀"
  275.   say "                    ▀▀   ▀▀       ▀▀  ▀▀    ▀▀"
  276.   say "                     ▀▀▀▀▀   ▀▀▀▀▀▀  ▀▀     ▀▀▀▀▀▀▀ tm"
  277.   say "   The operating system and software development environment of choice."
  278.   say " OS/2 is a registered trademark of International Business Machines Corp."
  279.   say "═════════════════════════════════════════════════════════════════════════"
  280.   '@pause'
  281.   return
  282.  
  283. DisplayAddress:
  284.   say ""
  285.   say "                        ┌───────────────────────────┐"
  286.   say "                        │                       ▒▒▒ │"                       
  287.   say "                        │      Att: SysOp       ▒▒▒ │"                      
  288.   say "                        │      KNOWWARE BBS         │"                     
  289.   say "                        │      26 Ralph St,         │"                       
  290.   say "                        │      Clontarf Qld 4019    │"                       
  291.   say "                        │                           │"                       
  292.   say "                        └───────────────────────────┘"
  293.   say "═════════════════════════════════════════════════════════════════════════"
  294.   return
  295.