home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244043.dsk / unc.dsk / RECOVER / LS30CMDS / DEFAULT.CMD next >
OS/2 REXX Batch file  |  1993-02-25  |  18KB  |  453 lines

  1. /*******************************************************************/
  2. /* REXX CID procedure for LAN CID Utility processing               */
  3. /*                                                                 */
  4. /* This procedure is called in front of the standard LAN CID       */
  5. /* utility DEFAULT.CMD procedure. This procedure creates a CLIENT  */
  6. /* procedure after user input has been obtained and chains the     */
  7. /* created procedure.                                              */
  8. /*                                                                 */
  9. /* Options are:                                                    */
  10. /* Restore Domain Related data files                               */
  11. /* Reinstall OS/2 2.0 Service Package                              */
  12. /* Reinstall OS/2 2.0 and add OS/2 2.0 Service Package             */
  13. /* Reinstall OS/2 2.0, add Service Package and reinstall server    */
  14. /* OS/2 Command Line for manual operations on server               */
  15. /* New installation of OS/2, Service Package and LAN Server 3.0    */
  16. /*                                                                 */
  17. /* A switch is added for the 386 HPFS based server, which          */
  18. /* requires special considerations                                 */
  19. /*******************************************************************/
  20.  
  21. parse ARG client logfile additional
  22.  
  23. /********************************************************************/
  24. /* Assignments used                                                 */
  25. /********************************************************************/
  26. d1 = "x:"                  /* The LAN CID utility base path         */
  27. d2 = "y:"
  28. d3 = "z:"                  /* The Log file path read/write          */
  29. d4 = "w:"
  30. bootdrive = "c:"
  31. maintdrive = "c:"
  32. exepath = d1"\exe"
  33. maint_dir = maintdrive"\service"
  34. ifs_dir = bootdrive"\srvifsrq"
  35. dll_dirs = d1"\dll;"d1"\img\lcu;"
  36. rsp_dir = d1"\rsp"
  37. log_dir = d3
  38. img_dir = d1"\img"
  39. thisIsDone = 0                     /* Menu variable                 */
  40.  
  41. call resetstars;                   /* Reset all asterics markers    */
  42. 'cls'
  43. /********************************************************************/
  44. /* Begin of main loop                                               */
  45. /********************************************************************/
  46. do forever;
  47.  call QUERYINPUT;                        /* Get user input */
  48.  'cls'
  49.  if thisIsDone = 1 then do               /* Break the loop */
  50.   exit
  51.  end
  52.  
  53.  if thisIsDone = 2 then do               /* Check for options */
  54.   do i=1 to 6
  55.    if star.i = '*' then do               /* Got an option */
  56.     call performit;                      /* Process the option */
  57.     exit
  58.    end
  59.   end
  60.   thisIsDone = 0                         /* More to be done */
  61.  end
  62. end
  63. exit
  64.  
  65. /********************************************************************/
  66. /* Get input key                                                    */
  67. /********************************************************************/
  68. GETKEY:
  69.  
  70. KEY=''
  71. DO WHILE KEY=''
  72.  PARSE UPPER PULL KEY;
  73. END
  74. RETURN
  75.  
  76. /********************************************************************/
  77. /* Query options                                                    */
  78. /********************************************************************/
  79. QUERYINPUT:
  80. 'cls'
  81. say ' Select one or more of the options below:'
  82. say
  83. say ' Environment options: If 386 HPFS is used option A must be selected'
  84. say
  85. say star.0 'A Is OS/2 LAN Server 3.0 Advanced installed and using 386 HPFS?'
  86. say
  87. say ' Actions required:'
  88. say
  89. say star.1 '1 Restore Domain Related data files?'
  90. say star.2 '2 Reinstall OS/2 2.0 Service Package'
  91. say star.3 '3 Reinstall OS/2 2.0 and add OS/2 2.0 Service Package'
  92. say star.4 '4 Reinstall OS/2 2.0, add OS/2 2.0 Service Package and reinstall server'
  93. say star.5 '5 OS/2 Command Line for manual operations on server'
  94. say star.6 '6 New installation of OS/2, Service Package and LAN Server 3.0'
  95. say
  96. say ' R Reset options'
  97. say ' X Execute selected options'
  98. say ' Q Quit, do not execute selected options'
  99. say
  100.  
  101. CALL GETKEY;
  102. SELECT
  103.  WHEN KEY='A' THEN call setstars4a;
  104.  WHEN KEY='1' THEN call setstars;
  105.  WHEN KEY='2' THEN call setstars;
  106.  WHEN KEY='3' THEN call setstars;
  107.  WHEN KEY='4' THEN call setstars;
  108.  WHEN KEY='5' THEN call setstars;
  109.  WHEN KEY='6' THEN call setstars;
  110.  WHEN KEY='R' THEN call resetstars;
  111.  WHEN KEY='Q' THEN thisIsDone = 1;
  112.  WHEN KEY='X' THEN thisIsDone = 2;
  113.  OTHERWISE DO
  114.   SAY ' Enter a valid option'
  115.   'PAUSE'
  116.  END
  117. END
  118. RETURN
  119.  
  120. /********************************************************************/
  121. /* Build client cmd file from options provided                      */
  122. /* CASPREP options                                                  */
  123. /********************************************************************/
  124. performit:
  125.  
  126. /* Set used variables for CASPREP install section */
  127. casprp.inst.0 = 'semaint+laps_prep'
  128. casprp.inst.1 = 'thinifs1+thinifs2+thinifs3+casinstl'
  129. casprp.inst.2 = 'semaint+'
  130. casprp.inst.3 = 'new_seinst+'
  131. casprp.inst.4 = 're_seinst+'
  132. casprp.inst.5 = 'LAPS'
  133. casprp.inst.6 = 'laps_prep'
  134. casprp.inst.7 = 'fservice'
  135. casprp.inst.8 = 'ifsdel+casdelet'
  136. casprp.inst.9 = 'sec386'
  137. casprp.inst.10= 'thin386'
  138. casprp.inst.11= 'entry_srv_reinst'
  139. casprp.inst.12= 'entry_srv_instr'
  140. casprp.inst.13= 'advanced_srv_reinst'
  141. casprp.inst.14= 'advanced_srv_instr'
  142. casprp.inst.15= 'xcopySdf+restNetAcc'
  143. casprp.inst.16= 'cmdprompt'
  144. casprp.inst.17= 'removeOS2Acls'
  145. casprp.inst.18= 'removeAcls'
  146. casprp.inst.19= 'restoreAcls'
  147. casprp.inst.20= 'restoreAcls+ifsdel+casdelet'
  148. casprp.inst.21= 're_seinst'
  149. casprp.inst.22= 'new_seinst'
  150. casprp.inst.23= 'as_srv_386hpfs+remarkStatement'
  151. casprp.inst.24= 'remarkStatement'
  152. error_string =  'Could not prepare' client 'procedure. Will reboot.'
  153. casprp.add.0 = 'semaint+laps_prep+thinifs1+thinifs2+thinifs3+casinstl'
  154. casprp.add.1 = 'semaint+thin386+laps_prep+thinifs1+thinifs2+thinifs3+casinstl'
  155. casprp.add.2 = 'laps_prep+thinifs1+thinifs2+thinifs3+casinstl'
  156. casprp.add.3 = 'sec386+laps_prep+thinifs1+thinifs2+thinifs3+casinstl'
  157. casprp.add.4 = 'laps+thinifs1+thinifs2+thinifs3+casinstl'
  158. casprp.add.5 = 'sec386+laps+thinifs1+thinifs2+thinifs3+casinstl'
  159. casprp.add.6 = 'removeAcls+laps_prep+thinifs1+thinifs2+thinifs3+casinstl+'
  160. casprp.add.7 = 'laps_prep+thinifs1+thinifs2+thinifs3+casinstl+'
  161. casprp.add.8 = 'removeAcls+semaint+laps_prep+thinifs1+thinifs2+thinifs3+casinstl+'
  162. casprp.add.9 = 'removeOS2Acls+semaint+laps_prep+thinifs1+thinifs2+thinifs3+casinstl+'
  163. casprp.add.10= 'sec386+laps+thinifs1+thinifs2+thinifs3+casinstl'
  164. casprp.add.11= 'laps+thinifs1+thinifs2+thinifs3+casinstl'
  165. casprp.add.12= 'thin386+thinifs1+thinifs2+thinifs3+casinstl'
  166. casprp.usrl.0 = 'userline= Call RebootAndGotoState(2)'
  167.  
  168. ef = d4 || '\ls30cmds\'    /* Short cut notification */
  169. /* Vaidate that required files exist */
  170. if stream(ef||'casprep.cmd','c','query exists') <> '' then do
  171.  if stream(ef||'lsrdbase.fil','c','query exists') <> '' then do
  172.   'copy ' ef||'lsrdbase.fil ' ef||client ||'.fil'
  173.  
  174.   /* Option 1, restore server data files */
  175.   if star.1 = '*' then do        /* Restore server data files */
  176.    if star.0 = '*' then do       /*   386 HPFS installed */
  177.     add.lines.1=casprp.add.1||'+'/* 0 Install THIN386 */
  178.                                  /*   Add thinifs statements + laps_prep */
  179.     add.lines.2 = casprp.usrl.0  /*   Reboot and goto state 2 */
  180.     add.lines.3 = casprp.add.12  /* 1 Install THIN386 + laps_prep + ifs */
  181.     add.lines.4 = casprp.inst.15 /* 2 Restore server data files */
  182.     add.lines.5 = casprp.inst.23 /* 3 reinstall server 386 hpfs */
  183.     add.lines.6 = casprp.inst.8  /* 4 Remove cas */
  184.     add.lines.0 = 6
  185.    end
  186.    else do                       /*   No 386 HPFS installed */
  187.     add.lines.1 = casprp.add.2   /* 0 Add thinifs + laps_prep */
  188.     add.lines.2 = casprp.inst.15 /* 1 Restore server data files */
  189.     add.lines.3 = casprp.inst.8  /* 2 Remove cas */
  190.     add.lines.0 = 3
  191.    end
  192.  
  193.   end
  194.  
  195.   /* Option 2, reinstall OS/2 Service package */
  196.   if star.2 = '*' then do
  197.    if star.0 = '*' then do       /*   386 HPFS installed */
  198.     add.lines.1=casprp.add.1||'+'/* 0 Install THIN386 */
  199.                                  /*   Add thinifs statements + laps_prep */
  200.     add.lines.2 = casprp.usrl.0  /*   Reboot and goto state 2 */
  201.     add.lines.3 = casprp.add.12  /* 1 Install THIN386 + laps_prep + ifs */
  202.     add.lines.4 = casprp.inst.7  /* 2 fservice */
  203.  
  204.     if star.1 = '*' then do      /*   Restore server data files */
  205.      add.lines.5= casprp.inst.15 /* 3 restore server data files */
  206.      add.lines.6= casprp.inst.23 /* 4 reinstall 386 hpfs server */
  207.      add.lines.7= casprp.inst.8  /* 5 remove cas */
  208.      add.lines.0= 7
  209.     end
  210.     else do
  211.      add.lines.5= casprp.inst.23 /* 3 reinstall 386 hpfs server */
  212.      add.lines.6= casprp.inst.8  /* 4 remove cas */
  213.      add.lines.0= 6
  214.     end
  215.  
  216.    end
  217.    else do                       /*   No 386 HPFS selected */
  218.     add.lines.1 = casprp.add.0   /* 0 se_maint+ thinifs statements */
  219.     add.lines.2 = casprp.inst.7  /* 1 fservice */
  220.  
  221.     if star.1 = '*' then do      /*   Restore server data files */
  222.      add.lines.3= casprp.inst.15 /* 2 Restore server data files */
  223.      add.lines.4= casprp.inst.8  /* 3 Remove cas */
  224.      add.lines.0 = 4
  225.     end
  226.     else do                      /*   Do not restore server data files */
  227.      add.lines.3= casprp.inst.8  /* 2 Remove cas */
  228.      add.lines.0 = 3
  229.     end
  230.  
  231.    end
  232.   end
  233.  
  234.   /* Option 3, reinstall OS/2 and add service package */
  235.   if star.3 = '*' then do
  236.    if star.0 = '*' then do       /*   If 386 HPFS server */
  237.     add.lines.1 = casprp.add.1   /* 0 Install thin386 + se_maint */
  238.                                  /*   Add thinifs statements + laps_prep */
  239.                                  /* 1 re_seinst + sec386 */
  240.  
  241.     add.lines.2 = casprp.inst.4 || casprp.add.10
  242.  
  243.     add.lines.3 = casprp.add.1   /* 2 Install thin386 + se_maint */
  244.                                  /*   Add thinifs statements + laps_prep */
  245.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  246.  
  247.     if star.1 = '*' then do      /*   Restore server data files */
  248.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  249.      add.lines.6= casprp.inst.23 /* 5 advanced_srv 386 hpfs reinstall */
  250.      add.lines.7= casprp.inst.8  /* 6 Remove cas */
  251.      add.lines.0 = 7
  252.     end
  253.     else do                      /*   Do not restore server data files */
  254.      add.lines.5= casprp.inst.23 /* 4 advanced_srv 386 hpfs reinstall */
  255.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  256.      add.lines.0 = 6
  257.     end
  258.  
  259.    end
  260.    else do                       /*   No 386 HPFS selected */
  261.     add.lines.1 = casprp.add.0   /* 0 se_maint+ thinifs statements */
  262.                                  /* 1 re_seinst + cas */
  263.     add.lines.2 = casprp.inst.21 || '+' || casprp.add.11
  264.     add.lines.3 = casprp.add.0   /* 2 make new maintenance SE */
  265.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  266.  
  267.     if star.1 = '*' then do      /*   Restore server data files */
  268.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  269.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  270.      add.lines.0 = 6
  271.     end
  272.     else do                      /*   Do not restore server data files */
  273.      add.lines.5= casprp.inst.8  /* 4 Remove cas */
  274.      add.lines.0 = 5
  275.     end
  276.  
  277.    end
  278.   end
  279.  
  280.   /* Option 4, reinstall OS/2, service package and LAN Server 3.0 */
  281.   if star.4 = '*' then do
  282.    if star.0 = '*' then do       /*   If 386 HPFS server */
  283.     add.lines.1 = casprp.add.1   /* 0 Install thin386 + se_maint */
  284.                                  /*   Add thinifs statements + laps_prep */
  285.                                  /* 1 re_seinst + sec386 */
  286.  
  287.     add.lines.2 = casprp.inst.4 || casprp.add.10
  288.  
  289.     add.lines.3 = casprp.add.1   /* 2 Install thin386 + se_maint */
  290.                                  /*   Add thinifs statements + laps_prep */
  291.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  292.  
  293.     if star.1 = '*' then do      /*   Restore server data files */
  294.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  295.      add.lines.6= casprp.inst.13 /* 5 advanced_srv reinstall */
  296.      add.lines.7= casprp.inst.8  /* 6 Remove cas */
  297.      add.lines.0 = 7
  298.     end
  299.     else do                      /*   Do not restore server data files */
  300.      add.lines.5= casprp.inst.13 /* 4 advanced_srv reinstall */
  301.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  302.      add.lines.0 = 6
  303.     end
  304.  
  305.    end
  306.    else do                       /*   No 386 HPFS selected */
  307.     add.lines.1 = casprp.add.0   /* 0 se_maint+ thinifs statements */
  308.                                  /* 1 re_seinst + cas */
  309.     add.lines.2 = casprp.inst.21 || '+' || casprp.add.11
  310.  
  311.     add.lines.3 = casprp.add.0   /* 2 make new maintenance SE */
  312.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  313.  
  314.     if star.1 = '*' then do      /*   Restore server data files */
  315.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  316.      add.lines.6= casprp.inst.11 /* 5 entry_srv_reinst */
  317.      add.lines.7= casprp.inst.8  /* 6 Remove cas */
  318.      add.lines.0 = 7
  319.     end
  320.     else do                      /*   Do not restore server data files */
  321.      add.lines.5= casprp.inst.11 /* 4 entry_srv_reinst */
  322.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  323.      add.lines.0 = 6
  324.     end
  325.  
  326.    end
  327.   end
  328.  
  329.  
  330.   /* Option 5, OS/2 Command Line */
  331.   if star.5 = '*' then do
  332.    if star.0 = '*' then do
  333.     add.lines.1=casprp.add.1||'+'/* 0 Install thin386 + se_maint */
  334.     add.lines.2 = casprp.usrl.0  /*   Reboot and goto state 2 */
  335.     add.lines.3 = casprp.add.12  /* 1 thin386 + casinstl */
  336.     add.lines.4 = casprp.inst.16 /* 2 command prompt */
  337.     add.lines.5 = casprp.inst.23 /* 3 reinst 386 HPFS server */
  338.     add.lines.6 = casprp.inst.8  /* 4 remove cas */
  339.     add.lines.0 = 6
  340.    end
  341.    else do
  342.     add.lines.1 = casprp.inst.16 /* 0 command prompt */
  343.     add.lines.0 = 1
  344.    end
  345.   end
  346.  
  347.   /* Option 6, new install of all */
  348.   if star.6 = '*' then do
  349.    if star.0 = '*' then do       /*   If 386 HPFS server */
  350.     add.lines.1 = casprp.add.1   /* 0 Install thin386 + se_maint */
  351.                                  /*   Add thinifs statements + laps_prep */
  352.                                  /* 1 new_seinst + sec386 */
  353.  
  354.     add.lines.2 = casprp.inst.3 || casprp.add.10
  355.  
  356.     add.lines.3 = casprp.add.1   /* 2 Install thin386 + se_maint */
  357.                                  /*   Add thinifs statements + laps_prep */
  358.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  359.  
  360.     if star.1 = '*' then do      /*   Restore server data files */
  361.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  362.      add.lines.6= casprp.inst.14 /* 5 advanced_srv_instr */
  363.      add.lines.7= casprp.inst.8  /* 6 Remove cas */
  364.      add.lines.0 = 7
  365.     end
  366.     else do                      /*   Do not restore server data files */
  367.      add.lines.5= casprp.inst.14 /* 4 advanced_srv_instr */
  368.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  369.      add.lines.0 = 6
  370.     end
  371.  
  372.    end
  373.    else do                       /*   No 386 HPFS selected */
  374.     add.lines.1 = casprp.add.0   /* 0 se_maint+ thinifs statements */
  375.                                  /* 1 new_seinst + cas */
  376.     add.lines.2 = casprp.inst.22 || '+' || casprp.add.11
  377.     add.lines.3 = casprp.add.0   /* 2 make new maintenance SE */
  378.     add.lines.4 = casprp.inst.7  /* 3 fservice */
  379.  
  380.     if star.1 = '*' then do      /*   Restore server data files */
  381.      add.lines.5= casprp.inst.15 /* 4 Restore server data files */
  382.      add.lines.6= casprp.inst.12 /* 5 entry_srv_instr */
  383.      add.lines.7= casprp.inst.8  /* 6 Remove cas */
  384.      add.lines.0 = 7
  385.     end
  386.     else do                      /*   Do not restore server data files */
  387.      add.lines.5= casprp.inst.12 /* 4 entry_srv_instr */
  388.      add.lines.6= casprp.inst.8  /* 5 Remove cas */
  389.      add.lines.0 = 6
  390.     end
  391.  
  392.    end
  393.   end
  394.  
  395.  end
  396. end
  397.  
  398. /* Make CASPREP input file ready for processing */
  399. fn = ef || client || '.fil'
  400. if rc = 0 then do
  401.  call LINEOUT fn, add.lines.1
  402.  do i=2 to add.lines.0
  403.   call LINEOUT fn, add.lines.i
  404.  end
  405.  call LINEOUT fn, ':endinstall'
  406.  call LINEOUT fn
  407.  
  408.  '@call' ef||'casprep.cmd' ef||client||'.fil' ef||client||'.cmd' ef||'casbase.fil'
  409.  'erase ' ef || client || '.fil'
  410.  '@call 'ef || client client logfile  /* created OK, call it */
  411. end
  412. else do                         /* else log the error  */
  413.  lineout logfile, error_string
  414.  say error_string                            /* display error      */
  415.  call RxFuncAdd 'AskRemoveDiskIfFloppy', 'CASAGENT',
  416.                  'ASKREMOVEDISKIFFLOPPY'
  417.  rc = AskRemoveDiskIfFloppy( ) /* Remove diskette if one is in drive */
  418.  exepath || '\setboot /ibd:c:'               /* reboot */
  419. end
  420.  
  421. return
  422. /********************************************************************/
  423. /* Set asterics                                                     */
  424. /********************************************************************/
  425. setstars:
  426. do i=2 to 6
  427.  star.i = ' '
  428. end
  429. star.KEY = '*'
  430. if star.5 = '*' then
  431.  star.1 = ' '
  432. return
  433.  
  434. /********************************************************************/
  435. /* Reset for 386 HPFS selections                                    */
  436. /********************************************************************/
  437. setstars4a:
  438. do i=1 to 6
  439.  star.i = ' '
  440. end
  441. star.0 = '*'
  442. return
  443.  
  444. /********************************************************************/
  445. /* Reset all asterics                                               */
  446. /********************************************************************/
  447. resetstars:
  448. do i=0 to 6
  449.  star.i = ' '
  450. end
  451. return
  452.  
  453.