(set #progname "Geometry V1.2")

; --- Kickstart-Version überprüfen ---
(set vernum (getversion))
(set kickstart (/ vernum 65536))
(set #badkicktxt
    (cat "\n" #progname "\n\nbenötigt Amiga-OS 2.04 (V37) oder höher!\n\n"
    "Ihre Kickstart-Version ist " kickstart ".")
)

(if (< kickstart 37)
    (
    (message (#badkicktxt))
    (abort #progname ": Installation abgebrochen!")
    )
)

;  --- Libraries überprüfen ---
(set #mathlib1 "libs:mathieeedoubbas.library")
(set #mathlib2 "libs:mathieeedoubtrans.library")
(set #nomathlibstxt "\nEs werden folgende Libraries benötigt:\n\n")
(if (not (exists #mathlib1))
    (message (cat #nomathlibstxt #mathlib1 "\n" #mathlib2))
)

;-----------------------------------------------------

(set #help1
    (cat "Wählen Sie das Ziel-Verzeichnis für das Programm\n"
    #progname ". Es wird kein neues Verzeichnis angelegt!")
)

(set #getdesttxt
    (cat "\n" #progname " Installation\n"
    "Wählen Sie das Ziel-Verzeichnis für das Programm:"
    "\n" #progname
    )
)

(set #destpath
    (askdir
        (prompt #getdesttxt)
        (help #help1)
        (default ":")
    )
)

; --- Hauptprogramm + icon kopieren ---
(copyfiles
    (source "")
    (dest #destpath)
    (pattern "Geometry")
)
(copyfiles
    (source "")
    (dest #destpath)
    (pattern "Geometry.info")
)
; --- Catalog kopieren ---
(copyfiles
    (source "locale/deutsch")
    (dest "locale:catalogs/deutsch/")
    (pattern "Geometry.catalog")
    (help @copyfiles-help)
)

; --- Guide kopieren ---

(set #helppath
    (askdir
        (prompt "Wählen Sie ein Verzeichnis für die\nAmigaGuide-Dokumentation:")
        (help @askdir-help)
        (default #destpath)
    )
)

(copyfiles
    (source "")
    (dest #helppath)
    (pattern "Geometry.guide")
    (help @copyfiles-help)
)
(copyfiles
    (source "")
    (dest #helppath)
    (pattern "Geometry.guide.info")
    (help @copyfiles-help)
)

; -----------------------------------------------
(set usr
    (askbool
        (prompt "\n\nSind Sie ein registrierter Anwender?")
        (choices "JA" "NEIN")
        (default 2)
        (help @askbool-help)
    )
)

(if (= usr 1)
    (
        (set #usrname
            (askstring
                (prompt "\nGeben Sie Ihren Namen ein:")
                (help @askstring-help)
            )
        )
        (set #password
            (askstring
                (prompt "\nGeben Sie Ihr Password ein:")
                (help @askstring-help)
            )
        )
        (tooltype
            (dest #prg)
            (settooltype "USER" #usrname)
        )
        (tooltype
            (dest #prg)
            (settooltype "PASSWORD" #password)
        )
    )
)

(if (= usr 0)
    (
        (message
            (cat "\n" #progname " ist SHAREWARE!\n"
            "Wenn Sie das Programm öfter verwenden, schicken Sie "
            "DM 8.- oder US$ 5.- oder öS 60.- oder Lit. 8000.- "
            "an F. Agnoli, Schabs 143, I-39040 NATZ-SCHABS, Italien.\n"
            "E-Mail: f.agnoli@pass.dnet.it")
        )
    )
)

(message "\nDie Installation von »" #progname "«"
         "\nist abgeschlossen!"
         "\n"
         "\nSie finden das Programm"
         "\nim Verzeichnis " #destpath "!")
(exit (quiet))
