home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d891 / disksalv2.lha / DiskSalv2 / Install < prev    next >
Text File  |  2003-07-31  |  12KB  |  324 lines

  1. ;======================================================================
  2. ;
  3. ; DiskSalv general installer -- $VER: Install 11.2 (19.7.93)
  4. ;
  5. ;======================================================================
  6. ;
  7. ; Some basic strings
  8.  
  9. (set #disksalv-install 
  10.      (cat "\nInstall DiskSalv\n"
  11.           "\nYou may install the DiskSalv program and related "
  12.           "files in the directory of your choice.  Proceed?"))
  13.  
  14. (set #disksalv-install-help
  15.      (cat "\nThis section lets you choose in which drawer or on "
  16.           "which disk the DiskSalv program will be installed."
  17.           "\n\nIf you choose to proceed, you will be asked where you "
  18.           "want the DiskSalv files placed.  If you choose "
  19.           "to skip this part, you will go to the portion of the "
  20.           "installation that processes language installations".))
  21.  
  22. (set #which-disk
  23.      "In which disk or drawer should DiskSalv be installed?")
  24.  
  25. (set #any-locale
  26.      (cat "\nInstall DiskSalv Localizations\n"
  27.           "\nYou may install the DiskSalv locale files for various "
  28.           "languages in the LOCALE: directory.  Proceed?"))
  29.  
  30. (set #any-locale-help
  31.      (cat "\nDiskSalv can be operated in different languages."
  32.           "\n\nIf you choose to proceed, you will be asked to "
  33.           "select the translations you want available on your"
  34.       "system."))
  35.  
  36. (set #which-language "\nWhich catalogs should be installed?")
  37.  
  38. (set #which-language-help
  39.      (cat "\nDiskSalv can be operated in many different "
  40.          "languages. One file will be copied to your "
  41.          "hard drive for each language supported.\n\n"
  42.          "To reduce the amount of space consumed by the "
  43.          "language files, you can select only the "
  44.          "files of specific languages to be copied.\n\n"
  45.          "Check the boxes of the languages you wish "
  46.          "to have available on your system.\n\n"
  47.          @askoptions-help))
  48.  
  49. (set #docs-install
  50.      (cat "\nInstall DiskSalv Documentation\n"
  51.           "\nA small manual for DiskSalv can be installed in the"
  52.           "\ndirectory of your choice.  Proceed?"))
  53.  
  54. (set #which-docs "\nWhich manuals should be installed?")
  55.  
  56. (set #docs-install-help
  57.      (cat "\nThis section lets you choose in which drawer or on "
  58.           "which disk the DiskSalv documentation will be installed."
  59.           "\n\nIf you choose to proceed, you will be asked where you "
  60.           "want the DiskSalv documents placed.  If you choose "
  61.           "to skip this part, installation is complete."))
  62.  
  63. (set #docs-where
  64.      (cat "\nIn which disk or drawer should DiskSalv documentation "
  65.           "be installed?"))
  66.  
  67. (set #system-catalog "locale:catalogs"
  68.      #subdir-catalog "locale/catalogs"
  69.      #subdir-docs    "locale/docs"
  70.      #dscatname      "DiskSalv.catalog"
  71.      #dsdocname      "DiskSalv.doc"
  72.      #tmp-dir        "T:DiskSalv")
  73.  
  74. (set #get-dearchiver
  75.      (cat "\nPlease specify the file name of a de-archiver "
  76.           "program for \"LHA\"-type files."))
  77.  
  78. ;======================================================================
  79. ;
  80. ; This function asks about the language, and sets the global "lang" to
  81. ; the language bit mask returned by the request.
  82. ;
  83.  
  84. (procedure ASKLANGUAGE
  85.    (if (= askmode 0)
  86.        ((set lang (askoptions (prompt #which-language)
  87.                               (help #which-language-help)
  88.                               (choices "dansk"
  89.                                        "deutsch"
  90.                                        "english"
  91.                                        "français"
  92.                                        "italiano"
  93.                                        "norsk"
  94.                                        "suomi"
  95.                                        "svenska")))
  96.          (if (IN lang 2) (set doclang 1))
  97.          (if (IN lang 7) (set doclang (+ doclang 2))))
  98.      (if (= doclang 0)
  99.          ((set doclang (askoptions (prompt #which-docs)
  100.                        (help #which-language-help)
  101.                                    (choices "english" "svenska")))))))
  102.  
  103. ;======================================================================
  104. ;
  105. ; This function finds a de-archiver in the user's system, resulting to
  106. ; a panic "ask-the-user" if none can be found.
  107. ;
  108.  
  109. (procedure FINDARCPROG
  110.    (set n 0)
  111.    (while (set test (select n "lharc"
  112.                               "lha"
  113.                               "lz"
  114.                               ""))
  115.       (if (not (run (cat "which " test)))
  116.           (set arcprog test))
  117.       (set n (+ n 1)))
  118.  
  119.    (if (= arcprog "")
  120.        (set arcprog (askfile (prompt #get-dearchiver)
  121.                              (help @askfile-help)
  122.                              (default "C:"))))
  123. )
  124.  
  125. ;======================================================================
  126. ;
  127. ; This function gets the locale file information.  We mark the occasion
  128. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  129. ; for the availability of the archive file. 
  130. ;
  131.  
  132. (procedure ANYLOCALE
  133.    (set localecode 0)
  134.    (if (exists locale-catalogs)
  135.        (set localecode 1))
  136.    (if (exists locale-archive)
  137.        (set localecode (+ localecode 2)))
  138.    localecode)
  139.  
  140. ;======================================================================
  141. ;
  142. ; This function transfers a locale file from the appropriate archive
  143. ; entry to the proper LOCALE:Catalogs subdirectory.
  144. ;
  145.  
  146. (procedure DOCATARCS
  147.    (if (= arcprog "") (FINDARCPROG))
  148.    (if (<> arcprog "")
  149.        ((working "\nDe-archiving selected catalogs\n")
  150.     (makedir #tmp-dir)
  151.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  152.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  153.                             arcsfiles))
  154.         (set script (tackon #tmp-dir "de-archive-script"))
  155.         (textfile (dest script)
  156.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  157.         (execute script)
  158.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  159.                    (dest   #system-catalog)
  160.                    (pattern "#?"))
  161.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  162.  
  163. ;======================================================================
  164. ;
  165. ; This function transfers the locale files from the appropriate 
  166. ; existing subdirectories (in "sublst")  to the corresponding
  167. ; LOCALE:Catalogs subdirectories.
  168. ;
  169.  
  170. (procedure DOCATSUBS
  171.    (copyfiles (source locale-catalogs)
  172.               (dest   #system-catalog)
  173.               (pattern (cat "(" sublst ")"))))
  174.  
  175. ;======================================================================
  176. ;
  177. ; This function selects the language to be installed.
  178. ;
  179.  
  180. (procedure DOLOCALE
  181.    (if (not (exists #system-catalog))
  182.        (makedir #system-catalog))
  183.    (set n      0
  184.         sublst ""
  185.         arclst "")
  186.    (while (set language (select n "dansk"
  187.                                   "deutsch"
  188.                                   "english"
  189.                                   "français"
  190.                                   "italiano"
  191.                                   "norsk"
  192.                                   "suomi"
  193.                                   "svenska"
  194.                                   ""))
  195.      (if (AND (IN lang n) (<> n 2))
  196.         (if (exists (tackon locale-catalogs (tackon language #dscatname)))
  197.             (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language)))
  198.             (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language)))))
  199.      (set n (+ n 1)))
  200.    (if (<> sublst "") (DOCATSUBS))
  201.    (if (<> arclst "") (DOCATARCS)))
  202.  
  203. ;======================================================================
  204. ;
  205. ; This function transfers a doc file from the appropriate archive
  206. ; entry to the selected documentation subdirectory.
  207. ;
  208.  
  209. (procedure DODOCARCS
  210.    (if (= arcprog "") (FINDARCPROG))
  211.    (if (<> arcprog "")
  212.        ((working "\nDe-archiving selected docs files\n")
  213.     (makedir #tmp-dir)
  214.         (set arcsfiles (cat "(" #subdir-docs "/(" arclst ")/#?|" 
  215.                                 #subdir-docs ".info)"))
  216.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  217.                             arcsfiles))
  218.         (set script (tackon #tmp-dir "de-archive-script"))
  219.         (textfile (dest script)
  220.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  221.         (execute script)
  222.         (copyfiles (source (tackon #tmp-dir #subdir-docs))
  223.                    (dest   docoutputdir)
  224.                    (pattern "#?"))
  225.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  226.  
  227. ;======================================================================
  228. ;
  229. ; This function transfers the docs files from the appropriate 
  230. ; existing subdirectories (in "sublst")  to the selected
  231. ; directory.
  232. ;
  233.  
  234. (procedure DODOCSUBS
  235.    (copyfiles (source locale-docs)
  236.               (dest   docoutputdir)
  237.               (pattern (cat "(" sublst ")"))))
  238.  
  239. ;======================================================================
  240. ;
  241. ; This function manages document installation.  It should automatically
  242. ; install any docs based on the requested localizations.  If none match,
  243. ; the user should be given a new choice of languages.
  244. ;
  245.  
  246. (procedure DODOCS
  247.    (set docoutputdir 
  248.         (tackon (askdir (prompt  #docs-where)
  249.                 (help    @askdir-help)
  250.                 (default @default-dest))
  251.                 "DiskSalv_Docs"))
  252.    (set n      0
  253.         sublst ""
  254.         arclst "")
  255.    (while (set language (select n "english"
  256.                                   "svenska"
  257.                                   ""))
  258.      (if (IN doclang n)
  259.         ((set testfile (tackon locale-docs (tackon language #dsdocname)))
  260.          (if (exists testfile)
  261.              (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language "|"
  262.                                                                       language ".info")))
  263.              (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language "|"
  264.                                                                       language ".info"))))))
  265.      (set n (+ n 1)))
  266.    (if (<> sublst "") (DODOCSUBS))
  267.    (if (<> arclst "") (DODOCARCS)))
  268.  
  269. ;======================================================================
  270. ;
  271. ; The main program
  272.  
  273. (set inputdir          (pathonly @icon))
  274. (set locale-archive    (tackon inputdir "DSLocale.lha")
  275.      locale-catalogs   (tackon inputdir #subdir-catalog)
  276.      locale-docs       (tackon inputdir #subdir-docs)
  277.      arcprog           ""
  278.      doclang           0
  279.      @default-dest     "SYS:Tools")
  280.  
  281. ; First, install the DiskSalv program proper
  282.  
  283. (if (askbool (prompt #disksalv-install)
  284.              (help #disksalv-install-help)
  285.              (choices "Yes" "Skip This Part")
  286.              (default 1))
  287.     ((set outputdir 
  288.           (askdir (prompt  #which-disk)
  289.           (help    @askdir-help)
  290.           (default @default-dest)))
  291.      (set @default-dest outputdir)
  292.      (copyfiles (source inputdir)
  293.                 (dest outputdir)
  294.                 (pattern "DiskSalv")
  295.                 (files)
  296.                 (infos))
  297.      (tooltype  (dest (tackon outputdir "DiskSalv"))
  298.                 (noposition)))
  299.     (set @default-dest ""))
  300.  
  301. ; Next, consider the locales.  Ask the user for a selection
  302. ; of catalogs, then call the catalog installer function. 
  303.  
  304.  
  305. (if (ANYLOCALE)
  306.     (if (askbool (prompt #any-locale)
  307.                  (help #any-locale-help)
  308.                  (choices "Yes" "Skip This Part")
  309.                  (default 1))
  310.                   
  311.         ((set askmode 0)
  312.          (ASKLANGUAGE)
  313.          (DOLOCALE))))
  314.  
  315. (if (askbool (prompt #docs-install)
  316.          (help #docs-install-help)
  317.              (choices "Yes" "Skip This Part")
  318.              (default 1))
  319.     ((set askmode 1)
  320.      (ASKLANGUAGE)
  321.      (DODOCS)))
  322.  
  323.  
  324.