home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / new / disk / salv / disksalv2 / install < prev    next >
Text File  |  1994-04-12  |  14KB  |  377 lines

  1. ;======================================================================
  2. ;
  3. ; DiskSalv general installer -- $VER: Install 11.5 (11.4.94)
  4. ;
  5. ; 11.5    Added updates for DiskSalv V11.30 distribution, mainly support
  6. ;    for the additional locale files.
  7. ; 11.4    Simple updates for DiskSalv V11.28
  8. ;    Fixed the install-locale-from-archive routine
  9. ; 11.3    Added better checks for the existance of the locales archive
  10. ;
  11. ;======================================================================
  12. ;
  13. ; Some basic strings
  14.  
  15. (set #disksalv-install 
  16.      (cat "\nInstall DiskSalv\n"
  17.           "\nYou may install the DiskSalv program and related "
  18.           "files in the directory of your choice.  Proceed?"))
  19.  
  20. (set #disksalv-install-help
  21.      (cat "\nThis section lets you choose in which drawer or on "
  22.           "which disk the DiskSalv program will be installed."
  23.           "\n\nIf you choose to proceed, you will be asked where you "
  24.           "want the DiskSalv files placed.  If you choose "
  25.           "to skip this part, you will go to the portion of the "
  26.           "installation that processes language installations".))
  27.  
  28. (set #which-disk
  29.      "In which disk or drawer should DiskSalv be installed?")
  30.  
  31. (set #any-locale
  32.      (cat "\nInstall DiskSalv Localizations\n"
  33.           "\nYou may install the DiskSalv locale files for various "
  34.           "languages in the LOCALE: directory.  Proceed?"))
  35.  
  36. (set #any-locale-help
  37.      (cat "\nDiskSalv can be operated in different languages."
  38.           "\n\nIf you choose to proceed, you will be asked to "
  39.           "select the translations you want available on your"
  40.       "system."))
  41.  
  42. (set #which-language "\nWhich catalogs should be installed?")
  43.  
  44. (set #which-language-help
  45.      (cat "\nDiskSalv can be operated in many different "
  46.          "languages. One file will be copied to your "
  47.          "hard drive for each language supported.\n\n"
  48.          "To reduce the amount of space consumed by the "
  49.          "language files, you can select only the "
  50.          "files of specific languages to be copied.\n\n"
  51.          "Check the boxes of the languages you wish "
  52.          "to have available on your system.\n\n"
  53.          @askoptions-help))
  54.  
  55. (set #docs-install
  56.      (cat "\nInstall DiskSalv Documentation\n"
  57.           "\nA small manual for DiskSalv can be installed in the"
  58.           "\ndirectory of your choice.  Proceed?"))
  59.  
  60. (set #which-docs "\nWhich manuals should be installed?")
  61.  
  62. (set #docs-install-help
  63.      (cat "\nThis section lets you choose in which drawer or on "
  64.           "which disk the DiskSalv documentation will be installed."
  65.           "\n\nIf you choose to proceed, you will be asked where you "
  66.           "want the DiskSalv documents placed.  If you choose "
  67.           "to skip this part, installation is complete."))
  68.  
  69. (set #docs-where
  70.      (cat "\nIn which disk or drawer should DiskSalv documentation "
  71.           "be installed?"))
  72.  
  73. (set #system-catalog "locale:catalogs"
  74.      #subdir-catalog "locale/catalogs"
  75.      #subdir-docs    "locale/docs"
  76.      #dscatname      "DiskSalv.catalog"
  77.      #dsdocname      "DiskSalv.doc"
  78.      #tmp-dir        "T:DiskSalv")
  79.  
  80. (set #get-dearchiver
  81.      (cat "\nPlease specify the file name of a de-archiver "
  82.           "program for \"LHA\"-type files."))
  83.  
  84. ;======================================================================
  85. ;
  86. ; This function asks about the language, and sets the global "lang" to
  87. ; the language bit mask returned by the request.
  88. ;
  89.  
  90. (procedure ASKLANGUAGE
  91.    (if (= askmode 0)
  92.        ((set lang (askoptions (prompt #which-language)
  93.                               (help #which-language-help)
  94.                               (choices "dansk"
  95.                                        "deutsch"
  96.                                        "english"
  97.                        "español"
  98.                                        "français"
  99.                                        "italiano"
  100.                                        "norsk"
  101.                                        "suomi"
  102.                                        "svenska")))
  103.          (if (IN lang 2) (set doclang 1))
  104.          (if (IN lang 7) (set doclang (+ doclang 2))))
  105.      (if (= doclang 0)
  106.          ((set doclang (askoptions (prompt #which-docs)
  107.                        (help #which-language-help)
  108.                                    (choices "english" 
  109.                             "español"
  110.                                             "français"
  111.                                             "svenska")))))))
  112.  
  113. ;======================================================================
  114. ;
  115. ; This function finds a de-archiver in the user's system, resulting to
  116. ; a panic "ask-the-user" if none can be found.
  117. ;
  118.  
  119. (procedure FINDARCPROG
  120.    (set n 0)
  121.    (while (set test (select n "lz"
  122.                               "lha"
  123.                               ""))
  124.       (if (not (run (cat "which " test)))
  125.           (set arcprog test))
  126.       (set n (+ n 1)))
  127.  
  128.    (if (= arcprog "")
  129.        (set arcprog (askfile (prompt #get-dearchiver)
  130.                              (help @askfile-help)
  131.                              (default "C:"))))
  132. )
  133.  
  134. ;======================================================================
  135. ;
  136. ; This function gets the locale file information.  We mark the occasion
  137. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  138. ; for the availability of the archive file. 
  139. ;
  140.  
  141. (procedure ANYLOCALE
  142.    (set localecode 0)
  143.    (if (exists locale-catalogs)
  144.        (set localecode 1))
  145.    (if (exists locale-archive)
  146.        (set localecode (+ localecode 2)))
  147.    localecode)
  148.  
  149. ;======================================================================
  150. ;
  151. ; This function transfers a locale file from the appropriate archive
  152. ; entry to the proper LOCALE:Catalogs subdirectory.
  153. ;
  154.  
  155. (procedure DOCATARCS
  156.    (if (= arcprog "") (FINDARCPROG))
  157.    (if (<> arcprog "")
  158.        ((working "\nDe-archiving selected catalogs\n")
  159.     (makedir #tmp-dir)
  160.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  161.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  162.                             arcsfiles))
  163.         (set script (tackon #tmp-dir "de-archive-script"))
  164.         (textfile (dest script)
  165.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  166.  
  167.         (execute script)
  168.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  169.                    (dest   #system-catalog)
  170.                    (pattern "#?"))
  171.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  172.  
  173. ;======================================================================
  174. ;
  175. ; This function transfers the locale files from the appropriate 
  176. ; existing subdirectories (in "sublst")  to the corresponding
  177. ; LOCALE:Catalogs subdirectories.
  178. ;
  179.  
  180. (procedure DOCATSUBS
  181.    (copyfiles (source locale-catalogs)
  182.               (dest   #system-catalog)
  183.               (pattern (cat "(" sublst ")"))))
  184.  
  185. ;======================================================================
  186. ;
  187. ; This function merges the new and old locale files if they both exist.
  188. ;
  189.  
  190. (procedure MERGELOCALES
  191.    (if (not (exists locale-archive))
  192.        (set locale-archive locale-update)
  193.        (if (exists locale-update)
  194.            ((if (= arcprog "") (FINDARCPROG))
  195.             (if (<> arcprog "")
  196.                 ((working "\nUpdating Locale Archives...\n")
  197.                  (makedir #tmp-dir)
  198.                  (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-update))
  199.                  (set rearc-com (cat arcprog " >NIL: <NIL: u " locale-archive
  200.                                              " locale/#?"))
  201.                  (set script (tackon #tmp-dir "re-archive-script"))
  202.                  (textfile (dest script)
  203.                             (append (cat "cd " #tmp-dir "\n" dearc-com "\n" rearc-com "\n")))
  204.                  (execute script)
  205. ;                 (run (cat "Delete >NIL: <NIL: " #tmp-dir " all"))
  206. ))))))
  207.  
  208. ;======================================================================
  209. ;
  210. ; This function selects the language to be installed.
  211. ;
  212.  
  213. (procedure DOLOCALE
  214.    (if (not (exists #system-catalog))
  215.        (makedir #system-catalog))
  216.    (set n      0
  217.         sublst ""
  218.         arclst "")
  219.    (while (set language (select n "dansk"
  220.                                   "deutsch"
  221.                                   "english"
  222.