; Installationsskript für IR-Master 3.33
; $VER: IR-Master Install 3.33 (09.06.95)
; (c) 1995 Michael Watzl

(set version 3)
(set revision 33)
(set @app-name ("IR-Master %ld.%ld" version revision))

; *********** Zuerst Strings sprachenabhängig initialisieren **
(if (= @language "deutsch")
    (
; //+ deutsche strings
        (set @abort-button "Installation abrrechen!")
        (set @error-msg    "Fataler Fehler!")
        (set #welcome (cat
             @app-name
             "-Installation\n\n"
             "Damit wird der IR-Master automatisch auf\n"
             "Ihrer Festplatte installiert\n\n"
             "IR-Master © 1993-1995 Jürgen Frank und Michael Watzl\n"
             "All rights reserved."))

        (set #version_error
            "\nSorry...\n\nDer IR-Master benötigt minestens\nAmiga-OS 2.04")
        (set #cantuncompress
            "Fehler beim Entpacken von ")
        (set #uncompress
            "Entpacke ")
        (set #install
            "Installiere ")
        (set #toinstall
            "installieren")
        (set #whichdrawer
            "Wo soll für den IR-Master ein Verzeichnis angelegt werden?")
        (set #whichdrawer_help (cat
            "Ein Verzeichnis namens 'IR-Master' wird dort "
            "erzeugt. Dort wird der IR-Master nach der "
            "Installation zu finden sein."))
        (set #selectparts
            "Welche Teile der Distribution sollen installiert werden?")
        (set #selectparts_help (cat
            "Wenn Sie genügend Platz auf Ihrer Festplatte haben, "
            "sollten Sie alles anwählen.\n\n"
            "Zum Betrieb ist es allerdings ausreichend, wenn Sie "
            "nur 'IR-Master' anwählen.\n\n"

            "1. IR-Master\n"
            "Das sind die beiden Programme IR-Editor und IR-Runner "
            "mit den zugehörigen Libraries und dem Verzeichnis "
            "Data/, welches die Piktogramme für die Toolbox enthält\n\n"

            "2. Aleitung zum IR-Master\n"
            "Die Anleitung im Amiga-Guide- und DVI-Format in "
            "deutsch und englisch.\n\n"

            "3. Beispielprojekte\n"
            "Sie können den Beispielprojekten entnehmen, wie IR-Daten "
            "dargestellt werden, oder andere Kniffe kennenlernen.\n\n"

            "4. Hintergrundgrafiken\n"
            "Sie können Hintergrundgrafiken zum verschönern "
            "Ihrer Projekte verwenden.\n\n"

            "5. ARexx-Beispiele\n"
            "Ein paar kleine Deomstrationen, wie man den IR-Master "
            "mit ARexx verwenden kann.\n\n"

            "6. Artwork\n"
            "Piktogramme für Gadgets.\n\n"

            "7. Schaltpläne der Hardwares (Nur für registrierte User)\n"
            "Die Schaltpläne der IR-Masterhardwares als IFF-Bilder.\n\n"))
        (set #installmaster
            "IR-Master installieren")
        (set #installmaster_help (cat
            "Dieser Installationsschritt installiert alle "
            "für den reinen Betrieb des IR-Masters nötigen "
            "Dateien in das von Ihnen gewählte Verzeichnis "
            "Zudem werden noch zwei Libraries (req.library "
            "und InfraRed.library) nach LIBS: installiert. "))
        (set #libraries
            "Bibliotheken")
        (set #req.library_help (cat
            "Die req.library wird vom IR-Editor gebraucht. "
            "Sie sollten aber einen Patch installieren, der "
            "die req.library in die reqtools.library umleitet. "
            "(siehe Anleitung)."))
        (set #infrared.library_help (cat
            "Die InfraRed.library wird vom IR-Master und vom "
            "IR-Runner verwendet, um IR-Kommandos zu senden. "))
        (set #irmaster_help (cat
            "IR-Editor dient zum Erstellen der Projekte. "
            "IR-Runner ist das Laufzeitmodul."))
        (set #askwbcolors
            "Wieviele Farben verwenden Sie bei Ihrer Workbench?")
        (set #askwbcolors_help (cat
            "Die ToolBox-Piktogramme des IR-Editors "
            "können durch andere ersetzt werden. "
            "Für 4,8 und 16 Farben sind Beispiel-Daten vorhanden\n\n"
            "Ohne diese Daten kann der IR-Editor nicht starten!"))
        (set #docs
            "Anleitung")
        (set #docspattern
            "(IR-MasterD.guide|IR-MasterD.DVI|LIZENZ)")
        (set #guide
            "IR-MasterD.guide")
        (set #dvi
            "IR-MasterD.DVI")
        (set #examples
            "Beispiel-Projekte")
        (set #examples_help (cat
            "An den Beispiel-Projekten kann man leicht "
            "lernen, was man mit dem IR-Master alles "
            "machen kann.\n"))
        (set #backgrounds
            "Hintergrundgrafiken")
        (set #backgrounds_help (cat
            "IR-Masterprojekte können als Hintergrundgrafik "
            "ein IFF-Bild verwenden. Hier sind einige "
            "Beispiele zusammengestellt."))
        (set #arexx
            "ARexx")
        (set #arexx_help (cat
            "Der IR-Runner hat einen ARexx-Port. Wie sie "
            "diesen benutzen, können Sie anhand der "
            "Beispiele sehen."))
        (set #artwork
            "Artwork")
        (set #artwork_help (cat
            "In diesem Verzeichnis werden Sie nach der Installation "
            "ein paar Grafiken finden, die Sie als Gadgetgrafiken "
            "im IR-Editor verwenden können."))
        (set #schematics
            "Baupläne")
        (set #schematics_help (cat
            "Wenn Sie IR-Master-Hardware nachbauen, oder "
            "einfach mal ansehen wollen, so werden Sie die "
            "Baupläne nach der Installation hier finden."))
        (set #bye (cat
             "\n\n\nViel Spaß mit dem IR-Master wünschen\n"
             "Jürgen Frank und\n"
             "Michael Watzl"))
        (set #importand
            "wichtig")
