;
;   Installation script for Abacus
;   Copyright  1995-96 Kai Nickel
;
;   Last Change: 96-12-07
;


;*******************************************************************************
;                     Language depending strings
;*******************************************************************************

(complete 0)

(set #LANG
  (askchoice (prompt "Whlen Sie ihre bevorzugte Sprache:\nSelect your preferred Language:")
             (help "Whlen Sie hier Ihre bevorzugte Sprache fr Abacus, die Anleitung und die weitere Installation.\n\n\n"
                   "Please select your prefered language for Abacus, the documentation and the further installation.")
             (choices "deutsch" "english")
             (default 0)
  )
)

(if (= #LANG 0)
  (
    ;
    ; ***** DEUTSCH
    ;
    (set #MSG_MUI        "Sie haben MUI gar nicht oder in einer veralteten Version installiert.\n Abacus bentigt MUI 3.3 oder hher.\n\nSie knnen Abacus trotzdem installieren, aber es wird erst laufen, wenn Sie eine aktuelle MUI-Version installieren.\n")
    (set #MSG_PATH       "Whlen Sie das Verzeichnis, in dem die Schublade 'Abacus' erzeugt werden soll.")
    (set #MSG_PATH_HELP  "Im gewhlten Pfad wird ein neues Verzeichnis namens 'Abacus' erzeugt, in das Abacus und die zugehrigen Dateien kopiert werden.\nEs werden etwa 90KB fr die Installation bentigt.\n\nSie knnen mit 'Make New Drawer' auch zuerst ein neues Verzeichnis erstellen.\n")
    (set #MSG_MAIN       "Installieren des Hauptprogramms 'Abacus'")
    (set #MSG_MAIN_HELP  "Das Hauptprogramm von Abacus. Die Dokumentation mu sich spter im selben Verzeichnis befinden.\n")
    (set #MSG_GUIDE      "Installieren der Dokumentation 'Abacus.guide'")
    (set #MSG_GUIDE_HELP "'Abacus.guide' ist Dokumentation und gleichzeitig Online-Hilfe fr Abacus.\nSie mu in das gleiche Verzeichnis wie das Hauptprogramm.")
    (set #MSG_GAMEDIR    "Erzeuge 'Game' Verzeichnis fr Spielstnde")
    (set #MSG_ICONS      "Was fr Icons mchten sie?")
    (set #MSG_ICONS_HELP "Fr die installierten Abacus-Files stehen Piktogramme im MagicWB-Stil zur Verfgung.\n\nWenn sie kein MagicWB installiert haben, sollten sie diese Icons auch nicht verwenden.\n(MagicWB ist eine Workbench-Erweiterung von Martin Huttenloher.)")
    (set #MSG_DOICONS    "Kopieren der MagicWB-Icons.")

    (set #MSG_CAT        "Den deutschen 'Abacus.catalog' installieren.")
    (set #MSG_CATDIR     "Verzeichnis fr deutschen Katalog erzeugen.")
    (set #MSG_CAT_HELP   "Der Abacus.catalog enthlt alle deutschen Programmtexte. Wer ihn nicht installiert, mu Abacus in Englisch ertragen.\n\nKataloge werden erst ab AmigaOS2.1 untersttzt.\n")
    (set #NAME_CATDIR    "Catalogs/Deutsch")

    (set #NAME_GUIDE     "Docs/Deutsch/Abacus.guide")
  )
  (
    (set #MSG_MUI        "You do not have MUI (or only an outdated version of it).\nAbacus need MUI 3.3 or higher.\n\nYou can install Abacus now, but it will not work until you install a new version of MUI, too.\n")
    (set #MSG_PATH       "Choose the path where the new drawer 'Abacus' should be created.")
    (set #MSG_PATH_HELP  "In the choosen path a new drawer named 'Abacus' will be created, in which Abacus and its files will be copied.\nAbout 90KB will be needed for the installation.\n\nYou also may create a new drawer via 'Make New Drawer' before.\n")
    (set #MSG_MAIN       "Install the main program 'Abacus'")
    (set #MSG_MAIN_HELP  "The main program of Abacus. The documentation has to be in the same drawer.\n")
    (set #MSG_GUIDE      "Install the documentation 'Abacus.guide'")
    (set #MSG_GUIDE_HELP "'Abacus.guide' is the documentation and online-help for Abacus.\nIt must be placed into the same drawer as the main program.\n")
    (set #MSG_GAME       "Create 'Game' drawer for saved games")
    (set #MSG_ICONS      "What icons do you want?")
    (set #MSG_ICONS_HELP "For the Abacus-files exist icons in ths MagicWB-style.\n\nIf you do not have MagicWB, you also should not install these icons.\n(MagicWB is a Workbench-enhancment by Martin Huttenloher.)")
    (set #MSG_DOICONS    "Install the MagicWB-icons.")

    (set #NAME_GUIDE     "Docs/English/Abacus.guide")
  )
)


;*******************************************************************************
;                               Check MUI
;*******************************************************************************

(complete 10)

(if (exists ("LIBS:Muimaster.library"))
  (
    (set #MUIVER (/ (getversion "LIBS:Muimaster.library") 65536))
    (if (< #MUIVER 11)
      (message #MSG_MUI)
    )
  )
  (message #MSG_MUI)
)



;*******************************************************************************
;                          Get and create path
;*******************************************************************************

(complete 20)

(set #DESTINATION
  (askdir (prompt  #MSG_PATH)
          (help    #MSG_PATH_HELP)
          (default @default-dest)
  )
)

(set #DESTINATION (tackon #DESTINATION "Abacus"))

(set @default-dest #DESTINATION)

(makedir #DESTINATION
  (help @makedir-help)
  (infos)
)



;*******************************************************************************
;                          Ask for icons
;*******************************************************************************

(set #ICONS
  (askchoice (prompt  #MSG_ICONS)
             (help    #MSG_ICONS_HELP)
             (choices "Standard" "MagicWB")
             (default 0)
  )
)



;*******************************************************************************
;                      Copy Main program and guide
;*******************************************************************************

(complete 30)

(copyfiles (prompt #MSG_MAIN)
           (source "Abacus")
           (dest #DESTINATION)
           (confirm)
           (infos)
           (noposition)
           (help #MSG_MAIN_HELP)
)

(complete 50)

(copyfiles (prompt #MSG_GUIDE)
           (source #NAME_GUIDE)
           (dest   #DESTINATION)
           (confirm)
           (infos)
           (noposition)
           (help #MSG_GUIDE_HELP)
)



;*******************************************************************************
;                             Copy Catalog
;*******************************************************************************

(complete 60)

(if (= #LANG 0)
  (
    (makedir (tackon #DESTINATION "Catalogs")
             (help @makedir-help)
             (confirm)
             (infos)
             (prompt #MSG_CATDIR)
    )

    (copyfiles (dest   (tackon #DESTINATION #NAME_CATDIR))
               (source (tackon #NAME_CATDIR "Abacus.catalog"))
               (prompt #MSG_CAT)
               (help #MSG_CAT_HELP)
               (confirm)
    )
  )
)



;*******************************************************************************
;                             Make game drawer
;*******************************************************************************

(complete 70)

(makedir (tackon #DESTINATION "Games")
         (help @makedir-help)
         (infos)
         (prompt #MSG_GAMEDIR)
         (confirm)
)



;*******************************************************************************
;                             Copy icons
;*******************************************************************************

(complete 80)

(if (= #ICONS 1)
  (
    (copyfiles (prompt  #MSG_DOICONS)
               (source  "MWBIcons/")
               (dest    #DESTINATION)
               (pattern "Abacus#?")
    )

    (copyfiles (prompt #MSG_DOICONS)
               (source "MWBIcons/Games.info")
               (dest   #DESTINATION)
    )

    (if (= #LANG 0)
      (copyfiles (prompt #MSG_DOICONS)
                 (source "MWBIcons/Catalogs.info")
                 (dest   #DESTINATION)
      )
    )

    (run (cat "copy " "MWBIcons/Drawer.info \"" #DESTINATION ".info\""))
  )
)



;*******************************************************************************
;                             Goodbye
;*******************************************************************************

(complete 100)
(exit)
