home *** CD-ROM | disk | FTP | other *** search
/ Eric Schwartz Productions CD Archive / EricSchwartzProductionsArchive.iso / install < prev    next >
Text File  |  1995-10-26  |  22KB  |  645 lines

  1. ; Installer program for ES_Archives CD.
  2. ; Written by Fred Fish, Amiga Library Services.
  3. ; This script is public domain.     Use it for any purpose you wish.
  4. ; German translation by Daniel Amor.
  5. ; Italian translation by Rudi Chiarito.
  6.  
  7. ; Select the user's desired language to use during installation.
  8. ;
  9. ; This is also where all the language dependent strings get defined.
  10. ; To install support for a new language, just add the appropriate
  11. ; language selection and install the strings for that language.
  12.  
  13. (procedure SelectLanguage
  14.     (if (patmatch @language "English") (set lang 0))
  15.     (if (patmatch @language "Deutsch") (set lang 1))
  16.     (if (patmatch @language "Italiano") (set lang 2))
  17.     (set langval
  18.         (askchoice
  19.             (prompt    (cat    "Select your native language.\n"
  20.                     "Bitte waehlen Sie die Sprache aus.\n"
  21.                     "Scegli la tua lingua.\n"))
  22.             (help (cat    "You can choose a language for prompts and help."
  23.                     "\n\n"
  24.                     "Sie koennen eine Sprache für die Anweisungen und die Hilfe auswaehlen."
  25.                     "\n\n"
  26.                     "Scegli la lingua da usare per i messaggi di richiesta e d'aiuto"
  27.                     "\n\n")) 
  28.             (choices
  29.                 "English"
  30.                 "Deutsch"
  31.                 "Italiano"
  32.             )
  33.             (default lang)
  34.         )
  35.     
  36.     )
  37.  
  38.     (set @language
  39.         (select langval
  40.             ("English")
  41.             ("Deutsch")
  42.             ("Italiano")))
  43.     
  44.     (set yes
  45.         (select langval
  46.             ("Yes")
  47.             ("Ja")
  48.             ("Sì")))
  49.  
  50.     (set no
  51.         (select langval
  52.             ("No")
  53.             ("Nein")
  54.             ("No")))
  55.  
  56.     (set msg_hello
  57.         (select langval
  58.             (cat    "Before using this CD you should run this installer script. "
  59.                 "It will make no permanent changes to your system without asking "
  60.                 "you first.  If you do not agree to the change, a simple reboot "
  61.                 "will always restore your system to the state it was in prior "
  62.                 "to running this install script."
  63.                 "\n\n"
  64.                 "Most requesters have help available via the Help gadget or Help key.")
  65.             (cat    "Vor der Benutzung dieser CD-ROM, sollten Sie dieses "
  66.                 "Skript laufen lassen. Es wird keine Veränderungen "
  67.                 "an ihrem, ohne ihre ausdrückliche Genehmigung vornehmen. "
  68.                 "Es nimmt keine permanenten Veraenderungen vor, so dass ein "
  69.                 "einfach Reboot die Einstellungen wieder rückgängig macht."
  70.                 "\n\n"
  71.                 "Viele Requester haben eine Hilfe-Funktion, die über das Hilfe-Symbol "
  72.                 "oder die Help-Taste aktiviert werden können!")
  73.             (cat    "Prima di usare questo CD dovresti lanciare il programma di installazione. "
  74.                 "Esso non modificherà in modo permanente la configurazione del sistema senza "
  75.                 "chiederlo prima. Se le impostazioni non sono di tuo gradimento, "
  76.                 "riavviando la macchina, il sistema ritornerà nello stato precedente "
  77.                 "all'avvio di questo programma."
  78.                 "\n\n"
  79.                 "La maggior parte delle schermate dispone di un aiuto in linea, "
  80.                 "disponibile selezionando col mouse il pulsante Aiuto o premendo "
  81.                 "Help sulla tastiera.")))
  82.  
  83.     (set ask_select_metatoolprefs
  84.         (select langval
  85.             (cat    "Select a MetaTool preferences file from which to read default settings. "
  86.                 "This file will also be where the new preferences are written if "
  87.                 "you agree later to having them preserved.")
  88.             (cat    "Wählen Sie die MetaTool Einstellungsdatei aus, von der die Einstellungen "
  89.                 "gelesen werden sollen. In diese Datei werden später auch die neuen "
  90.                 "Einstellungen gespeichert, falls Sie das wünschen.")
  91.             (cat    "Scegli un file di preferenze per MetaTool dal quale leggere la configurazione "
  92.                 "predefinita. In questo file verranno memorizzate anche le future impostazioni.")))
  93.  
  94.     (set help_select_metatoolprefs
  95.         (select langval
  96.             (cat    "Please select a file for your MetaTool preferences."
  97.                 "\n\n"
  98.                 "If the file exists, default preferences will be extracted "
  99.                 "from it and you will have the opportunity later to change them."
  100.                 "\n\n"
  101.                 "The file you select will be rebuilt, or created if it does "
  102.                 "not currently exist, using default preferences or preferences "
  103.                 "that you specify later.")
  104.             (cat    "Bitte wählen Sie eine Datei für ihre MetaTool Voreinstellungen aus."
  105.                 "\n\n"
  106.                 "Falls die Datei bereits existiert, werden die Voreinstellungen ausgelesen "
  107.                 "und Sie werden später die Moeglichkeit haben, diese zu ändern."
  108.                 "\n\n"
  109.                 "Diese Datei wird erzeugt, falls sie noch nicht existiert, und es werden "
  110.                 "entweder die voreingestellten Werte oder die von Ihnen eingetragenen Werte "
  111.                 "gespeichert.")
  112.             (cat    "Scegli un file per le preferenze di MetaTool."
  113.                 "\n\n"
  114.                 "Se il file esiste, verranno estratte da esso le impostazioni "
  115.                 "predefinite e in seguito avrai la possibilità di cambiarle."
  116.                 "\n\n"
  117.                 "Il file scelto verrà ricostruito, o creato se non esiste, "
  118.                 "usando le preferenze predefinite o quelle che indicherai in seguito.")))
  119.  
  120.     (set ask_update_metatoolprefs
  121.         (select langval
  122.             (cat    "Do you wish to make changes to your MetaTool preferences "
  123.                 "permanent by updating your preferences file?")
  124.             (cat    "Möchten Sie die Änderungen in ihren MetaTool Einstellungen "
  125.                 "permanent machen, in dem Sie die Datei updaten?")
  126.             (cat    "Vuoi modificare in maniera permanente il tuo file di "
  127.                 "preferenze di MetaTool aggiornandolo?")))
  128.  
  129.     (set help_update_metatoolprefs
  130.         (select langval
  131.             (cat    "If you select Yes, the new preferences will be copied to your "
  132.                 "selected preferences file and "
  133.                 "ENV:METACONFIG and ENVARC:METACONFIG will be updated "
  134.                 "accordingly so that the next time you reboot you will "
  135.                 "still get the new preferences file."
  136.                 "\n\n"
  137.                 "If you select No, MetaTool will use the preferences file "
  138.                 ramprefs
  139.                 " and will set ENV:METACONFIG to point to that file. "
  140.                 "The first time you reboot, everything will be as it was before.")
  141.             (cat    "Wenn Sie Ja auswählen, dann werden die neuen Einstellungen in Ihre "
  142.                 "ausgewählte Datei geschrieben und ENV:METACONFIG und ENVARC:METACONFIG "
  143.                 "werden geupdatet, so dass Sie beim nächsten Start die neuen Einstellungen "
  144.                 "zur Verfügung haben."
  145.                 "\n\n"
  146.                 "Wenn Sie Nein wählen, wird MetaTool die Voreinstellungs-Datei ramprefs "
  147.                 "benutzen und ENV:METACONFIG auf diese Datei ansetzen. "
  148.                 "Nach einem Reboot wird alles wieder so sein, wie es davor war.")
  149.             (cat    "Se selezioni Sì, le nuove preferenze verranno copiate nel file "
  150.                 "che hai scelto e "
  151.                 "ENV:METACONFIG ed ENVARC:METACONFIG verranno aggiornate "
  152.                 "appropriatamente così che al prossimo avvio della macchina "
  153.                 "verrà usato il nuovo file di preferenze."
  154.                 "\n\n"
  155.                 "Se selezioni No, MetaTool userà il file "
  156.                 ramprefs
  157.                 " e farà puntare ENV:METACONFIG ad esso. "
  158.                 "Riavviando il sistema, tutto sarà nello stato in cui era prima.")))
  159.  
  160.     (set ask_cli_or_workbench
  161.         (select langval
  162.             (cat    "Run a CLI or WorkBench command for file type")
  163.             (cat    "Starten Sie eine CLI oder Workbench-Befehl für die Dateiart")
  164.             (cat    "Comando CLI o programma WB da eseguire per il tipo di dati")))
  165.  
  166.     (set help_cli_or_workbench
  167.         (select langval
  168.             (cat    "MetaTool looks at a file type (such as \"GUIDE\") given either in a tooltype "
  169.                 "or as a command line option, and then runs a program appropriate for that "
  170.                 "file type.  The program that is run can be either a CLI or WorkBench command."
  171.                 "\n\n"
  172.                 "If you select CLI, you will be prompted for the CLI command line to run. "
  173.                 "If you select WorkBench, a requester will let you select a command to run.")
  174.             (cat    "MetaTool sucht nach der Dateiart (wie z.B. \"GUIDE\"), der entweder im Tooltype "
  175.                 "oder der Befehlszeile steht und startet das entsprechende Programm für diese "
  176.                 "Dateiart. Das Programm kann entweder ein CLI oder Workbench Befehl sein."
  177.                 "\n\n"
  178.                 "Wenn Sie CLI wählen, müssen Sie die CLI Befehlszeile eingeben. "
  179.                 "Wenn Sie Workbench wählen, können Sie über einen Requester das Programm auswählen.")
  180.             (cat    "MetaTool a seconda del tipo di file (es. \"GUIDE\") richiestogli dai parametri di una icona "
  181.                 "o da una opzione di riga comandi, lancia un programma appropriato. "
  182.                 " Si può specificare sia un comando CLI che un programma WorkBench."
  183.                 "\n\n"
  184.                 "Se scegli CLI, verrà chiesta la riga comandi CLI da eseguire. "
  185.                 "Se scegli WorkBench, verrà chiesto il programma da lanciare.")))
  186.  
  187.     (set ask_specify_Workbench_command
  188.         (select langval
  189.             (cat    "Select Workbench command to run for file type")
  190.             (cat    "Wählen Sie Workbench Befehl für Dateityp aus")
  191.             (cat    "Scegli il comando Workbench da eseguire per il tipo di dati")))
  192.  
  193.     (set help_specify_Workbench_command
  194.         (select langval
  195.             (cat    "You can either accept the default command to run, or select/enter "
  196.                 "another command to be run.")
  197.             (cat    "Sie können entweder den voreigestellten Befehl annehmen, oder einen "
  198.                 "anderen Befehl auswählen/eingeben.")
  199.             (cat    "Puoi sia accettare il programma preimpostato o scegliere/inserire "
  200.                 "un altro da lanciare.")))
  201.  
  202.     (set ask_specify_CLI_command
  203.         (select langval
  204.             (cat    "Enter a CLI command line to run for file type")
  205.             (cat    "Geben Sie eine CLI Befehlszeile für diese Dateiart ein")
  206.             (cat    "Introduci la riga comandi da eseguire per il tipo di dati")))
  207.  
  208.     (set ask_specify_CLI_command_help
  209.         (select langval
  210.             (cat    "\n\nSelect Help for more information.")
  211.             (cat    "\n\nWählen Sie Hilfe für mehr Informationen.")
  212.             (cat    "\n\nSeleziona Aiuto per maggiori informazioni.")))
  213.  
  214.     (set help_specify_CLI_command
  215.         (select langval
  216.             (cat    "Enter a CLI command to run, including any \"Execute\" if necessary. "
  217.                 "Place a pair of square brackets (\"[]\") at the location in the "
  218.                 "command line where the filename argument is to be inserted."
  219.                 "\n\n"
  220.                 "Example: \"Execute work:Players/PlayTunes []\"")
  221.             (cat    "Geben Sie einen CLI Befehl ein, inklusive \"Execute\" falls nötig. "
  222.                 "Setzen Sie ein paar eckige Klammern (\"[]\") an die Stelle in der "
  223.                 "Befehlszeile, wo der Dateiname stehen soll."
  224.                 "\n\n"
  225.                 "Beispiel: \"Execute work:Players/PlayTunes []\"")
  226.             (cat    "Inserisci un comando CLI da eseguire, compreso un eventuale "
  227.                 "\"Execute\" se necessario. "
  228.                 "Inserisci una coppia di parentesi quadre (\"[]\") nella posizione "
  229.                 "della riga comandi in cui va copiato il nome del file."
  230.                 "\n\n"
  231.                 "Esempio: \"Execute work:Players/PlayTunes []\"")))
  232. )
  233.  
  234. ; First set up defaults that we may need.  We need to do this even if
  235. ; there is already an existing MetaTool prefs file, since some of these
  236. ; might not be in the file already.
  237. ;
  238. ; Note that for defaults, we assume that the paths are relative.  This
  239. ; allows us to avoid putting volume name references for our CD into the
  240. ; commands, which is nasty because if someone runs this script again
  241. ; later with another CD, those volume references will cause a requester
  242. ; to insert the volume.  This was first noticed when users ran the dacapo
  243. ; install script after having run the Meeting Pearls install script which
  244. ; generates a metatool.prefs file with absolute pathnames.
  245.  
  246. (procedure SetMetaToolDefaults
  247.  
  248.     ; Put default metatypes here, that apply to any version of the OS.
  249.  
  250.     (if (= 1 debugflag) (debug "set default METATYPES"))
  251.  
  252.     (set ANIM_METATYPE    ":Tools/C/VT")
  253.     (set BMP_METATYPE    ":Tools/C/FastView")
  254.     (set MOVIE_METATYPE    ":Tools/C/MoviePlayer")
  255.     (set JPEG_METATYPE    ":Tools/C/VT")
  256.  
  257.     ; Check for OS versions prior to KickStart/Workbench 2.04 Release.
  258.  
  259.     (if (<= osver 36)
  260.         (
  261.             (if (= 1 debugflag) (debug "found Kickstart 2.0 prerelease or earlier"))
  262.  
  263.             (set GIF_METATYPE    ":Tools/C/FastView")
  264.             (set GUIDE_METATYPE    ":Tools/C/More")
  265.             (set ILBM_METATYPE    ":Tools/C/FastView")
  266.             (set TEXT_METATYPE    ":Tools/C/More")
  267.             
  268.         )
  269.     )
  270.     (if (AND (> osver 36) (< osver 39))
  271.         (
  272.             (if (= 1 debugflag) (debug "found Kickstart 2.04 to 2.1"))
  273.  
  274.             (set GIF_METATYPE    ":Tools/C/FastView")
  275.             (set GUIDE_METATYPE    ":Tools/C/AmigaGuide")
  276.             (set ILBM_METATYPE    ":Tools/C/FastView")
  277.             (set TEXT_METATYPE    ":Tools/C/Muchmore")
  278.         )
  279.     )
  280.     (if (>= osver 39)
  281.         (
  282.             (if (= 1 debugflag) (debug "found Kickstart 3.0 or later"))
  283.  
  284.             (set GIF_METATYPE    ":Tools/C/VT")
  285.             (set GUIDE_METATYPE    "SYS:Utilities/MultiView")
  286.             (set ILBM_METATYPE    ":Tools/C/VT")
  287.             (set TEXT_METATYPE    "SYS:Utilities/MultiView")
  288.         )
  289.     )
  290.     (if (= 1 debugflag) (debug "make and populate the ENV:MetaToolPrefs drawer"))
  291.     (if (AND (= 2 (exists "ENV:" (noreq)))
  292.          (= 0 (exists "ENV:MetaToolPrefs" (noreq))))
  293.             (makedir "ENV:MetaToolPrefs" (safe))
  294.     )
  295.     (textfile
  296.         (dest "ENV:MetaToolPrefs/ANIM")
  297.         (append ANIM_METATYPE)
  298.     )
  299.     (textfile
  300.         (dest "ENV:MetaToolPrefs/BMP")
  301.         (append BMP_METATYPE)
  302.     )
  303.     (textfile
  304.         (dest "ENV:MetaToolPrefs/GIF")
  305.         (append GIF_METATYPE)
  306.     )
  307.     (textfile
  308.         (dest "ENV:MetaToolPrefs/GUIDE")
  309.         (append GUIDE_METATYPE)
  310.     )
  311.     (textfile
  312.         (dest "ENV:MetaToolPrefs/ILBM")
  313.         (append ILBM_METATYPE)
  314.     )
  315.     (textfile
  316.         (dest "ENV:MetaToolPrefs/JPEG")
  317.         (append JPEG_METATYPE)
  318.     )
  319.     (textfile
  320.         (dest "ENV:MetaToolPrefs/MOVIE")
  321.         (append MOVIE_METATYPE)
  322.     )
  323.     (textfile
  324.         (dest "ENV:MetaToolPrefs/TEXT")
  325.         (append TEXT_METATYPE)
  326.     )
  327.     (if (= 1 debugflag) (debug "done building ENV:MetaToolPrefs defaults"))
  328. )
  329.  
  330. ; Get default values for the MetaTool.prefs file.  If we can find an existing
  331. ; prefs file, then extract the default values for each METATYPE from that file.
  332. ; Otherwise, prepare suitable defaults based on the version of AmigaDOS that
  333. ; the user is running.
  334. ;
  335. ; This is kludgy because Installer doesn't provide any simple method of reading
  336. ; data in from an external file.  We use a helper program that extracts all the
  337. ; metatypes and command lines from the preferences file, and stuffs them into
  338. ; environment variables in the ENV:MetaToolPrefs directory.  We can then get the
  339. ; ones we are interested in via getenv, change them if necessary, and eventually
  340. ; rebuild the preferences files using all the extracted metatypes.
  341.  
  342.  
  343. (procedure GetMetaToolPrefs
  344.  
  345.     ; Set a default for the name of the MetaTool prefs file.
  346.  
  347.     (set metatoolprefs "S:MetaTool.prefs")
  348.  
  349.     ; Doing getenv on a non-existant env variable croaks the installer!
  350.  
  351.     (if (exists "ENV:METACONFIG")
  352.         (
  353.             (set metaconfig (getenv "METACONFIG"))
  354.             (if (= 1 debugflag) (debug "ENV:METACONFIG contains " metaconfig))
  355.             ; Make sure var is not empty before committing to it.
  356.             (if (<> 0 (strlen metaconfig))
  357.                 (
  358.                     (set metatoolprefs metaconfig)
  359.                 )
  360.             )
  361.         )
  362.     )
  363.     (if (= 1 debugflag) (debug "use MetaTool prefs file " metatoolprefs))
  364.  
  365.     ; Allow average or expert user to select the MetaTool prefs file to read defaults from
  366.     ; and to which the edited prefs will be written.
  367.  
  368.     (if (> 0 @user-level)
  369.         (
  370.             ; If a file does not currently exist, then the default filename
  371.             ; used in the askfile command will NOT appear in the file requester.
  372.             ; The "newpath" option would appear to be the solution for this, but
  373.             ; no known installer accepts it.  So we have to kludge around the problem
  374.             ; by creating a temporary file that gets deleted after askfile completes.
  375.             (set deletefile "")
  376.             (if (= 0 (exists metatoolprefs))
  377.                 (
  378.                     (set deletefile metatoolprefs)
  379.                     (if (= 1 debugflag) (debug "Create temporary " deletefile))
  380.                     (textfile
  381.                         (dest deletefile)
  382.                         (append "delete me!")
  383.                     )
  384.                 )
  385.             )
  386.             (set metatoolprefs
  387.                 (askfile
  388.                     (prompt ask_select_metatoolprefs)
  389.                     ;;(newpath)
  390.                     (default (expandpath metatoolprefs))
  391.                     (help help_select_metatoolprefs)
  392.                 )
  393.             )
  394.             (if (<> 0 (strlen deletefile))
  395.                 (
  396.                     (if (= 1 debugflag) (debug "Delete temporary " deletefile))
  397.                     (delete deletefile)
  398.                 )
  399.             )
  400.         )
  401.     )
  402.     (if (= 1 debugflag) (debug "Will use MetaTool prefs file " metatoolprefs))
  403.  
  404.     ; If there is an existing MetaTool prefs file, get defaults from it, overriding
  405.     ; any existing defaults we may have set up.
  406.  
  407.     (if (exists metatoolprefs (noreq))
  408.         (
  409.             (set commandline ("%s %s" MetaToolPrefs2Env metatoolprefs))
  410.             (if (= 1 debugflag) (debug "running " commandline))
  411.             (run commandline (safe))
  412.         )
  413.     )
  414. )
  415.  
  416. ; Edit the MetaTool prefs that are stored in the ENV:MetaToolPrefs drawer.
  417. ; Each one can be either a CLI command or a WorkBench command.
  418.  
  419. (procedure EditMetaToolPrefs
  420.     (foreach "ENV:MetaToolPrefs" "#?"
  421.         (if (= 1 debugflag) (debug "edit METATYPE " @each-name))
  422.         (set envvar ("%s/%s" "MetaToolPrefs" @each-name))
  423.         (set metacommand (getenv envvar))
  424.         (if (= (substr metacommand 0 4) "CLI ")
  425.             (
  426.                 (set CLIcommand 1)
  427.                 (set metacommand (substr metacommand 4))
  428.             )
  429.             (
  430.                 (set CLIcommand 0)
  431.             )
  432.         )
  433.         (if (= 1 debugflag) (debug "CLIcommand is " CLIcommand "metacommand is " metacommand))
  434.         (set CLIcommand
  435.             (askchoice
  436.                 (prompt ("%s %s?" ask_cli_or_workbench @each-name))
  437.                 (help help_cli_or_workbench)
  438.                 (choices "WorkBench" "CLI")
  439.                 (default CLIcommand)
  440.             )
  441.         )
  442.         (if (= CLIcommand 0)
  443.             (
  444.                 (set metacommand
  445.                     (askfile
  446.                         (prompt ("%s %s" ask_specify_Workbench_command @each-name))
  447.                         (help help_specify_Workbench_command)
  448.                         ;;(newpath)
  449.                         (default metacommand)
  450.                     )
  451.                 )
  452.                 (run ("SetEnv MetaToolPrefs/%s \"%s\"" @each-name metacommand) (safe))
  453.             )
  454.             (
  455.                 (set metacommand
  456.                     (askstring
  457.                         (prompt ("%s %s. %s" ask_specify_CLI_command @each-name ask_specify_CLI_command_help))
  458.                         (help help_specify_CLI_command)
  459.                         (default metacommand)
  460.                     )
  461.                 )
  462.                 (run ("SetEnv MetaToolPrefs/%s \"CLI %s\"" @each-name metacommand) (safe))
  463.             )
  464.         )
  465.     )
  466. )
  467.  
  468. ; Using the MetaTool prefs stored in individual environment variables in ENV:MetaToolPrefs,
  469. ; rebuild a MetaTool prefs file and write it to the previously selected destination file.
  470.  
  471. (procedure RebuildMetaToolPrefs
  472.     (foreach "ENV:MetaToolPrefs" "#?"
  473.         (if (= 1 debugflag) (debug "found METATYPE " @each-name))
  474.         (set envvar ("%s/%s" "MetaToolPrefs" @each-name))
  475.         (set metacommand (getenv envvar))
  476.         (set prefs (cat prefs ("%s\t%s\n" @each-name metacommand)))
  477.     )
  478.     (textfile
  479.         (dest tmpprefs)
  480.         (append prefs)
  481.     )
  482.  
  483.     ; If not novice mode then ask user if OK to install new
  484.     ; MetaTool prefs permanently.
  485.  
  486.     (if (= 0 @user-level)
  487.         (set updateprefs 0)
  488.         (set updateprefs
  489.             (askbool
  490.                 (prompt ask_update_metatoolprefs)
  491.                 (help help_update_metatoolprefs)
  492.                 (choices yes no)
  493.                 (default 1)
  494.             )
  495.         )
  496.     )
  497.     (if (= 1 debugflag) (debug "update prefs selection is " updateprefs))
  498.     (if (= 0 updateprefs)
  499.         (set metatoolprefs ramprefs)
  500.     )
  501.  
  502.     ; Set METACONFIG environment variable to point to whereever
  503.     ; we have selected the MetaTool prefs file to be.
  504.  
  505.     (if (= 1 debugflag) (debug "set METACONFIG to " metatoolprefs))
  506.     (run ("SetEnv METACONFIG \"%s\"" metatoolprefs))
  507.  
  508.     ; Delete any old backup file and rename the current prefs file
  509.     ; (if any) to a backup file.
  510.  
  511.     (set prefsbackup ("%s.bak" metatoolprefs))
  512.     (if (= 1 debugflag) (debug "create backup file" prefsbackup))
  513.     (delete prefsbackup)
  514.     (rename metatoolprefs prefsbackup)
  515.  
  516.  
  517.     ; Install the new prefs file.  Note that this is such a small file that there is
  518.     ; no sense in flashing the copy gauge at the user, who probably won't have time
  519.     ; to read it anyway.
  520.  
  521.     (if (= 1 debugflag) (debug "copy " tmpprefs " to " metatoolprefs))
  522.     (copyfiles
  523.         (source tmpprefs)
  524.         (dest (pathonly metatoolprefs))
  525.         (files)
  526.         (nogauge)
  527.         (delopts fail)
  528.         (optional nofail force)
  529.     )
  530.  
  531.     ; If updating the prefs is selected, then install the METACONFIG file
  532.     ; in ENVARC:
  533.  
  534.     (if (= 1 updateprefs)
  535.         (
  536.             (if (= 1 debugflag) (debug "copy ENV:METACONFIG ENVARC:METACONFIG"))
  537.             (copyfiles
  538.                 (source "ENV:METACONFIG")
  539.                 (dest "ENVARC:")
  540.                 (files)
  541.                 (nogauge)
  542.                 (delopts fail)
  543.                 (optional nofail force)
  544.             )
  545.         )
  546.     )
  547. )
  548.  
  549. (procedure AddLibs
  550.     (textfile
  551.         (dest tmpfile)
  552.         (append ("assign LIBS: %s:Tools/libs add\n" volname)))
  553.     (if (= 1 debugflag) (debug "execute" tmpfile))
  554.     (execute tmpfile)
  555.     (delete tmpfile)
  556. )
  557.  
  558. ; First we set the defaults that we suggest for the user, then we override
  559. ; them in the environment variables with what the user currently has in his
  560. ; MetaTool prefs file.
  561. ;
  562. ; Then, for each METATYPE in the ENV:MetaToolPrefs directory, any which might
  563. ; have come from our internal defaults or the preferences file, we allow the
  564. ; user to either select the default in ENV:MetaToolsPrefs, select our internal
  565. ; default, or change to an entirely different command.
  566.  
  567. (procedure Main
  568.  
  569.     ; Set debugflag to 0 for no debugging or 1 to enable debug messages.
  570.     ; Thus you can enable debugging with a single change to this file.
  571.  
  572.     (set debugflag 0)
  573.  
  574.     ; Set some defaults for various things.
  575.  
  576.     ; Use an explicit volname which allows this installer script to reside anywhere.
  577.  
  578.     (set volname "ES_Archives")
  579.  
  580.     ; This sets names of any temporary files used.  Note that we create a special
  581.     ; directory that is deleted after we are done, into which all the temporary
  582.     ; files are stored.  This is so that we can use the actual names of files
  583.     ; that we want to create, so that "newname" is not necessary in any copyfiles,
  584.     ; since the confirmation requester does not take into account the new name.
  585.  
  586.     (set tmpdir "t:ES_Archives")
  587.     (set tmpfile ("%s/%s" tmpdir "ES_Archives.tmp"))
  588.     (set tmpprefs ("%s/%s" tmpdir "MetaTool.prefs"))
  589.     (set ramprefs "ram:MetaTool.prefs")
  590.  
  591.     ; This tool parses the MetaTool prefs file and creates environment variables that
  592.     ; match each METATYPE.
  593.  
  594.     (set MetaToolPrefs2Env ("%s:%s" volname "Useful/Amiga/other/MetaTool/MetaToolPrefs2Env"))
  595.  
  596.     ; Find out some environment stuff.
  597.  
  598.     (set osver (/ (getversion) 65536))
  599.  
  600.     ; If we abort, delete the entire MetaTool prefs directory that we created in
  601.     ; ENV: and the temporary directory.  Note that since a "delete ... all" is
  602.     ; such a dangerous command, we explicitly name the targets here, rather than
  603.     ; allowing a substitution of "tmpdir" for example.  Paranoia rules...
  604.  
  605.     (onerror (run ("delete ENV:MetaToolPrefs T:ES_Archives all") (safe)))
  606.  
  607.     ; Set @default-dest as the location for the log file.
  608.  
  609.     (set @default-dest "ram:")
  610.  
  611.     ; Create the temporary directory.
  612.  
  613.     (makedir tmpdir (safe))
  614.  
  615.     ; The real work starts here.  Select the language to use.
  616.  
  617.     (SelectLanguage)
  618.     (complete 10)
  619.  
  620.     (message msg_hello)
  621.     (complete 20)
  622.  
  623.     (SetMetaToolDefaults)
  624.     (complete 30)
  625.  
  626.     (GetMetaToolPrefs)
  627.     (complete 50)
  628.  
  629.     (if (= 2 @user-level)
  630.         (EditMetaToolPrefs)
  631.     )
  632.     (complete 70)
  633.  
  634.     (RebuildMetaToolPrefs)
  635.     (complete 90)
  636.  
  637.     (AddLibs)
  638.     (complete 100)
  639.  
  640.     (run ("delete ENV:MetaToolPrefs T:ES_Archives all") (safe))
  641. )
  642.  
  643.  
  644. (Main)
  645.