home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 55 / af055sub.adf / dksal2.lha / DiskSalv2 / MakeBoot < prev    next >
Text File  |  1993-10-22  |  12KB  |  322 lines

  1. ;======================================================================
  2. ;
  3. ; DiskSalv boot disk generator -- $VER: MakeBoot 11.4 (12.8.93)
  4. ;
  5. ; 11.4    Added additional libraries for copy.
  6. ;    Now copies "Devs:system-configuration" for better preferences
  7. ;       support.
  8. ;    Better checks in place for existance of locale archives.
  9. ; 11.3    Bugs fixed in library copy pattern.
  10. ;
  11. ;======================================================================
  12. ;
  13. ; Some basic strings
  14.  
  15. (set #disksalv-install 
  16.      (cat "\nDiskSalv Boot Disk Generator\n"
  17.           "\nThis utility will format a floppy disk and install DiskSalv"
  18.           " and its support files based on your hard disk setup.  The"
  19.           " result is a bootable floppy with DiskSalv on it.  Proceed?"))
  20.  
  21. (set #disksalv-install-help
  22.      (cat "\nIn the case of a severe hard disk failure, DiskSalv isn't"
  23.           " going to be real useful on your hard disk.  This utility"
  24.           " builds a bootable floppy that may be used in such cases to"
  25.           " streamline such repair activity." ))
  26.  
  27. (set #which-disk
  28.      "In which floppy disk drive should DiskSalv be installed?")
  29.  
  30. (set #any-locale
  31.      (cat "\nInstall DiskSalv Localizations\n"
  32.           "\nYou may install the DiskSalv locale files for various"
  33.           " languages in the Locale directory.  Proceed?"))
  34.  
  35. (set #any-locale-help
  36.      (cat "\nDiskSalv can be operated in different languages."
  37.           "\n\nIf you choose to proceed, you will be asked to"
  38.           " select the translations you want available on your"
  39.       " system."))
  40.  
  41. (set #which-language "\nWhich catalogs should be installed?")
  42.  
  43. (set #which-language-help
  44.      (cat "\nDiskSalv can be operated in many different"
  45.           " languages. One file will be copied to your "
  46.           " hard drive for each language supported.\n\n"
  47.           "To reduce the amount of space consumed by the"
  48.           " language files, you can select only the"
  49.           " files of specific languages to be copied.\n\n"
  50.           "Check the boxes of the languages you wish to"
  51.       " have available on your system.\n\n"
  52.          @askoptions-help))
  53.  
  54. (set #subdir-catalog "locale/catalogs"
  55.      #outdisk-name   "DiskSalv Boot"
  56.      #dscatname      "DiskSalv.catalog"
  57.      #tmp-dir        "T:DiskSalv")
  58.  
  59. (set #get-dearchiver
  60.      (cat "\nPlease specify the file name of a de-archiver "
  61.           "program for \"LHA\"-type files."))
  62.  
  63. (set #ds-done
  64.      (cat "\nDiskSalv boot disk construction is complete.\n"
  65.           "\nPlease be aware that, while every effort has been made"
  66.           " to support your particular setup, it is possible that"
  67.           " some files you need for a simple bootup have not been"
  68.           " copied to the boot disk.  Please try this disk out now,"
  69.           " rather than waiting until you actually need it."))
  70.  
  71. ;======================================================================
  72. ;
  73. ; This function does the actual formatting of the given "outputdisk".
  74. ;
  75.  
  76. (procedure FORMATDISK
  77.     (if (askbool (prompt (cat "Please insert a floppy disk to be formatted "
  78.                               "in drive " outputdisk))
  79.                      (choices "Ok" "Cancel")
  80.                      (help "\nPlease select the floppy disk unit for the installation.\n")
  81.                      (default 1))
  82.         ((working "Formatting disk " outputdisk " as \"" #outdisk-name "\"")
  83.          (run (cat "SYS:System/Format <NIL: >\"CON:10/10/500/50/Formatting...\" DRIVE " 
  84.                    outputdisk " NAME \"" #outdisk-name "\" NOICONS"))
  85.          (run (cat "C:Install DRIVE " outputdisk)))
  86.         (exit "Operation cancelled")))
  87.  
  88. ;======================================================================
  89. ;
  90. ; This function makes all the important directories for the DiskSalv
  91. ; boot disk.
  92. ;
  93.  
  94. (procedure MAKESYS
  95.    (working "Creating System Directories")
  96.    (copyfiles (source  "C:")
  97.               (dest    (tackon outputdisk "C"))
  98.               (pattern (cat "(AddBuffers|AddDataTypes|Assign|BindDrivers|"
  99.                             "ConClip|Copy|Delete|Dir|Execute|IPrefs|List|"
  100.                             "LoadWB|MagTape|MakeDir|Mount|SetClock|"
  101.                             "SetPatch|Version|Wait)")))
  102.    (makedir (tackon outputdisk "Classes"))
  103.    (makedir (tackon outputdisk "Devs"))
  104.    (makedir (tackon outputdisk "Devs/DataTypes"))
  105.    (makedir (tackon outputdisk "Devs/Printers"))
  106.    (copyfiles (source  "Devs:DOSDrivers")
  107.               (dest    (tackon outputdisk "Devs/DOSDrivers"))
  108.               (pattern "#?"))
  109.    (copyfiles (source  "Devs:Keymaps")
  110.               (dest    (tackon outputdisk "Devs/Keymaps"))
  111.               (pattern "#?"))
  112.    (copyfiles (source  "Devs:Monitors")
  113.               (dest    (tackon outputdisk "Devs/Monitors"))
  114.               (pattern "((Dbl|%)(PAL|NTSC)|MultiScan|VGAOnly)")
  115.               (infos))
  116.    (copyfiles (source  "Devs:")
  117.               (dest    (tackon outputdisk "Devs"))
  118.               (pattern "system-configuration"))
  119.    (copyfiles (source  "SYS:Expansion")
  120.               (dest    (tackon outputdisk "Expansion"))
  121.               (pattern "#?"))
  122.    (makedir (tackon outputdisk "Fonts"))
  123.    (copyfiles (source  "L:")
  124.               (dest    (tackon outputdisk "L"))
  125.               (pattern "#?FileSystem"))
  126.    (copyfiles (source  "Libs:")
  127.               (dest    (tackon outputdisk "Libs"))
  128.               (pattern "(68040|amigaguide|asl|diskfont|iffparse|locale|version).library"))
  129.    (makedir (tackon outputdisk "Locale"))
  130.    (makedir (tackon outputdisk "Locale/Catalogs"))
  131.    (copyfiles (source  "Locale:Countries")
  132.               (dest    (tackon outputdisk "Locale/Countries"))
  133.               (pattern "#?"))
  134.    (copyfiles (source  "Locale:Languages")
  135.               (dest    (tackon outputdisk "Locale/Languages"))
  136.               (pattern "#?"))
  137.    (makedir (tackon outputdisk "Prefs"))
  138.    (makedir (tackon outputdisk "Prefs/Env-Archive"))
  139.    (copyfiles (source  "ENVARC:Sys")
  140.               (dest    (tackon outputdisk "Prefs/Env-Archive/Sys"))
  141.               (pattern "(pointer|locale|palette|wbconfig).(ilbm|prefs)"))
  142.    (copyfiles (source  "S:")
  143.               (dest    (tackon outputdisk "S"))
  144.               (pattern "Startup-Sequence"))
  145.    (makedir (tackon outputdisk "System"))
  146.    (makedir (tackon outputdisk "T"))
  147.    (makedir (tackon outputdisk "Tools"))
  148.    (makedir (tackon outputdisk "Utilities"))
  149.    (makedir (tackon outputdisk "WBStartup"))
  150. )
  151.  
  152. ;======================================================================
  153. ;
  154. ; This function asks about the language, and sets the global "lang" to
  155. ; the language bit mask returned by the request.
  156. ;
  157.  
  158. (procedure ASKLANGUAGE
  159.     (set lang (askoptions (prompt #which-language)
  160.                           (help #which-language-help)
  161.                           (choices "dansk"
  162.                                    "deutsch"
  163.                                    "english"
  164.                                    "français"
  165.                                    "italiano"
  166.                                    "norsk"
  167.                                    "suomi"
  168.                                    "svenska")
  169.                           (default 0))))
  170.     
  171. ;======================================================================
  172. ;
  173. ; This function finds a de-archiver in the user's system, resulting to
  174. ; a panic "ask-the-user" if none can be found.
  175. ;
  176.  
  177. (procedure FINDARCPROG
  178.    (set n 0)
  179.    (while (set test (select n "lharc"
  180.                               "lha"
  181.                               "lz"
  182.                               ""))
  183.       (if (not (run (cat "which " test)))
  184.           (set arcprog test))
  185.       (set n (+ n 1)))
  186.  
  187.    (if (= arcprog "")
  188.        (set arcprog (askfile (prompt #get-dearchiver)
  189.                              (help @askfile-help)
  190.                              (default "C:"))))
  191. )
  192.  
  193. ;======================================================================
  194. ;
  195. ; This function gets the locale file information.  We mark the occasion
  196. ; with bit 0 set for the availability of the subdirectory, bit 1 set 
  197. ; for the availability of the archive file. 
  198. ;
  199.  
  200. (procedure ANYLOCALE
  201.    (set localecode 0)
  202.    (if (exists locale-catalogs)
  203.        (set localecode 1))
  204.    (if (exists locale-archive)
  205.        (set localecode (+ localecode 2)))
  206.    localecode)
  207.  
  208. ;======================================================================
  209. ;
  210. ; This function transfers a locale file from the appropriate archive
  211. ; entry to the proper LOCALE:Catalogs subdirectory.
  212. ;
  213.  
  214. (procedure DOCATARCS
  215.    (if (= arcprog "") (FINDARCPROG))
  216.    (if (<> arcprog "")
  217.        ((working "\nDe-archiving selected catalogs\n")
  218.     (makedir #tmp-dir)
  219.         (set arcsfiles (cat #subdir-catalog "/(" arclst ")/#?"))
  220.         (set dearc-com (cat arcprog " >NIL: <NIL: e " locale-archive " "
  221.                             arcsfiles))
  222.         (set script (tackon #tmp-dir "de-archive-script"))
  223.         (textfile (dest script)
  224.                   (append (cat "cd " #tmp-dir "\n" dearc-com "\n")))
  225.         (execute script)
  226.         (copyfiles (source (tackon #tmp-dir #subdir-catalog))
  227.                    (dest   output-catalog)
  228.                    (pattern "#?"))
  229.         (run (cat "Delete >NIL: <NIL: " #tmp-dir " all")))))
  230.  
  231. ;======================================================================
  232. ;
  233. ; This function transfers the locale files from the appropriate 
  234. ; existing subdirectories (in "sublst")  to the corresponding
  235. ; LOCALE:Catalogs subdirectories.
  236. ;
  237.  
  238. (procedure DOCATSUBS
  239.    (copyfiles (source locale-catalogs)
  240.               (dest   output-catalog)
  241.               (pattern (cat "(" sublst ")"))))
  242.  
  243. ;======================================================================
  244. ;
  245. ; This function selects the language to be installed.
  246. ;
  247.  
  248. (procedure DOLOCALE
  249.    (set n      0
  250.         sublst ""
  251.         arclst "")
  252.    (while (set language (select n "dansk"
  253.                                   "deutsch"
  254.                                   "english"
  255.                                   "français"
  256.                                   "italiano"
  257.                                   "norsk"
  258.                                   "suomi"
  259.                                   "svenska"
  260.                                   ""))
  261.      (if (AND (IN lang n) (<> n 2))
  262.         (if (exists (tackon locale-catalogs (tackon language #dscatname)))
  263.             (if (= sublst "") (set sublst language) (set sublst (cat sublst "|" language)))
  264.             (if (= arclst "") (set arclst language) (set arclst (cat arclst "|" language)))))
  265.      (set n (+ n 1)))
  266.    (if (AND (IN localecode 0) (<> sublst "")) (DOCATSUBS))
  267.    (if (AND (IN localecode 1) (<> arclst "")) (DOCATARCS)))
  268.  
  269. ;======================================================================
  270. ;
  271. ; This procedure asks about installation of catalogs.
  272. ;
  273.  
  274.  
  275. (procedure ASKLOCALE
  276.     (if (ANYLOCALE)
  277.         (if (askbool (prompt #any-locale)
  278.                      (help #any-locale-help)
  279.                      (choices "Yes" "Skip This Part")
  280.                      (default 1))
  281.                   
  282.             ((set askmode 0)
  283.              (ASKLANGUAGE)
  284.              (DOLOCALE)))))
  285.  
  286. ;======================================================================
  287. ;
  288. ; The main program
  289.  
  290. (set inputdir          (pathonly @icon))
  291. (set locale-archive    (tackon inputdir "DSLocale.lha")
  292.      locale-catalogs   (tackon inputdir #subdir-catalog)
  293.      arcprog           ""
  294.      @default-dest     "DF0:")
  295.  
  296. ; First, lets put the DiskSalv stuff in place on a formatted disk.
  297.  
  298. (if (askbool (prompt #disksalv-install)
  299.          (help #disksalv-install-help)
  300.              (choices "Ok" "Cancel")
  301.              (default 1))
  302.    ((set outputdisk  
  303.           (askdir (prompt  #which-disk)
  304.           (help    @askdir-help)
  305.           (default @default-dest)))
  306.      (set @default-dest outputdisk)
  307.      (FORMATDISK)
  308.      (copyfiles (source inputdir)
  309.                 (dest outputdisk)
  310.                 (pattern "DiskSalv")
  311.                 (files)
  312.                 (infos))
  313.      (tooltype  (dest (tackon outputdisk "DiskSalv"))
  314.                 (noposition))
  315.      (MAKESYS)
  316.      (set output-catalog (tackon outputdisk #subdir-catalog))
  317.      (ASKLOCALE)
  318.      (message #ds-done))
  319.     (set @default-dest ""))
  320.  
  321.  
  322.