; //-
    )
    (
; //+ englische strings
        (set #welcome (cat
            @app-name
            "-Installation\n\n"
            "The IR-Master will automatically be\n"
            "installed to your ard disk.\n\n"
            "IR-Master © 1993-1995 Jürgen Frank und Michael Watzl\n"
            "All rights reserved."))
        (set #version_error
            "\nSorry...\n\nIR-Master needs Amiga-OS 2.04 or better!")
        (set #cantuncompress
            "Can't uncompress ")
        (set #uncompress
            "Uncompress ")
        (set #install
            "Install ")
        (set #toinstall
            "installing ")
        (set #whichdrawer
            "Where should I place the drawer for IR-Master?")
        (set #whichdrawer_help (cat
            "A drawer named 'IR-Master' will be created. "
            "In this drawer you will find the IR-Master "
            "after the installation is finished."))
        (set #selectparts
            "Which parts of the distribution shoud be installed?")
        (set #selectparts_help (cat
            "If you have enough room on your hard disk, you "
            "should select all parts.\n\n"
            "To simply use the IR-Master it is enough to install "
            "only 'IR-Master'\n\n"

            "1. IR-Master\n"
            "This will install IR-Editor, IR-Runner, the "
            "libraries and some essential data for the IR-Editor's "
            "toolbox to your HD\n\n"

            "2. Documents\n"
            "The documents as amigaguide guides and dvi files\n\n"

            "3. Examples\n"
            "Some example projects for the IR-Master. Load them "
            "with the IR-Editor or start them with the IR-Runner.\n\n"

            "4. Backgrounds\n"
            "You may use iff pictures as backgrounss for your "
            "projects. Here you will find some examples.\n\n"

            "5. ARexx examples\n"
            "The IR-Runner has an ARexx port. If you want to know "
            "how to use it, install this part and take a look "
            "on this files.\n\n"

            "6. Artwork\n"
            "Here you will find some icons for your project's gadgets.\n\n"

            "7. Schematics\n"
            "If you want to rebuild the IR-Master's hardware "
            "install this part, too."))
        (set #installmaster
            "Install IR-Master")
        (set #installmaster_help (cat
            "This step will install all files which are "
            "essetial to run IR-Master. "
            "This will be: IR-Editor, IR-Runner, libraries "
            "and some icons for the IR-Editor's toolbox." ))
        (set #libraries
            "libraries")
        (set #req.library_help (cat
            "The req.library is used by the IR-Editor. "
            "You should problably install a patch to "
            "redicrect the calls to the better looking "
            "reqtools.library (see documents for more)."))
        (set #infrared.library_help (cat
            "The InfraRed.library is used by IR-Editor and "
            "IR-Runner to send the ir commands"))
        (set #irmaster_help (cat
            "Use the IR-Editor to construct your remotes and "
            "the IR-Runner to launch them."))
        (set #askwbcolors
            "How many colors do you use on your workbench?")
        (set #askwbcolors_help (cat
            "The icons of the IR-Editor's toobox can be replaced. "
            "Icon sets for 4, 8 and 16 colors are included. "
            "Without this icons, the IR-Editor can't start."))
        (set #docs
            "Documentation")
        (set #docspattern
            "(IR-MasterE.guide|IR-MasterE.DVI|LICENCE)")
        (set #guide
            "IR-MasterE.guide")
        (set #dvi
            "IR-MasterE.DVI")
        (set #examples
            "Examples")
        (set #examples_help (cat
            "Load or start the examples. This will "
            "help you building your own projects."))
        (set #backgrounds
            "Backgrounds")
        (set #backgrounds_help (cat
            "Projects can use iff pictures as background "
            "graphics. Here you will find some examples."))
        (set #arexx
            "ARexx")
        (set #arexx_help (cat
            "The IR-Runner has an ARexx port. If you "
            "want to learn about using it, take a look "
            "on this scripts."))
        (set #artwork
            "Artwork")
        (set #artwork_help
            "Here you can find some icons for your project's gadgets." )
        (set #schematics
            "Hardware")
        (set #schematics_help (cat
            "If you want to construct IR-Master-hardware you "
            "will find the schematics in this drawer."))
        (set #bye (cat
             "Jürgen Frank und\n"
             "Michael Watzl\n\n"
             "wish you a lot of fun with the IR-Master!"))
        (set #importand
            "important")
