(message "\n\n\nKRSNAke v1.17\n\n© 1995, 1996 by Psilocybe Software\n\n"
         "This program is released under the GNU General Public License. "
         "See the documentation for details.")

(welcome "This program is released under the GNU General Public License. "
         "See the documentation for details.\n")

(set @default-dest (tackon
                        (askdir
                            (prompt "Select a location for the KRSNAke directory")
                            (help @askdir-help)
                            (default "Work:")
                        ) "KRSNAke")
)

(set copy-docs (askbool (prompt "\n\n\n\n\nDo you want to install the documentation?")
                        (help @askbool-help))
)

(set languages (askoptions
                    (prompt "Which language catalogs do you want to install?")
                    (help @askoptions-help)
                    (choices "kEwL"
                             "Norsk"
                             "Politically Correct")
                    (default 0)
               )
)

(set opus 0)
(if (exists "DOpus5:")
    (set opus (askbool
        (prompt "\n\n\n\nYou have DOpus 5 installed.\n\nDo you want to install the DOpus 5 button images?")
        (help @askbool-help)
    ))
)
(if opus
    (set opus-dir (askdir
        (prompt "Which directory do you want to copy the images to?")
        (help @askdir-help)
        (default "DOpus5:images")
    ))
)

(makedir @default-dest (infos))

(working "\n\nInstalling KRSNAke...")

(copyfiles (source "KRSNAke")
           (dest @default-dest)
           (infos)
           (prompt "Copying KRSNAke executable...")
           (help @copyfiles-help)
)
(copyfiles (source "KRSNAkePrefs")
           (dest @default-dest)
           (infos)
           (prompt "Copying KRSNAke Prefs Editor...")
           (help @copyfiles-help)
)

(copylib (source "Libs/krsnake.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/gtlayout.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/player61.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/protracker.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)

(makedir (tackon @default-dest "Clients"))

(copyfiles (source "Clients")
           (dest (tackon @default-dest "Clients"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying KRSNAke clients...")
           (help (cat "  Action Replay\n\nThis client records your games and "
                      "offers you the possibility of replaying them at any speed.\n\n"
                      "  Hall Of Fame\n\nThis client provides you with a high score "
                      "table.\n\n" @copyfiles-help))
)

(copyfiles (source "Rexx")
           (dest (tackon @default-dest "Rexx"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying ARexx scripts...")
           (help @copyfiles-help)
)

(if (exists "Graphics")
    (copyfiles (source "Graphics")
           (dest (tackon @default-dest "Graphics"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying graphics...")
           (help @copyfiles-help)
    )
)

(if (exists "Sound")
    (copyfiles (source "Sound")
           (dest (tackon @default-dest "Sound"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying sound samples...")
           (help @copyfiles-help)
    )
)

(if (in languages 0) (
    (if (not (exists "LOCALE:Languages/kewl.language"))
        (copyfiles (source "Languages/kewl.language")
                   (dest "LOCALE:Languages")
                   (prompt "Copying KeWŁ language file...")
                   (help @copyfiles-help)
        )
    )
    (copyfiles (source "Catalogs/kewl")
               (dest "LOCALE:Catalogs/kewl")
               (all)
               (prompt "Copying fŘcKiN KeWŁ catalog...")
               (help @copyfiles-help)
    )
))

(if (in languages 1)
    (copyfiles (source "Catalogs/norsk")
               (dest "LOCALE:Catalogs/norsk")
               (all)
               (prompt "Copying norwegian catalog...")
               (help @copyfiles-help)
    )
)

(if (in languages 2) (
    (if (not (exists "LOCALE:Languages/pce.language"))
        (copyfiles (source "Languages/pce.language")
                   (dest "LOCALE:Languages")
                   (prompt "Copying politically correct language file...")
                   (help @copyfiles-help)
        )
    )
    (copyfiles (source "Catalogs/pce")
               (dest "LOCALE:Catalogs/pce")
               (all)
               (prompt "Copying politically correct catalog...")
               (help @copyfiles-help)
    )
))

(if copy-docs (
        (makedir (tackon @default-dest "Docs"))
        (copyfiles (source "Docs")
                   (dest (tackon @default-dest "Docs"))
                   (infos)
                   (all)
                   (confirm "average")
                   (prompt "Copying documentation...")
                   (help @copyfiles-help)
        )
    )
)

(if opus
    (copyfiles (source "Extras/Opus5")
           (dest opus-dir)
           (infos)
           (all)
           (prompt "Copying DOpus5 button images...")
           (help @copyfiles-help)
    )
)

(if (exists "Src")
    (if (<> user-level "novice")
        (if (askbool (prompt "\n\n\n\n\nDo you want to install the source code (in Amiga-E; Hail Wouter!) and developer information?")
                     (help @askbool-help))
            (
                (makedir (tackon @default-dest "Src"))
                (copyfiles (source "Src")
                           (dest (tackon @default-dest "Src"))
                           (infos)
                           (all)
                           (prompt "Copying source code...")
                           (help @copyfiles-help)
                )
            )
        )
    )
)

(exit "\nRemember:\n\nThis is a BETA version - mail me bug reports!\n\n(Please include reproductions of Enforcer hits if possible)")

