;
; Skript zur Installation von UConv_PBMPGM_Kit 1.02
; Version 1.03, 29.11.98
; Version 1.02, 17.09.98
; Version 1.01, 18.04.98
; Version 1.00, 26.02.98
; (c) 1998 Stefan Diener
;

(set @pretend 0)
(set @user-level 2)
(set @default-dest "")

(complete 0)

(if (= @language "deutsch")
 (
   ; deutsche Textausgaben
   (set #gruss "\n\n\n\nUConv_PBMPGM_Kit 1.02\n© 1998 by Stefan Diener\n\n\nWillkommen zur Installation vom PBM/PGM-Kit 1.02!\nDieses Skript wird die neuen Loader und Saver fuer Ultraconv3/4 auf Ihre Festplatte installieren.\n")
   (set #destimsg "Wo wollen Sie das UConv_PGMPGM_Kit installieren ?")
   (set #fertig "\nDas UConv_PBMPGM_Kit ist nun auf Ihrer Festplatte in folgendem\nVerzeichnis installiert:\n")
   (set #whichcpu "Für welche CPU sollen optimierte Versionen\ninstalliert werden ?")
 )
 (
   ; english text output
   (set #gruss "\n\n\n\nUConv_PBMPGM_Kit 1.02\n© 1998 by Stefan Diener\n\n\nWelcome to the PBM/PGM-Kit 1.02 installation!\nThis script will install the new loaders and savers for Ultraconv3/4 on your harddisk.\n")
   (set #destimsg "Where do you want to install the UConv_PBMPGM_Kit ?")
   (set #fertig "\nThe UConv_PBMPGM_Kit is now installed on your harddisk at:\n")
   (set #whichcpu "For which CPU shall I install an optimised version ?")
 )
)


; kleine Begruessung
(message #gruss
)

(complete 10)

; Zielpfad ermitteln
(set #destidir
  (askdir
    (prompt #destimsg)
    (help @askdir-help)
    (default "UConv:")
  )
)

(complete 30)

(set #loaderspath
  (tackon #destidir "Loaders")
)

(set #saverspath
  (tackon #destidir "Savers")
)

(complete 40)

; automatische Auswahl der CPU
(set #mycpu (database "cpu"))
(if (= #mycpu 68000) (set #cpu 0))
(if (= #mycpu 68010) (set #cpu 0))
(if (= #mycpu 68020) (set #cpu 0))
(if (= #mycpu 68030) (set #cpu 1))
(if (= #mycpu 68040) (set #cpu 1))
(if (= #mycpu 68060) (set #cpu 1))

(if (> (exists ("LIBS:ppc.library")) 0) (set #cpu 2))

; Benutzer nach optimaler Programmvariante fragen
(set #cpuver (askchoice (choices "68000" "68030" "PowerPC")
               (prompt #whichcpu)
               (help   "The 68000 versions will work on all Amigas.\n"
                       "If you have a MC68030 (or higher) use the 68030 versions !\n"
                       "If you are so lucky owning a PPC, select it !\n")
               (default #cpu)
             )
)

(complete 50)

(set #binpath
  (tackon #destidir "Commands")
)

(if (= #cpuver 2)
  (set #binpath
    (tackon #destidir "PPCBin")
  )
)

; jeweilige Programmvariante kopieren
(if (= #cpuver 0)
  ; also nur 68000
  (copyfiles
    (source "Commands")
    (dest #binpath)
    (pattern "#?")
  )
)

(if (= #cpuver 1)
  ; doch schon 68030
  (copyfiles
    (source "Commands.68030")
    (dest #binpath)
    (pattern "#?")
  )
)

(if (= #cpuver 2)
  ; wow, PowerPC
  (copyfiles
    (source "Commands.ppc")
    (dest #binpath)
    (pattern "#?")
  )
)

(complete 70)

(copyfiles
  (source "Loaders")
  (dest #loaderspath)
  (pattern "#?")
)

(complete 85)

(copyfiles
  (source "Savers")
  (dest #saverspath)
  (pattern "#?")
)

(complete 100)

; das war es schon -> Verabschiedung
(message #fertig #destidir "\n\n\nHave fun !"
)
