;
; Install Fiasco
; Copyright © 1995-1997 Nils Bandener
; $VER: InstallFiasco 6.4 (24.10.97)
;

(procedure installkey

    (if (askbool (prompt #install-keyfile)
                 (help #install-keyfile-help)
                 (default 1))
    (
        (copyfiles (source (tackon srcdir "Fiasco.key"))
                   (dest @default-dest))

        (message #key-info)
        (set keyinstalled 1)
    ))
)

(procedure choosedoclanguage

    (if (= docslanguage "")
    (
        (set docslanguage @language)
    ))

    (if (= docslanguage "english")
    (
        (set def 0)
    )
    (
        (if (= docslanguage "deutsch")
        (
            (set def 1)
        )
        (
            (set def 0)
        ))
    ))

    (set docslanguage (select   (askchoice (prompt #choose-docs-language)
                                       (help #choose-docs-language-help)
                                       (choices "English" "Deutsch")
                                       (default def)
                            )
                            "english" "deutsch"
                  )
    )
)


(if (= @language "deutsch")
(
    (set #fiasco-inst
        "\nFiasco Hauptprogramm installieren\n")
    (set #fiasco-inst-help
        "Klicken Sie auf Ja, wenn Sie das Hauptprogramm installieren möchten. Sie sollten es in jedem Fall installieren, da die anderen Teile es benötigen.")
    (set #gtlayout-inst
        "\ngtlayout.library installieren\n")
    (set #gtlayout-inst-help
        (cat "Dies installiert die gtlayout.library, die von Fiasco unbedingt benötigt wird, im Verzeichnis Libs:. Es ist auch möglich, die Library im selben Verzeichnis wie Fiasco abzulegen.\n" @copylib-help))
    (set #doc-inst
        "\nAmigaGuide-Anleitungen für Fiasco installieren\n")
    (set #dvi-inst
        "\nTeX-Anleitungen im DVI-Format für Fiasco installieren\n")
    (set #doc-inst-help
        "Klicken Sie auf Ja, wenn Sie die Anleitung für Fiasco im AmigaGuide-Format installieren möchten. Wenn Sie sie installieren, können Sie jederzeit vom Programm aus mit der Help-Taste eine Beschreibung des Punktes bekommen.")
    (set #dvi-inst-help
        "Klicken Sie auf Ja, wenn Sie die Anleitung für Fiasco im DVI-Format des Textsatzprogramms TeX installieren möchten. Falls Sie dieses Programmpaket besitzen, können Sie ein mit dieser Datei ein Handbuch für Fiasco ausdrucken.")
    (set #example-inst
        "\nBeispiele für Fiasco installieren\n")
    (set #example-inst-help
        "Klicken Sie auf Ja, wenn Sie Beispiel-Datenbanken für Fiasco installieren möchten. Die meisten können Sie auch für eigene Zwecke benutzen und müssen nicht eigene anlegen.")
    (set #wheremain
        "Bitte wählen Sie eine Diskette oder ein Verzeichnis aus, in dem das Fiasco-Verzeichnis erzeugt werden soll")
    (set #where-help
        (cat "In dem hier ausgewählten Verzeichnis wird eine weitere Schublade erzeugt werden, in der Fiasco abgelegt wird. Sie sollten einen sinnvollen Platz auswählen.\n" @askdir-help))
    (set #which-docs
        "Welche Anleitungstypen wollen Sie installieren?")
    (set #makedefaultdoc
        "Wollen Sie %s als feste Sprache für die Online-Hilfe installiern?\n(Ansonsten wird Fiasco die aktuellen Locale Prefs benutzen)")
    (set #which-langs
        "Welche Sprachen wollen Sie installieren?")
    (set #which-examples
        "Welche Beispiele wollen Sie installieren?")
    (set #which-examples-help
        (cat "Wählen Sie hier die Beispiele aus, die Sie installieren möchten. Hier ist eine kurze Beschreibung aller Beispiele:\n" "`Organizer' enthält eine Adress- und Terminverwaltung.\n`Addresses2' ist ein anderes Adressbuch, das Daten des Programms `Magic Address Manager 3' importieren kann.\n`Videos' führt Buch über Videokasetten und ihren Inhalten. Sie können berechnen, wieviel Platz auf einer Kasette noch frei ist." "\n`FamilyTree' ist ein Stammbaum-Projekt\n`PD-Disks' nimmt den Inhalt von PD Disks, wie den Fish Disks, auf." " Ein Script, das diese Disks liest, liegt bei.\n`Multimedia' ist ein Beispiel für ein Multimedia-Lexikon mit Fiasco." "\n`PictureDatabase' kann benutzt werden, um Bilder zu verwalten.\n`Aminet' kann zum Verwalten von Aminet-Dateien benutzt werden.\n" @askchoice-help))
    (set #bad-kick
        "Sie benötigen mindestens Kickstart 2.04 (37.x), um Fiasco benutzen zu können")
    (set #rexx-inst
        "\nBeispiel-ARexx-Scripts für Fiasco installieren")
    (set #rexx-inst-help
        "Klicken Sie auf Ja wenn Sie die ARexx-Scripts mitinstallieren wollen.")
    (set #which-rexx-help
        (cat "Wählen Sie hier die ARexx-Scripts aus die Sie installieren möchten.\n" "Age.rexx berechnet das Alter anhand des Geburtsdatums, Print.rexx ist ein Beispiel für das Ausdrucken eines Projektes und UnlockGUI.rexx macht Fiasco wieder zugänglich für den Benutzer, falls Fiasco von einem ARexx-Script verschlossen gelassen wurde.\n" @copyfiles-help ))
    (set #which-rexx
        "Welche ARexx-Scripts wollen Sie installieren?")
    (set #xport-inst
        "\nBeispiel-Import/Export-Dateien installieren")
    (set #which-xport
        "Welche Import/Export-Dateien wollen Sie installieren?")
    (set #xport-inst-help
        "Klicken Sie auf Ja, wenn Sie Bespiel-Struktur-Dateien für die Import/Export-Funktion von Fiasco installieren möchten")
    (set #which-xport-help
        (cat "Wählen sie hier die Import-Export-Dateien aus, die Sie installieren möchten.\n" "MPeals_II_Findpearls.fxp liest das Dateiformat von FindPearls auf der Meeting Pearls II-CD, RFF.fxp liest das RFF-Dateiformat, StdTwist.fxp liest das Standard-Export-Format von MaxonTwist.\n" @copyfiles-help ))
    (set #cat-inst
        "\nLocale-Catalogs für Fiasco installieren")
    (set #cat-inst-help
        (cat "Klicken Sie auf Ja, wenn Sie Locale-Kataloge installieren wollen. Locale-Kataloge ermöglichen es, Fiasco an eine beliebige Sprache anzupassen." " Um Locale-Kataloge zu nuten wird Amiga OS 2.1 benötigt. Die Sprache Englisch ist eingebaut und muß somit nicht als Catalog installiert werden." " Wenn Sie selbst Kataloge erzeugen wollen, werfen Sie einen Blick auf die Dateien Fiasco.cd und Fiasco.ct."))
    (set #which-cats
        "Welche Catalogs wollen Sie installieren?")
    (set #which-cats-help
        (cat "Wählen Sie hier die Kataloge aus, die Sie installieren möchten. Sie müssen nur den Katalog ihrer Sprache auswählen. Englisch ist direkt in Fiasco eingebaut, also brauchen sie dies nicht zu installieren.\n" @askoptions-help ))
    (set #yes
        "Ja")
    (set #skip
        "Diesen Teil überspringen")
    (set #already-exists
        "\nDas Projekt %s exisitiert bereits!\nWollen Sie ein Backup dieses Projektes behalten?")
    (set #already-exists-help
        (cat "Falls Sie eigene Daten in diesen Beispiel-Projekten abgelegt haben, sollten Sie unbedingt Ja anwählen, da die Projekte ansonsten von der neuen Version des Projektes überschrieben würde. " "Die alten Daten werden im Verzeichnis Old_<AlterName> abgelegt" ))
    (set #Fiasco-old
        "\nSie haben bereits eine neuere Version von Fiasco installiert!\nWollen Sie wirklich Fiasco neu installieren?")
    (set #Fiasco-old-two
        "Diese Fiasco-Version ist älter als die bereits installierte")
    (set #Fiasco-old-help
        (cat "Das Verzeichnis, das sie für Fiasco ausgewählt haben, enthält bereits eine neuere Version" " von Fiasco, als die, die dieses Installationsprogramm installiert.\n" "Sie sollten diese Version nicht installieren, da Sie unter Umständen dann erstellte Daten nicht mehr lesen können."))
    (set #Fiasco-installed
        "Sie haben bereits diese Version von Fiasco installiert!")
    (set #Fiasco-installed-again
        "Nochmal installieren")
    (set #Fiasco-installed-key
        "Nur Keyfile installieren")
    (set #Which-Icons
        "Was für Icon-Typen wollen Sie installieren?")
    (set #Normal-Icons
        "Normale Icons, 4 Farben")
    (set #MWB-Icons
        "MagicWB Icons, 8 Farben")
    (set #Which-Icons-Help
        (cat "Hier können Sie das Aussehen der Piktogramme bestimmen, die von Fiasco benutzt werden. MagicWB-Icons sehen nur gut aus, wenn Sie die Workbench im Hires-Modus und mit acht Farben betreiben.\n" @askchoice-help ))
    (set #envarc-icons-inst
        "\nWollen Sie die MagicWB-Icons als Standard-Fiasco-Icons installieren?")
    (set #envarc-icons-inst-help
        "Klicken Sie auf Ja, wenn Sie wollen, daß Fiasco beim Speichern von Projekten die MagicWB-Icons benutzt.\nDie Icons werden nach envarc: und env: unter den Namen def_Fiasco.info bzw. def_FiascoXPort.info abgelegt" )
    (set #choose-docs-language
        "Bitte wählen Sie die Sprache der Anleitung für Fiasco aus")
    (set #choose-docs-language-help
        (cat "Hier können Sie die Sprache der zu installierenden Anleitung im Guide- oder TeX-DVI-Format auswählen. Falls eine Sprache bei ihnen nicht vorhanden sein sollte, werden Sie darauf hingewiesen.\n" @askchoice-help))
    (set #install-gtlayout
        "\nWollen Sie die gtlayout.library installieren?")
    (set #install-gtlayout-help
        "Fiasco benötigt die gtlayout.library.")
    (set #where-to-install-gtlayout
        "Wo wollen Sie die gtlayout.library installieren?")
    (set #where-to-install-gtlayout-help
        "Wenn Sie die gtlayout.library nach libs: kopieren, wird sie für alle Programme auf Ihrem System verfügbar.\nWenn Sie sie in das Fiasco-Verzeichnis kopieren, wird die Library nur für Fiasco verfügbar sein. De-Installieren von Fiasco wird jedoch wesentlich leichter.")
    (set #gtlayout-dest-libs
        "Libs:")
    (set #gtlayout-dest-fiasco-drawer
        "Fiasco Verzeichnis")
    (set #gtlayout-dest-selected-drawer
        "Verzeichnis auswählen")
    (set #select-gtlayout-drawer
        "Wählen Sie ein Verzeichnis aus, in das die gtlayout.library installiert werden soll")
    (set #select-gtlayout-drawer-help
        (cat "Das Installations-Script wird die gtlayout.library in dem ausgewählten Verzeichnis ablegen.\n" @askdir-help))
    (set #language-not-present
        "Leider ist die ausgewählte Sprache nicht im Fiasco-Distributions Verzeichnis. Sie können entweder die Sprache aus dem entsprechenden Archiv in das Fiasco-Distributions-Verzeichnis entpacken oder eine andere Sprache auswählen und nochmal versuchen.")
    (set #install-textfield
        "\nWollen Sie das textfield.gadget installieren?")
    (set #install-textfield-help
        "Fiasco benötigt zum Betrieb unbedingt das textfield.gadget.\nSie können das Gadget in Classes:Gadgets, in das Fiasco-Verzeichnis oder in ein anderes Verzeichnis installieren.")
    (set #where-to-install-textfield
        "Wo wollen Sie das textfield.gadget installieren?")
    (set #where-to-install-textfield-help
        (cat "Wenn Sie das Gadget in Classes:Gadgets installieren, wird es für alle Programme verfügbar. Um es nur für Fiasco verfügbar zu machen, wählen Sie das Fiasco-Verzeichnis. Dies erleichtert die Deinstallation von Fiasco.\n" @askchoice-help))
    (set #textfield-classes-gadgets
        "Classes:Gadgets")
    (set #textfield-fiasco-dir-gadgets
        "Verzeichnis Gadgets im Fiasco Verzeichnis")
    (set #textfield-select-drawer
        "Wählen Sie ein Verzeichnis für das textfield.gadget aus.")
    (set #textfield-select-drawer-help
        (cat "In das ausgewählte Verzeichnis wird das textfield.gadget installiert." @askdir-help))
    (set #copy-textfield
        "Kopieren textfield.gadget")

    (set #key-info
         (cat "Die Datei Keyfile.readme enthält weitere Informationen über"
              " das Fiasco-Keyfile. Bitte lesen Sie sich diese Datei genau durch!"))

    (set #install-keyfile
         "\nFiasco-Keyfile installieren?")

    (set #install-keyfile-help
         "Das Fiasco-Keyfile macht Sie zu einem legitimen Fiasco-Benutzer. Wenn Sie es installiert haben, erlaubt Ihnen Fiasco, mehr als 30 Records zu speichern.")

))

(if (= @language "english")
(
    (set #fiasco-inst
        "\nInstall Fiasco main program\n")

    (set #fiasco-inst-help
        "Click on Yes, if you want to install the main program. You should install the program in any case, because the other parts require the main program.\n")

    (set #gtlayout-inst
        "\nInstall gtlayout.library\n")

    (set #gtlayout-inst-help
        (cat "This installs the gtlayout.library, which is required by Fiasco, in the directory Libs:. You may also copy the Library in the Directory of Fiasco.\n" @copylib-help))

    (set #doc-inst
        "\nInstall AmigaGuide documentation for Fiasco\n")

    (set #doc-inst-help
        "Click on Yes, if you want to install the documentation in AmigaGuide format for Fiasco. If you have installed it, you may press the Help button in Fiasco and a description for the item is displayed.")

    (set #dvi-inst
        "\nInstall TeX documentation in DVI format for Fiasco\n")

    (set #dvi-inst-help
        "Click on Yes, if you want to install the documentation in DVI format of the textformatting package TeX for Fiasco. If you have this package, you may use the file to print a manual.")

    (set #example-inst
        "\nInstall examples for Fiasco\n")

    (set #example-inst-help
        "Click on Yes, if you want to install example databases for Fiasco. You can continue to use most of them for your own purposes.")

    (set #wheremain
        "Please select a disk or drawer in which the Fiasco drawer should be created or already exists")

    (set #where-help
        (cat "In the directory, which you have selected here, a new drawer will be created. Fiasco will be installed there. You should select a good place for it.\n" @askdir-help))

    (set #which-docs
        "Which doc-types do you want to install?")

    (set #makedefaultdoc
        "Do you want to install %s as a fixed language for online help?\n(Otherwise, Fiasco will use the current Locale Prefs)")

    (set #which-langs
        "Which languages do you want to install?")

    (set #which-examples
        "Which examples do you want to install?")

    (set #which-examples-help
        (cat "Select here the examples, which do you want to install. Here is a short description of all examples:" "\n`Organizer' is a address and appointments manager.\n`Addresses2' is a (german only) address database, which can import data of the program `Magic Address Manager 3'.\n" "`Videos' catalogs video casettes and their contents. You can calculate, how many space is left on a tape.\n" "`FamilyTree' stores data about your ancestors.\n" "`PD-Disks' stores the contents of PD disks like the fish disks. A script, which scans these disks is included.\n" "`Multimedia' is an example for a multimedia encyclopedia done with Fiasco." "\n`PictureDatabase' allows you to manage you pictures.\n`Aminet' allows you to manage Aminet files.\n" @askchoice-help))

    (set #bad-kick
        "You need at least Kickstart 2.04 (37.x) to use Fiasco")

    (set #rexx-inst
        "\nInstall example ARexx scripts for Fiasco")

    (set #which-rexx
        "Wich ARexx scripts do you want to install?")

    (set #rexx-inst-help
        "Click on Yes, if you want to install ARexx scripts.")

    (set #which-rexx-help
        (cat "Select here the ARexx scripts, which you want to install.\n" "Age.rexx calculates the age using the day of birth,  Print.rexx is an example for printing a project and UnlockGUI.rexx makes Fiasco accessible, if a script left Fiasco locked.\n" @copyfiles-help ))

    (set #xport-inst
        "\nInstall example Import/Export files")

    (set #which-xport
        "Which Import/Export files do you want to install?")

    (set #xport-inst-help
        "Click on Yes, if you want to install examples for the Import/Export function of Fiasco")

    (set #which-xport-help
        (cat "Select here the Import/Export files to install.\n" "MPeals_II_Findpearls.fxp reads the fileformat of FindPearls of the Meeting Pearls II CD, RFF.fxp reads the RFF fileformat, StdTwist.fxp reads the standard export format of MaxonTwist.\n" @copyfiles-help ))

    (set #cat-inst
        "\nInstall locale catalogs for Fiasco\n")

    (set #cat-inst-help
        (cat "Click on Yes, if you want to install Locale catalogs. Fiasco may be fit to any language using Locale." " You need at least Amiga OS 2.1 to use Locale catalogs." " If you want to create own catalogs, take a look at Fiasco.cd and Fiasco.ct."))

    (set #which-cats
        "Which catalogs do you want to install?")

    (set #which-cats-help
        (cat "Select here the catalogs, which you want to install. You only need to select your language. English is directly built in, so you don`t need to install it.\n" @askoptions-help ))

    (set #yes
        "Yes")

    (set #skip
        "Skip this part")

    (set #already-exists
        "\nThe Project %s already exists!\nDo you want me to create a backup of the old project?")

    (set #already-exists-help
        (cat "If you have created own data in the example projects, you should select Yes. Otherwise, Fiasco will overwrite the old projects by newer versions. " "The old projects will be stored in Old_<Name>." ))

    (set #Fiasco-old
        "\nYou have already a newer version of Fiasco installed!\nDo you really want to install this version of Fiasco?")

    (set #Fiasco-old-help
        (cat "The drawer, which you have selected for Fiasco, already contains a newer version of Fiasco, " "than the version of this install program.\n" "You should not install this version, because it is possible, that you cannot read newer data with this version."))

    (set #Fiasco-old-two
        "This version of Fiasco is older than the version already installed")

    (set #Fiasco-installed
        "You already have installed this version of Fiasco!")

    (set #Fiasco-installed-again
        "Install again")

    (set #Fiasco-installed-key
        "Install only keyfile")

    (set #Which-Icons
        "Which icon types do you want to install?")

    (set #Normal-Icons
        "Normal icons, 4 colors")

    (set #MWB-Icons
        "MagicWB icons, 8 colors")

    (set #Which-Icons-Help
        (cat "Select here the visual appearance of the icons of Fiasco. MagicWB icons only look good, if you have an 8 color hires Workbench.\n" @askchoice-help ))

    (set #envarc-icons-inst
        "\nDo you want to install the MagicWB icons as default icons for Fiasco?")

    (set #envarc-icons-inst-help
        "Click on Yes, if you want, that Fiasco uses the MagicWB icons, when it saves projects.\nThe icons are copied to envarc: and env: under the names def_Fiasco.info and def_FiascoXPort.info" )

    (set #choose-docs-language
        "Please choose the language for the documentation for Fiasco")

    (set #choose-docs-language-help
        (cat "You can select here the language of the AmigaGuide or TeX-DVI documentation to be installed. If a language should be not present, you will be informed about that.\n" @askchoice-help))

    (set #install-gtlayout
        "\nDo you want to install gtlayout.library?")

    (set #install-gtlayout-help
        "Fiasco requires gtlayout.library to run. ")

    (set #where-to-install-gtlayout
        "Where do you want to install gtlayout.library")

    (set #where-to-install-gtlayout-help
        "Copying gtlayout.library to libs: will make the library available for all programs on your system.\nIf you copy it to the Fiasco directory, it will be only available for Fiasco. However, this makes de-installing Fiasco easier.")

    (set #gtlayout-dest-libs
        "Libs:")

    (set #gtlayout-dest-fiasco-drawer
        "Fiasco drawer")

    (set #gtlayout-dest-selected-drawer
        "Selected drawer")

    (set #select-gtlayout-drawer
        "Select a drawer to install gtlayout.library")

    (set #select-gtlayout-drawer-help
        (cat "The installer script will install the gtlayout.library in the selected drawer.\n" @askdir-help))

    (set #language-not-present
        "Sorry, the selected language is not present in the Fiasco distribution drawer. Either unpack the appropriate archives into the distribution drawer or select another language and try again.")

    (set #install-textfield
        "\nDo you want to install textfield.gadget?")

    (set #install-textfield-help
        "Fiasco needs textfield.gadget to run.\nYou may copy the gadget to sys:classes/gadgets, to the Fiasco directory or another directory.")

    (set #where-to-install-textfield
        "Where do you want to install textfield.gadget?")

    (set #where-to-install-textfield-help
        (cat "If you install the gadget in classes:gadgets, it will be available for all programs in your system. To make it available locally for Fiasco, install it in the Fiasco directory. This will make deinstallation of Fiasco easier.\n" @askchoice-help))

    (set #textfield-classes-gadgets
        "Classes:Gadgets")

    (set #textfield-fiasco-dir-gadgets
        "Directory Gadgets in Fiasco Directory")

    (set #textfield-select-drawer
        "Select a drawer for textfield.gadget:")

    (set #textfield-select-drawer-help
        (cat "textfield.gadget will be copied into the selected directory.\n" @askdir-help))

    (set #copy-textfield
        "Copy textfield.gadget")

    (set #key-info
         (cat "The file Keyfile.readme contains more informatio about "
              "the Fiasco keyfile. Please read that readme file carefully!"))

    (set #install-keyfile
         "\nInstall Fiasco keyfile?")

    (set #install-keyfile-help
         "The Fiasco keyfile makes you a legitimate Fiasco user. If you have installed it, Fiasco allows you to save more than 30 records.")

))

(set osversion (/ (getversion "libs:version.library") 65536))

(if (= osversion 0) (set osversion (/ (getversion) 65536)))

(set cpu (database "cpu"))

(if (< osversion 37)
(
    (abort #bad-kick)
))

(set srcdir (pathonly (pathonly @icon)))
(set @default-dest  "work:")

(set dstdir
   (askdir (prompt #wheremain)
           (default @default-dest)
           (help #where-help)))

(set dstdir (tackon dstdir "Fiasco"))
(set @default-dest dstdir)

(if (exists dstdir)
(
    (if (exists (tackon dstdir "Fiasco"))
    (
        (set exver (getversion (tackon dstdir "Fiasco")))
        (set fver (getversion (tackon srcdir "Fiasco")))

        (if (< fver exver)
        (
            (if (not (askbool (prompt #fiasco-old)
                         (help #fiasco-old-help)
                         (default 0)))
            (
                (abort #Fiasco-old-Two)
            ))

        )
        (
            (if (= fver exver)
            (
                (if (exists (tackon srcdir "Fiasco.key"))
                (
                    (set ch (askchoice (prompt #Fiasco-installed)
                                       (help @askchoice-help)
                                       (choices #Fiasco-installed-again
                                                #Fiasco-installed-key)))
                    (if (= ch 1)
                    (
                        (installkey)
                        (exit)
                    ))

                )
                (
                    (message #Fiasco-installed)
                ))
            ))
        ))
    ))
))

(makedir dstdir (infos))

(set icons (askchoice   (prompt #which-icons)
                        (help #which-icons-help)
                        (choices #normal-icons #mwb-icons)))


(if (askbool (prompt #fiasco-inst)
             (choices #yes #skip)
             (help #fiasco-inst-help)
             (default 1))
(

     (copylib (source (tackon srcdir "Fiasco"))
              (infos)
              (dest dstdir))

    (if (= icons 1)
    (
        (copyfiles  (source (tackon srcdir "Icons/Fiasco.info"))
                    (dest dstdir))
    ))
))

(complete 20)

(if (or (= cpu "68000") (= cpu "68010"))
(
    (set gtlayout "gtlayout.library")
)
(
    (set gtlayout "libs/mc68020/gtlayout.library")
))

(if (askbool (prompt #install-gtlayout)
             (choices #yes #skip)
             (help #install-gtlayout-help)
             (default 1))
(
    (set libdestch (askchoice   (prompt #where-to-install-gtlayout)
                                (help #where-to-install-gtlayout-help)
                                (default 1)
                                (choices #gtlayout-dest-libs #gtlayout-dest-fiasco-drawer #gtlayout-dest-selected-drawer)))

    (if (= libdestch 0)
    (
        (set libdest "libs:")
    )
    (
        (if (= libdestch 1)
        (
            (set libdest dstdir)
        )
        (
            (set libdest (askdir (prompt #select-gtlayout-drawer)
                                 (default dstdir)
                                 (help #select-gtlayout-drawer-help)))
        ))
    ))

    (copylib (prompt #gtlayout-inst)
             (source (tackon srcdir gtlayout))
             (confirm)
             (help #gtlayout-inst-help)
             (dest libdest))

))

(complete 25)

(if (askbool (prompt #install-textfield)
             (choices #yes #skip)
             (help #install-textfield-help)
             (default 1))
(
    (set libdestch (askchoice   (prompt #where-to-install-textfield)
                                (help #where-to-install-textfield-help)
                                (default 1)
                                (choices #textfield-classes-gadgets #textfield-fiasco-dir-gadgets #gtlayout-dest-selected-drawer)))

    (if (= libdestch 0)
    (
        (set libdest "classes:gadgets")
    )
    (
        (if (= libdestch 1)
        (
            (set libdest (tackon dstdir "gadgets"))
        )
        (
            (set libdest (askdir (prompt #textfield-select-drawer)
                                 (default (tackon dstdir "gadgets"))
                                 (newpath)
                                 (help #textfield-select-drawer-help)))
        ))
    ))

    (if (not (exists libdest))
    (
        (makedir libdest)
    ))

    (copylib (prompt #copy-textfield)
             (source (tackon srcdir "gadgets/textfield.gadget"))
             (confirm)
             (help @copylib-help)
             (dest libdest))

))


(complete 30)

(set docdir 0)

(set docslanguage "")

(if (askbool (prompt #doc-inst)
             (choices #yes #skip)
             (help #doc-inst-help)
             (default 1))
(

    (while (= docslanguage "")
    (
        (choosedoclanguage)

        (if (not (exists (tackon (tackon srcdir "Documentation") docslanguage)))
        (
            (message #language-not-present)

            (set docslanguage "")
        ))
    ))

    (set docsrcdir (tackon (tackon srcdir "Documentation") docslanguage))
    (set docdstdir (tackon dstdir "Documentation"))

    (makedir (tackon dstdir "Documentation"))

    (set docdir 1)

    (if (= icons 0)
    (
        (copyfiles  (source (tackon srcdir "Documentation.info"))
                    (dest dstdir))
    )
    (
        (copyfiles  (source (tackon srcdir "Icons/Documentation.info"))
                    (dest dstdir))
    ))

    (copyfiles  (source (tackon docsrcdir "Fiasco.guide"))
                (infos)
                (dest docdstdir))

    (if (= icons 1)
    (
        (copyfiles  (source (tackon srcdir "Icons/Fiasco.guide.info"))
                    (dest docdstdir))
    ))

    (if (< osversion 39)
    (
        (tooltype   (dest (tackon docdstdir "Fiasco.guide"))
                    (setdefaulttool "AmigaGuide"))
    )
    (
        (tooltype   (dest (tackon docdstdir "Fiasco.guide"))
                    (setdefaulttool "MultiView"))
    ))
))

(complete 40)

(if (askbool (prompt #dvi-inst)
             (choices #yes #skip)
             (help #dvi-inst-help)
             (default 0))
(

    (while (= docslanguage "")
    (
        (choosedoclanguage)

        (if (not (exists (tackon (tackon srcdir "Documentation") docslanguage)))
        (
            (message #language-not-present)

            (set docslanguage "")
        ))
    ))

    (set docsrcdir (tackon (tackon srcdir "Documentation") docslanguage))
    (set docdstdir (tackon dstdir "Documentation"))

    (if (= docdir 0)
    (
        (makedir (tackon dstdir "Documentation"))

        (if (= icons 0)
        (
            (copyfiles  (source (tackon srcdir "Documentation.info"))
                        (dest dstdir))
        )
        (
            (copyfiles  (source (tackon srcdir "Icons/Documentation.info"))
                        (dest dstdir))
        ))
    ))
    (copyfiles  (source (tackon docsrcdir "Fiasco.dvi"))
                (infos)
                (dest docdstdir))

    (if (= icons 1)
    (
        (copyfiles  (source (tackon srcdir "Icons/Fiasco.dvi.info"))
                    (dest docdstdir))
    ))

))

(complete 50)

(if (askbool (prompt #example-inst)
             (choices #yes #skip)
             (help #example-inst-help)
             (default 1))
(

    (if (>= osversion 39) ((set exdef -1))((set exdef 253)))

    (set examples (askoptions   (prompt #which-examples)
                                (help #which-examples-help)
                                (choices "Organizer"
                                         "Addresses2"
                                         "Videos"
                                         "FamilyTree"
                                         "GraphDemo"
                                         "PD-Disks"
                                         "Aminet"
                                         "Multimedia Encyclopedia (OS 3.0)"
                                         "PictureDatabase (OS 3.0)"
                                )
                                (default exdef)
                                ))

    (set examdir (tackon @default-dest "Databases"))

    (set examsrcdir (tackon srcdir "Databases"))

    (makedir examdir)

    (if (= icons 0)
    (
        (copyfiles  (source (tackon srcdir "Databases.info"))
                    (dest dstdir))
    )
    (
        (copyfiles  (source (tackon srcdir "Icons/Databases.info"))
                    (dest dstdir))
    ))

    (set n 0)

    (while (set examp (select n     "Organizer"
                                    "Addresses2"
                                    "Videos"
                                    "FamilyTree"
                                    "GraphDemo"
                                    "PD-Disks"
                                    "Aminet"
                                    "Multimedia"
                                    "PictureDatabase"
                                    ""
                       )
           )
    (
        (if (IN examples n)
        (
            (if (exists (tackon examdir examp))
            (
                (if (askbool    (prompt (#already-exists examp))
                                (help #already-exists-help)
                                (default 1))
                (
                    (rename (tackon examdir examp) (tackon examdir (cat "Old_" examp)))
                    (rename (cat (tackon examdir examp) ".info") (cat (tackon examdir (cat "Old_" examp)) ".info"))
                    (tooltype (dest (tackon examdir (cat "Old_" examp))) (noposition))
                ))

            ))

            (copyfiles  (source (tackon examsrcdir examp))
                        (dest (tackon examdir examp))
                        (all))

            (if (= icons 0)
            (
                (copyfiles  (source (cat (tackon examsrcdir examp) ".info"))
                            (dest examdir))
            )
            (
                (copyfiles  (source (tackon srcdir "Icons/Drawer.info"))
                            (dest examdir))

                (rename (tackon examdir "Drawer.info") (tackon examdir (cat examp ".info")))
            ))

            (foreach    (tackon examdir examp)
                        "#?.fdb"
            (
                (if (= icons 1)
                (
                    (copyfiles  (source (tackon srcdir "Icons/FiascoProject.info"))
                                (dest (tackon examdir examp)))

                    (delete (tackon examdir (tackon examp (cat @each-name ".info"))))
                    (rename (tackon examdir (tackon examp "FiascoProject.info")) (tackon examdir (tackon examp (cat @each-name ".info"))))

                ))

                (tooltype   (dest (tackon examdir (tackon examp @each-name)))
                            (setdefaulttool "//Fiasco"))
            ))

        ))
        (set n (+ n 1))
    ))
))

(complete 80)

(if (askbool (prompt #rexx-inst)
             (choices #yes #skip)
             (help #rexx-inst-help)
             (default 1))
(
    (set rexxdir (tackon @default-dest "ARexx"))

    (makedir rexxdir)

    (if (= icons 0)
    (
        (copyfiles  (source (tackon srcdir "ARexx.info"))
                    (dest dstdir))
    )
    (
        (copyfiles  (source (tackon srcdir "Icons/ARexx.info"))
                    (dest dstdir))
    ))

    (copyfiles  (prompt #which-rexx)
                (help #which-rexx-help)
                (source (tackon srcdir "ARexx"))
                (all)
                (confirm)
                (dest rexxdir)
                (infos))

    (if (= icons 1)
    (
        (foreach    rexxdir
                    "#?.rexx"
        (
                (copyfiles  (source (tackon srcdir "Icons/ARexxScript.info"))
                            (dest rexxdir))

                (delete (tackon rexxdir (cat @each-name ".info")))
                (rename (tackon rexxdir "ARexxScript.info") (tackon rexxdir (cat @each-name ".info")))

        ))
    ))

))

(if (askbool (prompt #xport-inst)
             (choices #yes #skip)
             (help #xport-inst-help)
             (default 1))
(
    (set xpdir (tackon @default-dest "XPort"))

    (makedir xpdir)

    (if (= icons 0)
    (
        (copyfiles  (source (tackon srcdir "XPort.info"))
                    (dest dstdir))
    )
    (
        (copyfiles  (source (tackon srcdir "Icons/XPort.info"))
                    (dest dstdir))
    ))

    (copyfiles  (prompt #which-xport)
                (help #which-xport-help)
                (source (tackon srcdir "XPort"))
                (all)
                (confirm)
                (dest xpdir)
                (infos))


    (if (= icons 1)
    (
        (foreach    xpdir
                    "#?.fxp"
        (
                (copyfiles  (source (tackon srcdir "Icons/XPortData.info"))
                            (dest xpdir))

                (delete (tackon xpdir (cat @each-name ".info")))
                (rename (tackon xpdir "XPortData.info") (tackon xpdir (cat @each-name ".info")))

        ))
    ))

))

(complete 85)

(if (>= osversion 38)
(
    (if (askbool (prompt #cat-inst)
                 (choices #yes #skip)
                 (help #cat-inst-help)
                 (default 1))
    (
        (if (= @language "deutsch") ((set def 1))((set def 0)))

        (set choice  (askoptions    (prompt #which-cats)
                                    (help #which-cats-help)
                                    (choices "Dansk"
                                             "Deutsch"
                                             "Español"
                                             "Italiano"
                                             "Svenska"
                                    )
                                    (default def)
                                    ))

        (set n 0)

        (while (set file   (select n    "Dansk"
                                        "Deutsch"
                                        "Español"
                                        "Italiano"
                                        "Svenska"
                                        ""
                           )
               )
        (
            (if (IN choice n)
            (
                (copyfiles  (source (tackon srcdir (tackon "catalogs" file)))
                            (dest (tackon "locale:catalogs" file))
                            (all))

            ))
            (set n (+ n 1))
        ))
    ))
))

(complete 93)

(if (= icons 1)
(
    (if (askbool (prompt #envarc-icons-inst)
                 (choices #yes #skip)
                 (help #envarc-icons-inst-help)
                 (default 0))
    (
        (copyfiles  (source (tackon srcdir "icons/FiascoProject.info"))
                    (dest "envarc:sys"))
        (rename "envarc:sys/FiascoProject.info" "envarc:sys/def_Fiasco.info")
        (copyfiles  (source (tackon srcdir "icons/FiascoProject.info"))
                    (dest "env:sys"))
        (rename "env:sys/FiascoProject.info" "env:sys/def_Fiasco.info")

        (copyfiles  (source (tackon srcdir "icons/XPortData.info"))
                    (dest "envarc:sys"))
        (rename "envarc:sys/XPortData.info" "envarc:sys/def_FiascoXPort.info")
        (copyfiles  (source  (tackon srcdir "icons/XPortData.info"))
                    (dest "env:sys"))
        (rename "env:sys/XPortData.info" "env:sys/def_FiascoXPort.info")
        (copyfiles  (source (tackon srcdir "icons/def_FiascoPrint.info"))
                    (dest "envarc:sys"))
        (copyfiles  (source (tackon srcdir "icons/def_FiascoPrint.info"))
                    (dest "env:sys"))
    ))
))

(if (exists (tackon srcdir "Fiasco.key"))
(
    (installkey)
)
(
    (copyfiles  (source (tackon srcdir "RegForm.txt"))
                (dest @default-dest)
                (infos))
))

(complete 100)
