; Installation script for PetitChimiste
; $VER: Install-PetitChimiste 1.0 (21/02/97)

(set @default-dest "SYS:")
(set default_lang 1)

(if (< (/ (getversion) 65536) 39)
  (abort "This program requires Kickstart 3.0 or greater to run !")
)

(if (= 0 (exists "Libs:ixemul.library" (noreq)))
  (abort (cat
                "PetitChimiste requires ixemul.library V41.3 or better.\n"
                "Currently ixemul.library is not installed. Sorry.\n\n"
                "ixemul.library can be found in Aminet:dev/gcc/\n"
              )
  )
)


(set destdir
  (askdir
    (prompt "Select where to install PetitChimiste.\nA new drawer will be created.")
    (help @askdir-help)
    (default @default-dest)
    (newpath)
  )
)

(set @default-dest
  (tackon destdir "PetitChimiste")
)

(makedir @default-dest
  (prompt "Creating Drawer PetitChimiste")
  (help @makedir-help)
  (infos)
)

(set program
        (askchoice
                (prompt "Which program should be installed ?")
                (help @askchoice-help)
                (choices "68020 IEEE  (ixemul.library required)" "68030 68881 (ixemul.library required)" "68040       (ixemul.library required)")
                (default 0)
        )
)

(copylib
  (prompt "Installing PetitChimiste")
  (help @copylib-help)
  (source (select program
                "bin/68020IEEE/PetitChimiste"
                "bin/6803068881/PetitChimiste"
                "bin/68040/PetitChimiste"
          )
  )
  (dest @default-dest)
  (infos)
)

(set lang
  (askoptions
    (prompt "Which languages should be installed ?")
    (help @askoptions-help)
    (choices
        "English"
        "Français"
        "Deutsch"
        "Italiano"
        "Español"
    )
    (default 1)
  )
)

(set n 0)
(while (set language
    (select n
       "english"
       "français"
       "deutsch"
       "italiano"
       "español"
       "")
  )
  (
    (if (IN lang n)
      (
        (if (<> 0 n)
          (
            (set catalog_dir (cat "catalogs/" language))
            (set locale_dir  (cat "locale:catalogs/" language))

            (copyfiles
              (prompt "Installing Catalogs")
              (source catalog_dir)
              (dest locale_dir)
              (all)
            )
          )
        )
      )
    )
    (set n (+ n 1))
  )
)

(set lang
  (askoptions
    (prompt "Which Guide should be installed ?")
    (help @askoptions-help)
    (choices
        "English"
        "Français"
        "Español"
    )
    (default 1)
  )
)

(makedir (tackon @default-dest "Guides") (infos))
(set n 0)
(while
  (set language
    (select n  "english"
;               "deutsch"
               "français"
;               "italiano"
               "español"
               "")
  )
  (
    (if (IN lang n)
      (
        (set guides_dir (cat "Guides/" language))
        (copyfiles
          (prompt "Installing Guides")
          (source guides_dir)
          (dest (tackon @default-dest "Guides"))
          (all)
        )
      )
    )
    (set n (+ n 1))
  )
)

(makedir (tackon @default-dest "Molecules") (infos))
(copyfiles
  (prompt "Installing Molecules")
  (help @copyfiles-help)
  (source "Molecules")
  (dest (tackon @default-dest "Molecules"))
  (all)
)
