home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / KFPCH25.LHA / KingFisher2 / patch / Install-KFPatch next >
Encoding:
Text File  |  1994-11-05  |  6.8 KB  |  211 lines

  1. ; Installer Patch Script for KingFisher Release 2
  2. ; Copyright © 1994 Udo Schuermann
  3. ; All rights reserved
  4. ; $VER: Install-KFPatch 2.5 (5.11.94)
  5. ;
  6. ;
  7. ; Installer and Installer project icon
  8. ; (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  9. ; Reproduced and distributed under license from Commodore.
  10. ; INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  11. ; NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  12. ; OR RESPONSIBILITY IS ASSUMED.
  13.  
  14.  
  15. ; (set VER "blah 2.7 (28.2.94)"
  16. ; returns with REV set to "2" and VER set to "7" as in "2.7" without the dot
  17. (procedure extract-version (
  18.   (set i 0 sREV "" sVER "" LOOKING 1)
  19.   (while (AND (= LOOKING 1) (< i 255)) (
  20.     (set t (substr VER i 1))
  21.     (if (<= t '9')
  22.       ((if (>= t '0')
  23.         (set LOOKING 0)
  24.         (set i (+ i 1))))
  25.       (set i (+ i 1)))
  26.   ))
  27.   (if (= LOOKING 0) (
  28.     (set sREV (substr VER i 1))
  29.     (set i (+ i 1) LOOKING 1)
  30.     (while (AND (= LOOKING 1) (< i 255)) (
  31.       (set t (substr VER i 1))
  32.       (if (<= t '9')
  33.         (if (>= t '0')
  34.           (set sREV ("%s%s" sREV t))))
  35.       (if (OR (= t '.') (= t ' '))
  36.         (set LOOKING 0))
  37.       (set i (+ i 1))
  38.     ))
  39.     (set LOOKING 1)
  40.     (while (AND (= LOOKING 1) (< i 255)) (
  41.       (set t (substr VER i 1))
  42.       (if (<= t '9')
  43.         (if (>= t '0')
  44.           (set sVER ("%s%s" sVER t))))
  45.       (if (= t ' ')
  46.         (set LOOKING 0))
  47.       (set i (+ i 1))
  48.     ))
  49.   ))
  50. ))
  51.  
  52. ; (set VSTR "blah 2.7 (28.2.94)")
  53. ; call with VSTR set to "blah 2.7 (d.m.y)..."
  54. ; presence of EVALUATION or REGISTERED will return TYPEKEY "R" or TYPEKEY "E"
  55. ; as well as TYPENAME set to the 10 character string EVALUATION or REGISTERED
  56. ; defaults to registered (if the keystrings are not found)
  57. (procedure extract-type (
  58.   (set i 0 LOOKING 1 TYPEKEY "R" TYPENAME "REGISTERED")
  59.   (while (AND (= LOOKING 1) (< i 255)) (
  60.     (set t (substr VSTR i 10))
  61.     (set i (+ i 1))
  62.     (if (= t "REGISTERED")
  63.       (set TYPEKEY "R" TYPENAME t LOOKING 0)
  64.       (if (= t "EVALUATION")
  65.         (set TYPEKEY "E" TYPENAME t LOOKING 0)))))
  66. ))
  67.  
  68. ;(set REV sREVKFS VER sVERKFS FILE "KFServer" THISONE "25" THISREV "2" THISVER "5" VSTR vKFS)
  69. ; REV and VER are the original revision and version values of FILE
  70. ; THISONE is the new version without the dot in the middle; THISREV and THISVER
  71. ; are the value of THISONE but separated, VSTR is the version string as required
  72. ; by the (extract-type) function which is called from here.
  73. (procedure patch-file (
  74.   (if (= ("%s%s" REV VER) THISONE)
  75.     (message ("You already have %s %s.%s installed!\n\nPatch skipped" FILE REV VER))
  76.     ((extract-type)
  77.      (working ("Patching %s %s version from\n\n%s.%s to 2.5" FILE TYPENAME REV VER))
  78.      (set ORIGINAL (tackon DESTIN FILE))
  79.      (set PATCH ("%s_%s-%s%s-%s.pch" TYPEKEY FILE REV VER THISONE))
  80.      (set OUTPUT (tackon DESTIN ("%s.new" FILE)))
  81.      (if (exists PATCH)
  82.        ((set CMD ("spatch \"-o%s\" \"-p%s\" \"%s\"" OUTPUT PATCH ORIGINAL))
  83.         (run CMD)
  84.         (if (exists (tackon DESTIN ("%s.new" FILE)))
  85.           ((set BACKUP (tackon DESTIN ("%s-%s.%s" FILE REV VER)))
  86.            (if (exists BACKUP)
  87.              (delete BACKUP))
  88.            (rename (tackon DESTIN FILE) BACKUP)
  89.            (rename (tackon DESTIN ("%s.new" FILE)) (tackon DESTIN FILE)))
  90.           ((set xUSER @user-level)
  91.            (user 3)
  92.            (message ("ERROR!\n\n%s could not be patched!" FILE))
  93.            (user xUSER)))
  94.        )
  95.        (message ("A patch file to upgrade the %s version of %s from %s.%s to %s.%s is not available"
  96.         TYPENAME FILE REV VER THISREV THISVER)))))
  97. ))
  98.  
  99. (complete 0)
  100.  
  101. (set LOOKING 1 FAIL 0)
  102. (while (= LOOKING 1)
  103.   (set DESTIN
  104.     (askdir
  105.       (prompt
  106.     "Please indicate the directory where KingFisher is installed. "
  107.     "This is the directory where the files are actually located.")
  108.       (help @askdir-help)
  109.       (default "SYS:KingFisher2")))
  110.   (if (exists (tackon DESTIN "KFServer"))
  111.     (if (exists (tackon DESTIN "KingFisher"))
  112.       (set LOOKING 0)))
  113.   (if (= LOOKING 1)
  114.     (message (
  115.     "The Installer cannot seem to find the KFServer and KingFisher "
  116.     "programs in the '%s' directory.  Please try again or cancel the "
  117.     "installation." DESTIN))))
  118. (complete 1)
  119.  
  120. (working "Determining which software revisions you have currently installed")
  121.  
  122. (run ("c:version >ENV:VERKFS full \"%s\"" (tackon DESTIN "KFServer")))
  123. (set VER (getenv "VERKFS"))
  124. (set vKFS VER)
  125. (extract-version)
  126. (set sREVKFS sREV sVERKFS sVER)
  127. (complete 3)
  128.  
  129. (run ("c:version >ENV:VERKF full \"%s\"" (tackon DESTIN "KingFisher")))
  130. (set VER (getenv "VERKF"))
  131. (set vKF VER)
  132. (extract-version)
  133. (set sREVKF sREV sVERKF sVER)
  134. (complete 4)
  135.  
  136. (if (exists (tackon DESTIN "RexxFisher"))
  137.   ((run ("c:version >ENV:VERRXF full \"%s\"" (tackon DESTIN "RexxFisher")))
  138.    (set VER (getenv "VERRXF"))
  139.    (set vRXF VER)
  140.    (extract-version)
  141.    (set sREVRXF sREV sVERRXF sVER))
  142.   (set sREVRXF "" sVERRXF ""))
  143. (complete 5)
  144.  
  145. (set REV sREVKFS VER sVERKFS FILE "KFServer" THISONE "25" THISREV "2" THISVER "5" VSTR vKFS)
  146. (patch-file)
  147. (complete 25)
  148.  
  149. (set REV sREVKF VER sVERKF FILE "KingFisher" THISONE "25" THISREV "2" THISVER "5" VSTR vKF)
  150. (patch-file)
  151. (complete 70)
  152.  
  153. ;(if (<> sREVRXF "")
  154. ;  ((set REV sREVRXF VER sVERRXF FILE "RexxFisher" THISONE "17" THISREV "1" THISVER "7" VSTR vRXF)
  155. ;   (patch-file)))
  156. (complete 90)
  157.  
  158. (delete "ENV:VERKFS")
  159. (delete "ENV:VERKF")
  160. (delete "ENV:VERRXF")
  161.  
  162. ; update all installed catalogs (if any)
  163. (if (exists (tackon DESTIN "Catalogs"))
  164.   (foreach (tackon DESTIN "Catalogs") "#?" (
  165.     (if (exists ("Catalogs/%s" @each-name))
  166.       ((working ("Installing %s Language" @each-name))
  167.        (copyfiles
  168.       (source (tackon "Catalogs" @each-name))
  169.       (dest (tackon DESTIN ("Catalogs/%s" @each-name)))
  170.       (all)))
  171.       (message ("No new %s catalog available" @each-name))))))
  172. (complete 99)
  173.  
  174. (if (exists "KingFisher2.guide")
  175.   ((if (= @user-level 0) (user 1))
  176.    (if (askbool
  177.          (prompt
  178.        "Would you like to upgrade to a new online English "
  179.        "language documentation file?\n\nIf you have a translated "
  180.        "version of this file installed, you should first make a "
  181.        "backup copy before proceeding!")
  182.          (choices "Yes, proceed" "No, skip it")
  183.          (default "No, skip it")
  184.          (help @askbool-help))
  185.      (copyfiles
  186.        (source "KingFisher2.guide")
  187.        (dest DESTIN))
  188.      (if (<= (/ (getversion "dos.library" (resident)) 65536) 38)
  189.        ((working "\nWord-wrapping KingFisher2.guide\nfor use with AmigaGuide V34")
  190.         (run ("WrapGuide %s 65" (tackon DESTIN "KingFisher2.guide")))))))
  191.   (message "No new KingFisher2.guide available")
  192. )
  193.  
  194. (if (exists "RexxFisher")
  195.   ((if (= @user-level 0) (user 1))
  196.    (if (askbool
  197.          (prompt
  198.        "Would you like to install RexxFisher 1.7?")
  199.          (choices "Yes, proceed" "No, skip it")
  200.          (default "No, skip it")
  201.          (help @askbool-help))
  202.      (copyfiles
  203.        (source "RexxFisher")
  204.        (dest DESTIN))))
  205.   (message "No new RexxFisher available")
  206. )
  207.  
  208. (complete 100)
  209. (exit)
  210.