;
; $VER: Install BurnIT V2.06 (26.10.1998)
; This Install-script contains to BurnIT V2.20 ©1996-1998 by DnS
;
(if (= (exists "Env:Language") 1)
        ; GetEnv reports "String too long" if the variable doesn't exist! :(
        (set @language (getenv "language"))
)

;**************************************************************************
; Procedures
(procedure copy-catalog
        (set catalog
                (tackon "T:Catalogs"
                (tackon language "BurnIT_V2.catalog")
                )
        )
        (set destination (tackon "Locale:Catalogs" language))

        (copyfiles
                (prompt (#copy catalog destination))
                (source catalog)
                (dest   destination)
                (help   @copyfiles-help)
        )
)

;**************************************************************************
; English Installation

(set default-lang 1)

(if (= @language "français")
        (set default-lang 4)
)

(set #bad-kick
        "You must have AmigaOS Release 3.0 or newer to use BurnIT V2.0."
)

(set #bad-cpu
        "You must have a 68020 CPU or biger to use BurnIT V2.0."
)

(set #welcome
        (cat
                "\n\n\nBurnIT V2.0\n\n"
                "Cracked by Lightforce 1999"
        )
)

(set #install-parts "Please select the parts you wish to install")

(set #item-BurnIT_V2 "BurnIT_V2")

(set #item-BurnIT_V2-guide "T:BurnIT_E_V2.guide")

(set #item-locale "Translations")

(set #item-prefs "Clear old prefs")

(set #where-BurnIT_V2
        (cat
                "Where do you wish to install BurnIT V2.0.\n The directory 'BurnIT_V2' will be created if it is not there."
        )
)

(set #which-language "Which languages should be installed?")

(set #copy "Copying %s to %s...")

(set #help "no help available...")


;**************************************************************************
; Deutsche Installation

(if (= @language "deutsch")
        (
                (set default-lang 2)

                (set #bad-kick
                        (cat
                                "Tut mir Leid!\n"
                                "Aber Sie müßen AmigaOS Release 3.0 oder neur haben für BurnIT V2.0."
                        )
                )
                (set #bad-cpu
                        (cat
                                "Tut mir Leid!\n"
                                "Aber Sie müßen eine 68020 CPU oder größer haben für BurnIT V2.0."
                        )
                )
                (set #welcome
                        (cat
                                "\n\n\nBurnIT V2.2.3\n\n"
                                "Cracked by Lightforce 1999."
                        )
                )

                (set #install-parts "Wählen Sie bitte die Teile, die Sie installieren wollen.")

                (set #item-BurnIT_V2 "BurnIT_V2")

                (set #item-BurnIT_V2-guide "T:BurnIT_D_V2.guide")

                (set #item-locale "Kataloge")

                (set #item-prefs "Lösche alte Preferences")

                (set #where-BurnIT_V2 "Wo wollen sie BurnIT V2.0 installieren ?\n Ein Verzeichnis 'BurnIT_V2' wird erstellt.")

                (set #which-language "Welche Sprachen sollen installiert werden?")

                (set #copy "Kopiere %s nach %s...")

                (set #help "Keine Hilfe verfügbar...")


        )
)

;**************************************************************************
; the installaion script

(set @default-dest "")
;(set @default-source "BurnIT_V2.0_Disk1:")

; Check Kickstart version. Exit if not at least 3.0
(if (< (/ (getversion) 65536) 39)
        (abort #bad-kick)
)

; Check CPU. Exit if < 60020
(if (patmatch "68020" (database "cpu"))
        (abort #bad-cpu)
)

(message #welcome)

(welcome)

(set install-files
        (askoptions
                (prompt #install-parts)
                (help   @askoptions-help)
                (choices
                        #item-BurnIT_V2
                        #item-BurnIT_V2-guide
                        #item-locale
                        #item-prefs
                )
                (default 15)
        )
)

(if (IN install-files 0)
        (set BurnIT_V2-dest
                (askdir
                        (prompt  #where-BurnIT_V2)
                        (help    @askdir-help)
                        (default "Work:")
                )
        )
)

(set where BurnIT_V2-dest)

(if
        (<
                (exists
                        (tackon BurnIT_V2-dest "BurnIT_V2")
                )
        2)
        (makedir
                (tackon BurnIT_V2-dest "BurnIT_V2")
                (infos)
        )
)

(if
        (<
                (exists
                        (tackon BurnIT_V2-dest "BurnIT_V2/Operators")
                )
        2)
        (makedir
                (tackon BurnIT_V2-dest "BurnIT_V2/Operators")
                (infos)
        )
)

(if
        (<
                (exists
                        (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Drivers")
                )
        2)
        (makedir
                (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Drivers")
                (infos)
        )
)

(if
        (<
                (exists
                        (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Sfx")
                )
        2)
        (makedir
                (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Sfx")
                (infos)
        )
)


(set where (tackon BurnIT_V2-dest "BurnIT_V2"))
(set drivers (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Drivers"))
(set operators (tackon BurnIT_V2-dest "BurnIT_V2/Operators"))
(set sfx (tackon BurnIT_V2-dest "BurnIT_V2/BurnIT_Sfx"))

(set @default-dest where)

(if (IN install-files 1)
        (set guide-dest @default-dest)
)

(set languages 0)

(if (IN install-files 2)
        (set lang
                (askoptions
                        (prompt  #which-language)
                        (help    @askoptions-help)
                        (choices
                                "English"
                                "Deutsch"
                                "French (Zafer Kantar)"
                        )
                        (default default-lang)
                )
        )
)

; And now do the actual installation

(complete 0)

(if (IN install-files 0)
        (copyfiles
                (prompt #copy "BurnIT V2.0")
                (help @copyfiles-help)
                (source "BurnIT_V2.0_Disk2:BurnIT_V2")
                (dest "T:")
                (infos)
                (confirm)
        )
)
(complete 25)


(if (IN install-files 0)
        (copyfiles
                (prompt (#copy "BurnIT V2.0" @default-dest))
                (source "T:BurnIT_V2")
                (dest   @default-dest)
                (help   @copyfiles-help)
                (infos)
                (noposition)
                (confirm)
        )
)

(if (IN install-files 0)
        (delete "T:BurnIT_V2"
                (delopts (infos))
        )
)

(if (IN install-files 0)
        (copylib
                (prompt (#copy "dragdrop.library" "Libs:"))
                (help @copylib-help)
                (source "BurnIT_V2.0_Disk1:libs/dragdrop.library")
                (dest "Libs:")
                (confirm)
        )
)
(complete 30)

(if (IN install-files 0)
        (copyfiles
                (source "BurnIT_V2.0_Disk1:c/lhex")
                (dest "T:")
                (nogauge)
        )
)

(if (IN install-files 0)
        (copyfiles
                (source "BurnIT_V2.0_Disk1:BurnIT_AddOn.lha")
                (dest "T:")
                (nogauge)
        )
)

(complete 35)

(if (IN install-files 0)
        (working "Decompressing AddOns...\n\n\n")
)

(if (IN install-files 0)
        (run "T:lhex >NIL: <NIL: -qfw=T: x T:BurnIT_AddOn.lha")
)

(complete 40)

(if (IN install-files 0)
        (copyfiles
                (prompt (#copy "Drivers" @default-dest))
                (source "T:BurnIT_Drivers")
                (all)
                (dest   drivers)
                (help   @copyfiles-help)
                (confirm)
        )
)

(if (IN install-files 0)
        (copyfiles
                (prompt (#copy "Operators" @default-dest))
                (source "T:Operators")
                (all)
                (dest   operators)
                (help   @copyfiles-help)
                (confirm)
        )
)

(complete 45)

(if (IN install-files 0)
        (copyfiles
                (prompt (#copy "Sfx" @default-dest))
                (source "T:BurnIT_Sfx")
                (all)
                (dest   sfx)
                (help   @copyfiles-help)
                (confirm)
        )
)

(complete 50)

(if (IN install-files 1)
        (
                (copyfiles
                        (prompt (#copy #item-BurnIT_V2-guide guide-dest))
                        (source #item-BurnIT_V2-guide)
                        (help   @copyfiles-help)
                        (dest   guide-dest)
                        (newname "BurnIT_V2.guide")
                        (noposition)
                        (infos)
                        (confirm)
                )
        )
)

(complete 75)

(if (IN install-files 2)
        (
                (if (IN lang 1)
                        (
                                (set language "deutsch")
                                (copy-catalog)
                        )
                )
                (if (IN lang 2)
                        (
                                (set language "français")
;                               (copy-catalog)
                        )
                )
        )
)
(set BurnITicon_V2-dest (tackon @default-dest "BurnIT_V2"))

(complete 90)

(if (IN install-files 3)
        (
                (if
                        (=
                                (exists (tackon @default-dest "Settings_V2/BurnITPrefs.pref"))
                        1)
                        (delete (tackon @default-dest "Settings_V2/BurnITPrefs.pref"))
                )
                (if
                        (=
                                (exists (tackon @default-dest "Settings_V2/BurnITISOPrefs.pref"))
                        1)
                        (delete (tackon @default-dest "Settings_V2/BurnITISOPrefs.pref"))
                )
        )
)

(complete 95)

; Clean Up

(delete "T:" (all) (safe))

(complete 100)
(exit)

