; Installationsskript für IR-Slave 2.00
; $VER: IR-Slave Install 2.00 (26.03.1997)
; (c) 1997 Michael Watzl

(set version 2)
(set revision 00)
(set @app-name ("IR-Slave %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-Slave automatisch auf\n"
             "Ihrer Festplatte installiert\n\n"
             "IR-Slave © 1994-1997 Jürgen Frank und Michael Watzl\n"
             "All rights reserved."))

        (set #version_error
            "\nSorry...\n\nDer IR-Slave 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-Slave ein Verzeichnis angelegt werden?")
        (set #whichdrawer_help (cat
            "Ein Verzeichnis namens 'IR-Slave' wird dort "
            "erzeugt. Dort wird der IR-Slave 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-Slave' und 'Icons' anwählen.\n\n"

            "1. IR-Slave"
            "Das ist das Hauptprogramm.\n\n"

            "2. Aleitung zum IR-Slave"
            "Die Anleitung im Amiga-Guide- und DVI-Format.\n\n"

            "3. Beispielprojekte\n"
            "Sie können den Beispielprojekten entnehmen, wie IR-Slave-Projekte "
            "aussehen können.\n\n"

            "4. Schaltpläne der Hardware (Nur für registrierte User)\n"
            "Die Schaltpläne der IR-Slave-Hardware als IFF-Bild.\n\n"))
        (set #installslave
            "IR-Slave installieren")
        (set #installslave_help (cat
            "Dieser Installationsschritt installiert alle "
            "für den reinen Betrieb des IR-Slave nötigen "
            "Dateien in das von Ihnen gewählte Verzeichnis " ))
        (set #libraries
            "Bibliotheken")
        (set #docs
            "Anleitung")
        (set #docspattern
            "(IR-Slave2D.guide|IR-Slave2D.DVI|LIZENZ)")
        (set #guide
            "IR-Slave2D.guide")
        (set #dvi
            "IR-Slave2D.DVI")
        (set #examples
            "Beispiel-Projekte")
        (set #examples_help (cat
            "An den Beispiel-Projekten kann man leicht "
            "lernen, was man mit dem IR-Slave alles "
            "machen kann.\n"))
        (set #schematics
            "Bauplane")
        (set #schematics_help (cat
            "Wenn Sie IR-Slave-Hardware nachbauen, oder "
            "einfach mal ansehen wollen, so werden Sie den "
            "Bauplan nach der Installation hier finden. "
            "(nur für registrierte Benutzer)" ))
        (set #bye (cat
             "\n\n\nViel Spaß mit dem IR-Slave 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-Slave will automatically be\n"
            "installed to your ard disk.\n\n"
            "IR-Slave © 1994-1997 Jürgen Frank und Michael Watzl\n"
            "All rights reserved."))
        (set #version_error
            "\nSorry...\n\nIR-Slave 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-Slave?")
        (set #whichdrawer_help (cat
            "A drawer named 'IR-Slave' will be created. "
            "In this drawer you will find the IR-Slave "
            "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-Slave it is enough to install "
            "only 'IR-Slave' and 'Icons'\n\n"

            "1. IR-Slave\n"
            "This will install IR-Slave\n\n"

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

            "3. Examples\n"
            "Some example projects for the IR-Slave.\n\n"

            "4. Schematics\n"
            "If you want to rebuild the IR-Slave's hardware "
            "install this part, too."))
        (set #installslave
            "Install IR-Slave")
        (set #installslave_help
            "This step will install the IR-Slave main program." )
        (set #libraries
            "libraries")
        (set #docs
            "Documentation")
        (set #docspattern
            "(IR-Slave2E.guide|IR-Slave2E.DVI|LICENCE)")
        (set #guide
            "IR-Slave2E.guide")
        (set #dvi
            "IR-Slave2E.DVI")
        (set #examples
            "Examples")
        (set #examples_help (cat
            "Load or start the examples. This will "
            "help you building your own projects."))
        (set #schematics
            "Hardware")
        (set #schematics_help (cat
            "If you want to construct the IR-Slave-hardware you "
            "will find the schematics in this drawer (req. users only)." ))
        (set #bye (cat
             "Jürgen Frank und\n"
             "Michael Watzl\n\n"
             "wish you a lot of fun with the IR-Slave!"))
        (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-Slave"))
(makedir ziel (infos))

; //+ Installationsauswahl

(if (exists("hardware.run"))
    (set x
        (askoptions
            (prompt #selectparts)
            (help   #selectparts_help)
            (choices
                    "IR-Slave               (IR-Slave)"
                    "Anleitung              (Documents)"
                    "Beispielprojekte       (Examples)"
                    "Schaltpläne            (Schematics)" )
            (default %1111)
        )
    )
    (set x
        (askoptions
            (prompt #selectparts )
            (help   #selectparts_help)
            (choices
                    "IR-Master              (IR-Master)"
                    "Anleitung              (Documents)"
                    "Beispielprojekte       (Examples)" )
            (default %111)
        )
    )
)

(if (bitand x %0001)(
; //+ Install IR-Slave
    (working (cat "\n\n" #uncompress "IR-Slave"))
    (set rc (run "ir-slave.run t:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress "IR-Slave"))
    )
    (set rc (run "catalogs.run T:"))
    (if (<> rc 0)
        (abort (cat #cantuncompress "Locale" ))
    )

    (copyfiles
        (prompt (cat "\n\n" #install "IR-Slave"))
        (help   #irslave_help)
        (source "t:")
        (dest ziel)
        (infos)
        (pattern "IR-Slave#?")
        (confirm "expert")
    )

    (makedir (tackon ziel "catalogs"))
    (copyfiles
        (source "t:catalogs")
        (dest (tackon ziel "catalogs"))
        (all)
        (nogauge)
    )
    ; cleanup
    (run "delete t:catalogs#? all quiet")
    (run "delete t:IR-Slave#? all quiet")
; //-
))

(complete 25 )

(if (bitand x %0010)(
; //+ 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")
        (all)
        (infos)
    )
    ; cleanup
    (run "delete t:Examples#? all quiet")

; //-
))

(complete 90)

(if (bitand x %0001000)(
; //+ 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 )
; //-

(exit)