; //-
    )
)

; *************************************************************


(message #welcome)
(complete 0)

; Amiga-OS Versionscheck
(if (< (/ (getversion) 65536) 37)
    (abort #version_error)
)


; ***********************************************
; Zielverzeichnis setzen und Verzeichnis erzeugen
; ***********************************************

(set ziel
    (askdir
        (prompt #whichdrawer )
        (default "Work:")
        (help   #whichdrawer_help )
    )
)
(set @default-dest ziel )
(set ziel (tackon ziel "IR-Master"))
(makedir ziel (infos))

; //+ Installationsauswahl

(if (exists("hardware.run"))
    (set x
        (askoptions
            (prompt #selectparts)
            (help   #selectparts_help)
            (choices
                    "IR-Master              (IR-Master)"
                    "Anleitung              (Documents)"
                    "Beispielprojekte       (Examples)"
                    "Hintergrundgrafiken    (Backgrounds)"
                    "ARexx-Beispiele        (ARexx-Examples)"
                    "Artwork                (Artwork)"
                    "Schaltpläne            (Schematics)" )
            (default %1111111)
        )
    )
    (set x
        (askoptions
            (prompt #selectparts )
            (help   #selectparts_help)
            (choices
                    "IR-Master              (IR-Master)"
                    "Anleitung              (Documents)"
                    "Beispielprojekte       (Examples)"
                    "Hintergrundgrafiken    (Backgrounds)"
                    "ARexx-Beispiele        (ARexx-Examples)"
                    "Artwork                (Artwork)" )
            (default %1111111)
        )
    )
)

(if (bitand x %0000001)(
; //+ Libs entpacken und installieren

(working (cat "\n\n" #uncompress #libraries))
(set rc (run "libs.run t:"))
(if (<> rc 0)
    (abort (cat #cantuncompress #libraries))
)

(copylib
    (prompt (cat "\n\n" #install "req.library"))
    (help   #req.library_help )
    (source "T:libs/req.library")
    (dest   "libs:")
    (confirm "expert")
    (nogauge)
)

(copylib
    (prompt (cat "\n\n" #install "InfraRed.library"))
    (help   #infrared.library_help)
    (source "T:libs/InfraRed.library")
    (dest   "libs:")
    (confirm "expert")
    (nogauge)
)

; clean up
(run "delete t:libs#? all quiet")

; //-
; //+ Install IR-Master
    (working (cat "\n\n" #uncompress "IR-Master"))
    (set rc (run "ir-master.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress "IR-Master"))
    )
    (set rc (run "catalogs.run T:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress "Locale" ))
    )

    (copyfiles
        (prompt (cat "\n\n" #install "IR-Master"))
        (help   #irmaster_help)
        (source "t:")
        (dest ziel)
        (choices "IR-Editor" "IR-Runner")
        (infos)
        (confirm "expert")
    )

    (makedir (tackon ziel "catalogs"))
    (copyfiles
        (source "t:catalogs")
        (dest (tackon ziel "catalogs"))
        (all)
        (nogauge)
    )
    (set y
        (askchoice
            (prompt "\n\n" #askwbcolors)
            (help   #askwbcolors_help)
            (choices "4" "8" ">= 16")
        )
    )
    
    (set farben (shiftleft 2 (+ y 1)))
    (set name   (cat "data" farben))
    (working (cat "\n\n" #uncompress "Toolbox" ))
    (set rc (run (cat name ".run T:")))
    (if (<> rc 0)
        (abort (cat #cantuncompress "Toolbox"))
    )
    (working (cat "\n\n" #install "Toolbox"))
    (makedir (tackon ziel "Data") )
    (copyfiles
        (source (cat "t:" name))
        (dest (tackon ziel "data"))
        (all)
        (nogauge)
    )
    ; cleanup
    (run "delete t:catalogs#? all quiet")
    (run "delete t:data#? all quiet")
    (run "delete t:IR-Editor#? all quiet")
    (run "delete t:IR-Runner#? all quiet")
; //-
))

(complete 25 )

(if (bitand x %0000010)(
; //+ Install Documentation
    (working (cat "\n\n" #uncompress #docs))
    (set rc (run "docs.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #docs ))
    )

    (makedir (tackon ziel #docs ))
    (copyfiles
        (source "t:docs.info")
        (dest ziel)
        (newname (cat #docs ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #docs))
        (help "")
        (source "T:docs")
        (dest (tackon ziel #docs))
        (pattern #docspattern )
        (infos)
        (confirm "expert")
    )

    ; tooltypes anpassen
    (set tt "sys:utilities/more")
    (if (exists( "sys:utilities/amigaguide" (noreq)))
        (set tt "sys:utilities/amigaguide")
    )
    (if (exists( "sys:utilities/multiview" (noreq)))
        (set tt "sys:utilities/multiview")
    )

    (set docpath (tackon ziel #docs ))

    (tooltype
        (dest (tackon docpath #guide ))
        (setdefaulttool tt)
        (noposition)
    )
    (tooltype
        (dest (tackon docpath #dvi ))
        (noposition)
    )

    ; cleanup
    (run "delete t:Docs#? all quiet")
; //-
))

(complete 40)

(if (bitand x %0000100)(
; //+ Install Beispielprojekte
    (working (cat "\n\n" #uncompress #examples ))
    (set rc (run "examples.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #examples))
    )

    (makedir (tackon ziel #examples ) )
    (copyfiles
        (source "t:examples.info")
        (dest ziel)
        (newname (cat #examples ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #examples ))
        (help   #examples_help)
        (source "t:Examples/")
        (dest (tackon ziel #examples ))
        (confirm "expert")
        (pattern "(#?.irm|#?.iff")
        (infos)
    )
    ; cleanup
    (run "delete t:Examples#? all quiet")

; //-
))

(complete 60)

(if (bitand x %0001000)(
; //+ Install Hintergrundgrafiken
    (working (cat "\n\n" #uncompress #backgrounds))
    (set rc (run "backgrounds.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #backgrounds))
    )

    (makedir (tackon ziel #backgrounds))
    (copyfiles
        (source "t:Backgrounds.info")
        (dest ziel)
        (newname (cat #backgrounds ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #backgrounds))
        (help   #backgrounds_help )
        (source "t:backgrounds/")
        (dest (tackon ziel #backgrounds ))
        (pattern "(#?.iff|#?.brush)")
        (infos)
        (confirm "expert")
    )
    ; cleanup
    (run "delete t:Backgrounds#? all quiet")
; //-
))

(complete 80)

(if (bitand x %0010000)(
; //+ Install ARexx-Scripts
    (working (cat "\n\n" #uncompress #arexx ))
    (set rc (run "arexx.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #arexx))
    )

    (makedir (tackon ziel #arexx))
    (copyfiles
        (source "t:ARexx.info")
        (dest ziel)
        (newname (cat #arexx ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #arexx ))
        (help   #arexx_help )
        (source "t:ARexx/")
        (dest (tackon ziel #arexx ))
        (pattern "#?.rexx")
        (infos)
        (confirm "expert")
        (nogauge)
    )
    ; cleanup
    (run "delete t:ARexx#? all quiet")
; //-
))

(complete 85)

(if (bitand x %0100000)(
; //+ Install Artwork
    (working (cat "\n\n" #uncompress #artwork))
    (set rc (run "artwork.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #artwork))
    )

    (makedir (tackon ziel #artwork ) )
    (copyfiles
        (source "t:Artwork.info")
        (dest ziel)
        (newname (cat #artwork ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #artwork ))
        (help   #artwork_help )
        (source "t:Artwork/")
        (dest (tackon ziel #artwork ))
        (all)
        (confirm "expert")
        (nogauge)
    )
    ; cleanup
    (run "delete t:Artwork#? all quiet")
; //-
))

(complete 90)

(if (bitand x %1000000)(
; //+ Install Schematics
    (working (cat "\n\n" #uncompress #schematics ))
    (set rc (run "hardware.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress #schematics ))
    )

    (makedir (tackon ziel #schematics ))
    (copyfiles
        (source "t:Hardware.info")
        (dest  ziel)
        (newname (cat #schematics ".info"))
        (nogauge)
    )

    (copyfiles
        (prompt (cat "\n\n" #install #schematics))
        (help   #schematics_help)
        (source "t:Hardware/")
        (dest (tackon ziel #schematics))
        (pattern "#?")
        (infos)
        (confirm "expert")
    )
    ; cleanup
    (run "delete t:Hardware#? all quiet")
; //-
))

(complete 100)

; //-
; //+ Bye Bye
(message #bye )
(if (exists "sys:utilities/more" )
    (set tdisplay "sys:utilities/more ")
    ; else
    (set tdisplay "c:type >con:0/0/640/400/Information/CLOSE/WAIT ")
1)
(run (cat tdisplay #importand ))
; //-

(exit)

