home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / ip7005.zip / HPFS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-10-29  |  28KB  |  759 lines

  1. /****************************************************************************
  2.  
  3.         Module Name             = HPFS.CMD
  4.  
  5.         Descriptive Name        = Select Pak IP07005 ( HPFS386FS )
  6.                                   install tool
  7.  
  8.         Copyright               = 04G1049  (C) Copyright IBM Corp. 1988, 1991.
  9.                                   All rights reserved.
  10.                                   US Government Users Restricted Rights -
  11.                                   Use, duplication or disclosure restricted by
  12.                                   GSA ADP Schedule Contract with IBM Corp.
  13.  
  14.                                   Licensed Materials - Property of IBM
  15.  
  16.         Function                = Installation tool for Select Pak
  17.  
  18.         Operating System        = OS/2 2.x
  19.  
  20. ****************************************************************************/
  21.  
  22. signal on halt          /* call HALT: routine on CTRL-BREAK */
  23. "echo off"
  24. final_rc = 0            /* preset return code */
  25. /*************************************************/
  26. /* Set the following variables to substitute the */
  27. /* correct SelectPak data                        */
  28. /*************************************************/
  29. Prod_id.1 = "HPFS"             /* extension for syslevel files        */
  30. Prod_dir = "IBM386FS"
  31. Prod_title = "MSG.80"
  32. SPak = "IP07005"
  33. Backup_size = '150k'
  34. subdirs.0 = '1'                  /* number of subdirectories in product */
  35. subdirs.1 = 'IBM386FS'          /* subdirectories in product */
  36. syslvl_prefix.0 = '1'         /* number of syslevels to be updated */
  37. syslvl_prefix.1 = 'IP0'       /* syslevel prefix  for prereqs      */
  38. /***********************************************************/
  39.  
  40. /*************************************************/
  41. /* Read in command line arguments if they exist  */
  42. /*************************************************/
  43. parse upper arg var1 var2 var3 var4 rest
  44.  
  45. /***********************************************************/
  46. /* Serach for SYSLEVEL.SRV drive                           */
  47. /***********************************************************/
  48. drive_array = "CDEFGHIJKLMNOPQRSTUVWXYZ"
  49.  
  50. do k = 1 to 24
  51. drive_letter = substr(drive_array,k,1)
  52. sysl = drive_letter":\IBMLAN\SYSLEVEL.SRV"
  53. 'dir 'sysl' >>NUL 2>>&1 '
  54. if rc \= 0 then do      /* if syslevel not found, keep seraching */
  55.    sysl = ''
  56.    iterate
  57.    end
  58.  
  59.    else do
  60.    sysline = linein(sysl)     /* read in SYSLEVEL.SRV */
  61.    RC = stream(sysl,'c','close')
  62.         /* close the SYSLEVEL.SRV file so that it can be upkated */
  63.    country = substr(sysline,47,1)
  64.    signal vmsg
  65.    end
  66. end
  67.  
  68.  
  69.  say " This SelectPak has a prereq to "
  70.  say " LS3.0 IBM386FS with LAN SERVER syslevel 7001 "
  71.  say " which is not installed ... Quitting "
  72.  
  73.    signal  End
  74.  
  75. vmsg:
  76.  
  77. /* SELPAK.MSG = "IP"country"7005.MSG" */
  78.  
  79. /***********************************************************/
  80. /*     Verify that the Select Pak message file exists      */
  81. /***********************************************************/
  82. MSG_FILE = stream('SELPAK.MSG' , 'c' , 'query exists')
  83. if MSG_FILE = "" then
  84.   do
  85.   say " ERROR: could not find message file SELPAK.MSG "
  86.   signal End
  87.   end
  88.  
  89. /***************************************************/
  90. /* Read the message file into an array of messages */
  91. /***************************************************/
  92. do while lines(MSG_FILE) \= 0    /* While not at EOF  */
  93.         Message = linein(MSG_FILE)
  94.         parse var Message message_number text_of_message
  95.         MSG.message_number = text_of_message
  96.  
  97. end                              /* End of While loop */
  98.  
  99.  
  100. /**************************************/
  101. /*  Close the message file            */
  102. /**************************************/
  103. RC = stream('SELPAK.MSG' , 'c' , 'close')
  104.  
  105.  
  106. /****************************************/
  107. /*  One possible input parameter is '?' */
  108. /*  Display the help panel in this case */
  109. /****************************************/
  110. backup_dir = '\'prod_id.1'_BAK'
  111. if var1 = "?" then signal syntax
  112.  "cls"
  113.  
  114. /*************************/
  115. /*  Introductory panel   */
  116. /*************************/
  117. say
  118. say
  119. say center(value(prod_title),80)
  120. say center(Create_MSG(MSG.01,SPak),80)
  121. say center(Create_MSG(MSG.02,"SRV"),80)
  122. say
  123. say        " Please shut down LAN Server before applying this SelectPak "
  124. say        " ( Ctrl_Break, then Enter to exit ) "
  125. say
  126.  
  127. Source_path = ""
  128. Base_Drive = ""
  129. Update_Drive = ""
  130. Log_File = ""
  131. Verified = ""
  132. Backup_dir = ""
  133. Backed = ""
  134. First_lock = "1"
  135. Filename. = "aaa"
  136. Prod_msg = value(prod_title)
  137. result=0
  138. token.1 = var1
  139. token.2 = var2
  140. token.3 = var3
  141. token.4 = var4
  142. token.5 = var5
  143. token.6 = rest
  144. do i = 1 to 6 until token.i = ""
  145.    select
  146.        when substr(token.i,1,3) = "/B:" then
  147.          Base_Drive = substr(token.i,4,,)
  148.       when substr(token.i,1,3) = "/T:" then
  149.          Update_drive = substr(token.i,4,,)
  150.       when substr(token.i,1,3) = "/K:" then
  151.          Backed = substr(token.i,4,,)
  152.       when substr(token.i,1,3) = "/S:" then
  153.          Source_path = substr(token.i,4,,)
  154.       when substr(token.i,1,3) = "/V:" then
  155.          Verified = substr(token.i,4,,)
  156.       otherwise
  157.    end       /* end select */
  158. end          /* do loop */
  159.  
  160. start:
  161.  
  162. /***************************************************/
  163. /* The Base Drive letter is the Drive letter that  */
  164. /* contains the Base Operating System.             */
  165. /***************************************************/
  166. if Base_Drive \= "" then signal got_Base_Drive
  167. get_Base_Drive:
  168. call charout ,"  "MSG.03"  "
  169. parse upper linein Base_Drive
  170. got_Base_Drive:
  171. Base_Drive = strip(Base_drive,T,':')   /* remove trailing colon */
  172.  
  173. /*************************************************/
  174. /* Verify that the \OS2\INSTALL directory exists */
  175. /* on the drive specified by the user            */
  176. /*************************************************/
  177.  
  178. "dir "Base_Drive":\OS2\INSTALL > NUL  2>>&1"
  179. if RC \= 0 then
  180.    do
  181.    say
  182.    say "  "Create_MSG(MSG.05,Base_Drive':\OS2\INSTALL')"  "
  183.    Base_Drive = ""
  184.    signal get_Base_Drive
  185.    end
  186. Base_done:
  187. /***************************************************/
  188. /* The log varible will contain the full path name */
  189. /* of the output log.  The output log will contain */
  190. /* any error messages from this installation       */
  191. /***************************************************/
  192. log_file = ""Base_drive":\OS2\INSTALL\"SPak".LOG"
  193. /******************************************************/
  194. /* The Update Drive letter is the letter of the Drive */
  195. /* containing the Database system directory that      */
  196. /* you wish to upgrade.                               */
  197. /******************************************************/
  198. get_Update_Drive:
  199. if Update_Drive \= "" then signal got_Update_Drive
  200. call charout ,"  "MSG.91"   "
  201. parse upper linein Update_Drive
  202. got_Update_Drive:
  203. Update_drive = STRIP(Update_drive,T,':')     /* remove trailing colon */
  204.  
  205. /*************************************************/
  206. /* Verify that the Product directory exists      */
  207. /* on the drive specified by the user            */
  208. /*************************************************/
  209. "dir "Update_Drive":\"Prod_dir" > NUL  2>>&1"
  210. if RC \= 0 then
  211.   do
  212.   say
  213.   say "  "Create_MSG(MSG.05,Update_Drive':\'Prod_dir)"  "
  214.   Update_Drive = ""
  215.   signal get_Update_Drive
  216.   end
  217.  
  218. /******************************************************/
  219. /* The Source path is the path where the updates      */
  220. /* reside.                                            */
  221. /******************************************************/
  222. get_Source_Path:
  223. if Source_Path \= "" then signal got_Source_Path
  224. call charout,"  "Create_MSG(MSG.10,SPak'.SPK')" "
  225. parse upper linein Source_Path
  226. got_Source_Path:
  227. /*************************************************/
  228. /* Verify that the zip file exists               */
  229. /* on the path specified by the user             */
  230. /*************************************************/
  231. if length(Source_Path) = 1 then     /* allow user to enter */
  232.    Source_Path = Source_Path':'     /* drive letter only   */
  233. source_file = stream(source_path'\'SPak'.SPK','c','query exists')
  234. if source_file = "" then
  235.   do
  236.   say
  237.   say "  "Create_MSG(MSG.11,source_path'\'SPak'.SPK')" "
  238.   Source_Path = ""
  239.   signal get_Source_Path
  240.   end
  241.  
  242.  
  243. /*************************************************/
  244. /* Set up backup directory for verification      */
  245. /*************************************************/
  246. Get_backup:
  247. backup_dir = Update_drive':\'prod_id.1'_BAK'
  248. if Backed \= "" then signal got_Backup
  249. /***********************************************************/
  250. /* Ask the user if they would like the old files to be     */
  251. /* backed up to the default directory or specify their own */
  252. /***********************************************************/
  253. say
  254. say "  "Create_MSG(MSG.13,Backup_size)
  255. ask_Backup:
  256. say "  "MSG.14
  257. /* call charout , "  "Create_MSG(MSG.35,Backup_dir) */
  258. say "        "Create_MSG(MSG.35,Backup_dir)"            "
  259. say "        "MSG.72
  260. parse linein Backed
  261. if Backed = "" then signal ask_Backup
  262. got_Backup:
  263. if backed \= '0' & backed \= '1' then
  264.   do
  265.   backup_dir = backed
  266.     end
  267.  
  268. start_verify:
  269. /***********************************************************/
  270. /* Display the log file name                                                                         */
  271. /***********************************************************/
  272. say
  273. say "  "Create_MSG(MSG.08,log_file)"  "
  274. /***********************************************************/
  275. /* Display the directory that will be updated                                                */
  276. /***********************************************************/
  277. say "  "Create_MSG(MSG.12,Update_Drive':\'Prod_dir)"  "
  278. /***********************************************************/
  279. /* Display the source path for update data                 */
  280. /***********************************************************/
  281. say "  "Create_MSG(MSG.63,Source_Path'\'SPak'.SPK')"  "
  282. /***********************************************************/
  283. /* Display the backup path                                                                          */
  284. /***********************************************************/
  285. if backed = '0' then
  286.   say "  "msg.60
  287. else
  288.   say "  "Create_MSG(msg.61,Backup_dir)"  "
  289. say
  290. /*************************************************/
  291. /* Ask for verification of the input parameters.                        */
  292. /*************************************************/
  293. ask_verify:
  294. if Verified \= "" then signal got_verify
  295. call charout ,"  "MSG.16"  "
  296. parse upper linein Verified
  297. got_verify:
  298. if Verified  = "0" then             /* If the user answers NO to verification */
  299.    do                               /* then reset all of the input parameters */
  300.    Base_Drive= ""                   /* and go back to the start.              */
  301.    Update_Drive = ""
  302.    Source_Path = ""
  303.    Verified = ""
  304.    Backed = ""
  305.    "cls"
  306.    signal start
  307.    end
  308.  
  309. if Verified \= "1" then                   /* only 0 and 1 are acceptable inputs */
  310.   do
  311.   say
  312.   say "  "MSG.15"  "
  313.   Verified = ""
  314.   signal ask_verify
  315.   end
  316. say
  317. say
  318.  
  319. /***********************************************************/
  320. /*   Set up pertinent variables                            */
  321. /***********************************************************/
  322. PROD_ID_PATH = Update_Drive":\"Prod_dir
  323. do k = 1 to syslvl_prefix.0
  324. /* syslvl.k = Update_Drive":\"Prod_dir"\SYSLEVEL."Prod_id.k */
  325. syslvl.k = drive_letter":\IBMLAN\SYSLEVEL.SRV"
  326. 'dir 'syslvl.k' >> NUL 2>>&1 '
  327. if rc \= 0 then        /* skip this syslevel if not present */
  328.   do
  329.   syslvl.k = ''
  330.   iterate
  331.   end
  332.  
  333. /***********************************************************/
  334. /* Check to see that the customer has IP07001   */
  335. /* installed by reading the syslevel file.                 */
  336. /***********************************************************/
  337. firstline.k = linein(syslvl.k)   /* firstline used in later loop */
  338. /***********************************************************/
  339. /* Close the syslevel file so that it can be updated       */
  340. /***********************************************************/
  341. RC = stream(syslvl.k,'c','close')
  342.  
  343. /************************************************************/
  344. /* CSD_LEVEL will contain the current level of service      */
  345. /************************************************************/
  346. csd_level = substr(firstline.k,48,4)
  347.  
  348. /**************************************************************/
  349. /* Only allow this installation if the users current CSD      */
  350. /* level is IP07001 ( LS 3.0 )  */
  351. /**************************************************************/
  352. if csd_level < 7001 | csd_level > 7005 then
  353. do
  354.         say
  355.         say  "  "MSG.17
  356.         say  "  "create_msg(msg.18,msg.86)
  357.         say  "  "MSG.19
  358.         say
  359.         signal End
  360. end
  361. end                   /* syslevel loop */
  362. /* put CSD header in the log file */
  363. "echo.                                                           >> "Log_file" 2>>&1"
  364. "echo " center(prod_msg,80)                                     "  >> "Log_file" 2>>&1"
  365. "echo " center(Create_MSG(MSG.01,SPak),80)                   "  >> "Log_file" 2>>&1"
  366. "echo " center(date('L') time(),80)                           "  >> "Log_file" 2>>&1"
  367. "echo.                                                           >> "Log_file" 2>>&1"
  368. "echo.                                                           >> "Log_file" 2>>&1"
  369.  
  370.  
  371. Backup:
  372. if backed = '0' then signal skip_backup
  373. /***********************************************************/
  374. /* Backup the files!                                       */
  375. /***********************************************************/
  376.    "dir "backup_dir"  > NUL 2>>&1"
  377.    if RC \= 0 then            /* if not found */
  378.       do
  379.          'MD 'backup_dir' >>NUL 2>>&1'
  380.          if rc \= 0 then
  381.           do
  382.           failed_RC = rc
  383.           signal error
  384.           end
  385.       end  /* Do RC \= 0 */
  386.  
  387.    dirname=""
  388.       do i = 1 to subdirs.0                   /* subdirs.0 = num dirs found */
  389.          dirname = dirname||'\'subdirs.i      /* skip c:\ */
  390.          'MD 'Backup_dir'\'dirname' >> NUL 2>>&1 '
  391.          end                               /* do dir loop */
  392. say
  393. say Create_msg(MSG.20,backup_dir)
  394. say
  395. "echo "    Create_msg(msg.20,backup_dir)    "  >>"log_file"  2>>&1"
  396.  
  397. SPAK_vew = update_drive':\'prod_dir'\'SPAK'.vew'
  398. "PKUNZIP2 -v "Source_Path"\"SPak".SPK  hpfs*.*  >> "SPak_vew"  "
  399. if RC \= 0 then
  400.    do
  401.    failed_RC = RC
  402.    signal error
  403.    end /* do */
  404. call find_filename spak_vew filename.
  405. file_count = RESULT
  406. rc = stream(SPak_vew,'c','close')        /* close view file */
  407. do file = 1 to file_count
  408.   "copy "Update_Drive":\"filename.file"  "Backup_dir"\"filename.file" >> NUL"
  409.   copy_rc = rc
  410.   if copy_rc = 1 then iterate                 /* new file */
  411.   if copy_rc = 0  then
  412.     do
  413.      say  create_msg(MSG.69,filename.file)
  414.     "echo "create_msg(MSG.69,filename.file)" >> "log_file" 2>>&1"
  415.     end
  416.   else do
  417.      say   create_msg(msg.70,filename.file)
  418.     "echo "create_msg(MSG.70,filename.file)" >> "log_file" 2>>&1"
  419.     failed_rc = copy_RC
  420.     signal backup_err
  421.     end  /* backup error */
  422. copy_end:
  423.   end /* do backups */
  424. skip_Backup:
  425.  
  426. /***********************************************************/
  427. /* Unzip the files!                                        */
  428. /***********************************************************/
  429. say
  430. say MSG.62
  431. say
  432. Prod_id_tmp = Update_drive":\"Prod_dir"\"SPak".tmp"
  433. /*"PKUNZIP2 -o -d "Source_Path"\"SPak".SPK "Update_Drive":\  >> "Prod_id_tmp"   "*/
  434. "PKUNZIP2 -o -d "Source_Path"\"SPak".SPK "Update_Drive":\  "Prod_dir"\*.* >> "Prod_id_tmp"   "
  435. zip_rc = RC
  436. "echo.                                       >> "Log_file" 2>>&1"
  437. "echo "create_msg(MSG.64,Update_drive":\"Prod_dir) "        >> "Log_file" 2>>&1"
  438. "copy "Log_file" + "Prod_ID_tmp"  "Log_file"  >> NUL "              /* append to log file */
  439. if RC \= 0 then
  440.   do
  441.   failed_RC = RC
  442.   signal error
  443.   end
  444. /* two places for PKUNZIP output to avoid confusion when there is */
  445. /* more than one SelectPak in the log_file                        */
  446. select
  447.    when Zip_RC = 11 then
  448.      do
  449.      say
  450.      say "  "Create_MSG(MSG.21,Prod_id_Path)" "
  451.      signal Done
  452.      end
  453.    when Zip_RC = 10 then
  454.      do
  455.      failed_RC = Zip_RC
  456.      signal error
  457.      end
  458.    when Zip_RC = 1 then
  459.       do
  460.       Lock_lines. = ""
  461.       SPak_fnd = update_drive':\'prod_dir'\'SPak'.fnd'
  462.       'find  "can''t create" 'Prod_ID_tmp' >>'SPak_fnd' '
  463.       if RC \= 0 then
  464.          do
  465.          failed_RC = RC
  466.          signal error
  467.          end
  468.       if lines(SPak_fnd) \= 0 then
  469.          do
  470.          say
  471.          say MSG.71         /* warning message */
  472.          say create_MSG(MSG.23,Log_file)
  473.          do j = 1 to 4                        /* skip 4 line header    */
  474.            trash = linein(SPak_fnd)           /* generated by find cmd */
  475.            end /* do */
  476.          j = 0
  477.          do while lines(SPak_fnd) \= 0
  478.              j = j + 1                                                /* create what SysFileSearch                  */
  479.              lock_lines.j = linein(SPak_fnd)        /* would have created                                 */
  480.              end
  481.          lock_lines.0 = j
  482.          rc = stream(SPak_fnd,'c','close')          /* close find file */
  483.          signal files_locked
  484.          end                     /* end lines \= 0 */
  485.     end                       /* end zip_rc = 1 */
  486.  
  487.    when Zip_RC = 0 then signal Done
  488.    otherwise
  489.       do
  490. /****************************************************************************/
  491. /* If there were any errors then tell the user that there were problems.    */
  492. /****************************************************************************/
  493.       say " PKUNZIP failure. Return code = " Zip_RC
  494.       say MSG.22
  495.       say Create_MSG(MSG.23,LOG_file)
  496.       say
  497.       end
  498. end  /* select */
  499.  
  500. Done:
  501.  
  502. /* The installation is now complete, inform the user and exit */
  503. say
  504. say center(Create_MSG(MSG.90,SPak),80)
  505. say
  506. "echo "create_msg(MSG.90,SPak)" >> "log_file" 2>>&1"
  507. final_rc = 0
  508. signal End
  509.  
  510. /***********************************************************/
  511. /* This routine will be called if the user uses CTRL-BREAK */
  512. /***********************************************************/
  513. HALT:
  514. say
  515. say
  516. say MSG.26
  517. say MSG.27
  518. say
  519. final_RC = '9999'
  520. signal END
  521.  
  522.  
  523. /*****************************************************************/
  524. /* This routine will be called when there is a failure when      */
  525. /* backing up the files to be replaced.                          */
  526. /*****************************************************************/
  527. Backup_err:
  528. Error:
  529. say
  530. say SPak" install cannot continue.  See "LOG_file" for more info "
  531. say "  Return Code" Failed_RC "from line "sigl
  532. say
  533. "echo "create_msg(MSG.73,SPak)" >> "log_file" 2>>&1"
  534. "echo "create_msg2(MSG.74,Failed_RC,sigl)" >> "log_file" 2>>&1"
  535. final_rc = "0804"
  536. signal END
  537.  
  538.  
  539. /*****************************************************************/
  540. /* this routine reads a redirected pkunzip view file             */
  541. /* and parses for the filename. It returns the number of         */
  542. /* filenames found in RESULT.                                    */
  543. /*****************************************************************/
  544. find_filename:
  545. parse upper arg zipfile filename.
  546. do while first \= "Length"
  547.    data = linein(zipfile)
  548.    parse var data first rest
  549. end /* do */
  550. name_token = wordpos("Name",data)
  551. data = linein(zipfile)  /* throw away dashed line */
  552. count = 1
  553. data = linein(zipfile)  /* get first data line */
  554. token1 = word(data,1)
  555. do until token1 = "------"
  556.    filename.count = word(data,name_token)
  557.    filename.count = translate(filename.count,"\","/")
  558.    count = count + 1
  559.    data = linein(zipfile)
  560.    token1 = word(data,1)
  561.    end /* do */
  562. return count - 1
  563.  
  564. /*****************************************************************/
  565. /* this routine copies locked files to the IBMLANLK subdirectory */
  566. /* and creates the locked file list for use in the file          */
  567. /* replacement after reboot                                      */
  568. /*****************************************************************/
  569. files_locked:
  570. If first_lock = "1" then
  571.    do
  572.    first_lock = "0"
  573.    /* query existence of IBMLANLK subdirectory on the update drive */
  574.    "dir "Update_drive":\IBMLANLK  > NUL 2>>&1"
  575.    if RC \= 0 then            /* if not found */
  576.       do
  577.       'MD 'Update_drive':\IBMLANLK'
  578.       if rc \= 0 then
  579.         do
  580.         say "error " RC " creating IBMLANLK subdirectory"
  581.         failed_RC = RC
  582.         signal error
  583.         end
  584.       end  /* Do RC 18 */
  585.    LanLock = Update_drive":\IBMLANLK"
  586. /*    query existence of OS2\INSTALL\LOCK subdirectory on base drive */
  587. /*   "dir "Base_drive":\OS2\INSTALL\LOCK  > NUL 2>>&1"               */
  588. /*   if RC \= 0 then                                                 */
  589. /*     do                                                            */
  590. /*     lock_path = Base_drive":\OS2\INSTALL"                         */
  591. /*     end                         end not found                     */
  592. /*   else                                                            */
  593. /*      do                                                           */
  594. /*      lock_path = Base_drive":\OS2\INSTALL\LOCK"                   */
  595. /*      end                         end not found                    */
  596.    /* query existence of SPKLOCK subdirectory on the update drive */
  597.    "dir "Update_drive":\SPKLOCK >> NUL 2>>&1"
  598.    if RC \= 0 then            /* if not found */
  599.       do
  600.       'MD 'Update_drive':\SPKLOCK'
  601.       if rc \= 0 then
  602.         do
  603.         say "error " RC " creating SPKLOCK subdirectory"
  604.         failed_RC = RC
  605.         signal error
  606.         end
  607.       end  /* Do RC 18 */
  608.     /* unzip the locked file handler to the SPKLOCK subdirectory  */
  609.     lock_path = Update_drive":\SPKLOCK"
  610.     "echo.                                       >> "Log_file" 2>>&1"
  611.     "pkunzip2 -n "Source_path"\SPKLOCK.ZIP "lock_path" >> "Log_file" 2>>&1"
  612.    end     /* end First_lock */
  613. lock_list = lock_path"\IBMLANLK.LST"
  614. EOF = x2c(1A)
  615. out_file = stream(lock_list,'c',"open write")
  616. if out_file \= "READY:" then
  617.    do
  618.    failed_RC = out_file
  619.    signal error
  620.    end
  621. write_pos = stream(lock_list,'C','seek <1')         /* set to overlay eof if present */
  622. Remove_text = "RMTREE "Update_drive":\IBMLANLK"
  623. RC = lineout(lock_list,Remove_text)
  624. "echo.   >> "Log_file" 2>>&1"
  625. "echo "create_msg(MSG.65,LanLock"\"Prod_dir)"   >> "Log_file" 2>>&1"
  626. lock_string = "can't create: "
  627. do i = 1 to Lock_lines.0
  628.    parse var Lock_lines.i junk (lock_string) Locked_filespec.i
  629.    locked_filespec.i = translate(locked_filespec.i,"\","/")
  630.    locked_file_path.i = substr(locked_filespec.i,4)   /* after drive: */
  631. /* write the locked file move stmt to update_drive:\spklock\ibmlanlk.lst */
  632.    list_text = "move "LanLock"\"locked_file_path.i" "locked_filespec.i" "
  633.    Call LINEOUT lock_list,list_text
  634.    if RESULT \= 0 then
  635.       do
  636.       failed_RC = RESULT
  637.       signal error
  638.       end
  639. /* copy the locked file replacement to the IBMLANLK directory */
  640.    "echo "Locked_file_path.i" >> "Log_file" 2>>&1 "
  641.    "pkunzip2 -o -d "Source_Path"\"SPak".SPK "LanLock" "Locked_file_path.i" >> NUL 2>>&1  "
  642.    if RC \= 0 then
  643.      do
  644.      failed_RC = RC
  645.      signal error
  646.      end
  647. end           /* end locked file loop */
  648. /* write eof and close file */
  649. call charout lock_list,eof
  650. if RESULT \= 0 then
  651.    do
  652.    failed_rc = RESULT
  653.    signal error
  654.    end
  655. out_file = stream(lock_list,'c','close')
  656. if out_file \= "READY:" then
  657.    do
  658.    failed_RC = out_file
  659.    signal error
  660.    end
  661. /* Update Config.sys with IBMLANLK.SYS and RUN IBMLANLK.EXE stmts */
  662.  
  663. /* call ecfg config.sys  */
  664.  
  665. /* if RESULT \= 0 then   */
  666. /*     do                */
  667. /*    failed_RC = RESULT */
  668. /*    signal error       */
  669. /*    end                */
  670.  
  671. Reboot_required = "FE00"
  672. final_rc = Reboot_required
  673. say
  674. say
  675. say        "DISKETTE" msg.67
  676. say
  677. say        " After reboot from diskettes, please manually accomplish  "
  678. say        " the MOVE command contained in the \SPKLOCK\IBMLANLK.LST, "
  679. say        " then erase all SPKLOCK related files. "
  680. say
  681.  
  682. "echo.                                                           >> "Log_file" 2>>&1"
  683. "echo.                                                           >> "Log_file" 2>>&1"
  684. "echo DISKETTE "msg.67" >> "log_file" 2>>&1"
  685. "echo.                                                           >> "Log_file" 2>>&1"
  686. "echo After reboot from diskettes, please manually accomplish    >> "log_file" 2>>&1"
  687. "echo the MOVE command contained in the \SPKLOCK\IBMLANLK.LST,  >> "log_file" 2>>&1"
  688. "echo then erase all SPKLOCK related files.                     >> "log_file" 2>>&1"
  689. "echo.                                                           >> "Log_file" 2>>&1"
  690. "echo.                                                           >> "Log_file" 2>>&1"
  691.  
  692. signal Done
  693.  
  694. /*****************************************************************/
  695. /* This routine will take a message and a variable and place the */
  696. /* variable in the proper position in the string.                */
  697. /*****************************************************************/
  698. Create_MSG:
  699. parse arg MESSAGE,VARIABLE
  700. PART1 = SUBSTR(MESSAGE,1,POS('%1',MESSAGE)-1)
  701. PART2 = SUBSTR(MESSAGE,POS('%1',MESSAGE)+2)
  702. RETURN PART1 || VARIABLE || PART2
  703.  
  704. /*********************************************************************/
  705. /* This routine will take a message and two variables and place the  */
  706. /* variables in their proper positions in the string.                */
  707. /*********************************************************************/
  708. Create_MSG2:
  709. parse arg MESSAGE,VARIABLE.1,VARIABLE.2
  710. percent = "%"
  711. parse var message part1 (percent) part2 (percent) part3
  712. parse var part2 part2n 2 part2t
  713. parse var part3 part3n 2 part3t
  714. RETURN PART1 || VARIABLE.part2n || PART2T || VARIABLE.part3n || PART3T
  715.  
  716. /*********************************************************************/
  717. /* Help panel                                                        */
  718. /*********************************************************************/
  719. syntax:
  720. say "                                                    "
  721. say "  "Create_MSG(MSG.28,Prod_id.1)"                    "
  722. say "                                                    "
  723. say "  "MSG.29"                                          "
  724. say "                                                    "
  725. say "      "MSG.30"                                      "
  726. say "         "Create_MSG(MSG.31,'\OS2\INSTALL')"        "
  727. say "                                                    "
  728. say "      "MSG.92"                                      "
  729. say "         "Create_MSG(MSG.31,'\'Prod_dir)"           "
  730. say "                                                    "
  731. say "      "Create_MSG(MSG.33,SPak'.SPK')"               "
  732. say "         "Create_MSG(MSG.10,SPak'.SPK')"            "
  733. say "                                                    "
  734. say "      "MSG.34"                                      "
  735. say "         "Create_MSG(MSG.35,Backup_dir)"            "
  736. say "         "MSG.72"                                   "
  737. say "         "Create_MSG(MSG.13,Backup_size)"           "
  738. say "                                                    "
  739. say "      "MSG.36"                                      "
  740. say "         "MSG.37"                                   "
  741. say "                                                    "
  742. say "                                                    "
  743. say "  "MSG.38"                                          "
  744. say "      "Prod_id.1" /S:C:\service\"SPak" /T:c /B:c /K:c:\"prod_dir"\bak /V:1"
  745. say "  "MSG.68"                                          "
  746. say "  "MSG.39"                                          "
  747. say "                                                    "
  748. say "                                                    "
  749. signal END
  750.  
  751. END:
  752. 'erase 'Prod_id_tmp' >>NUL 2>>&1'
  753. 'erase 'SPak_vew' >>NUL 2>>&1'
  754. 'erase 'SPak_fnd' >>NUL 2>>&1'
  755. EXIT x2d(final_rc)
  756.  
  757.  
  758.  
  759.