;********************************************************************************
;      ____                        __   __
;     / __ \                      /_/ _/ /_
;    / /_/ /______ ______ ______ __  /  __/
;   / __  // ____// __  // __  // /  / /
;  / /_/ // __/_ / / / // /_/ // /_ / /_
; /_____//_____//_/ /_//_____//___//___/
;
; $VER: Benoit 0.35 (December-12-1997) 
; Installer by Robert C. Reiswig 1997 
; Benoit 1997 by phase5 digital products
;
; If you wish to use any part of this installer you must ask. May not be 
; integrated/placed into any other package! Changes, suggestions or problems:
; vgr@best.com
;********************************************************************************
(set vernum1 (getversion "Benoit"))
(set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
(set Benoitver (cat ver1 "." rev1))
(set where "ram:")

;********************************************************************************
; Set Defaults Strings (English)
;********************************************************************************
(if (= ver1 0) (set Benoitver ""))
(set #about (cat "\nWelcome to Benoit " Benoitver "\nthe Fractal Image Renderer for CyberGraphX.\n\n\nPowerPC\n&\nMC68020/030/040/060 + FPU\n\n\n1997 by phase5 digital products") )
(set #needfpu "\n\nBenoit must have a FPU (Floating Point Unit) to work. The installer has not found a FPU _or_ you are running an older version of the installer that does not have the FPU check option.\n\nIf you have a FPU please press 'Proceed'.")
(set #todo-prompt "\nWhat would you like to do?\n")
(set #copybin " Install/Update Benoit Program") 
(set #copycoords " Copy Coordinate files") 
(set #guide1 " Install Benoit.guide")
(set #whereb "Where would you like to install the selected options? A directory called 'Benoit' will be created there.")
(set #askcpu "\nWhat CPU does the machine have that you are installing Benoit on? The installer has found:\n")
(set #byebye (cat "\nBenoit Install Complete!\n\n" ))

;*********************************************************************************
; German Strings
;*********************************************************************************
(if (= @language "deutsch")
(
 (set #about (cat "\nWillkommen zu Benoit " Benoitver "\ndem Fraktalbildgenerator fr CyberGraphX.\n\n\nPowerPC\n&\nMC68020/030/040/060 + FPU\n\n\n1997 by phase5 digital products") )
 (set #needfpu "\n\nBenoit bentigt eine FPU (Floating Point Unit). Der Installer hat keine FPU gefunden _oder_ Sie haben eine veraltete Version des Installers, die nicht testen kann, ob eine FPU vorhanden ist.\n\nFalls Sie eine FPU haben, drcken Sie bitte 'Weiter'.")
 (set #todo-prompt "\nWas mchten Sie gerne machen?\n")
 (set #copybin " Installieren/Updaten des Benoit-Programms")
 (set #copycoords " Kopieren der Koordinaten-Dateien")
 (set #guide1 " Installieren der Benoit.guide")
 (set #whereb "Wo mchten Sie die ausgewhlten Optionen installieren? Ein Verzeichnis namens 'Benoit' wird dort erzeugt.")
 (set #askcpu "\nWelche CPU hat der Computer, auf dem Sie Benoit installieren mchten? Der Installer hat gefunden:\n")
 (set #byebye (cat "\nBenoit-Installation abgeschlossen!\n\n" ))
)
)

;*********************************************************************************
; Welcome Message
;*********************************************************************************
(message #about)  (welcome)
(set fpu (database "fpu")) (if (= fpu "NOFPU") (message #needfpu))

;*********************************************************************************
; Ask what to do
;*********************************************************************************
(set ToDo (askoptions (choices  #copybin #copycoords #guide1) 
                      (prompt #todo-prompt)
                      (help #todo-prompt)
                      (default whattodo)
          )
) 

;********************************************************************
; Double Check on the CPU
;********************************************************************
(if (OR (IN ToDo 0) (IN ToDo 1) )
 ( 
  (set cpu (database "cpu"))
  (if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 0))
  (if (= cpu 68020) (set #cpu 0)) (if (= cpu 68030) (set #cpu 0))
  (if (= cpu 68040) (set #cpu 0)) 

  (if (= @installer-version 0)
    (if (> (exists ("libs:68060.library")) 0) (set #cpu 0) )
    (if (= cpu 68060) (set #cpu 0))
  )
 
  (if (> (exists ("libs:PPC.library")) 0) (set #cpu 1) )

  (set cpuPick (askchoice (choices "68020/68030/68040/68060 + FPU" "PowerPC - PPC")
                          (prompt #askcpu)
                          (help   #askcpu)
                          (default #cpu)
               )
  )

 )
); END CheckCPU

;*********************************************************************************
; Ask where to put Benoit                                                           
;*********************************************************************************
(if (OR (IN ToDo 0) (IN ToDo 1))
 (
   (set where   (askdir (prompt #whereb)
                        (help   #whereb)
                        (default "RAM:")
                )
   )
 )
)

;********************************************************************
; Copy Benoit bin if wanted 
;********************************************************************
(if (IN ToDo 0) 
 (  
  (if (< (exists (tackon where "Benoit")) 2) (makedir (tackon where "Benoit") (infos)) )
  (set whereBenoit (tackon where "Benoit")) 

  (if (exists "Benoit")
   (if (= (exists (tackon whereBenoit "Benoit.info")) 0)  
     (copyfiles (source "Benoit") (dest whereBenoit) (optional "nofail") (infos))
     (copyfiles (source "Benoit") (dest whereBenoit) (optional "nofail"))
   )

  )
  
  (if (= cpuPick 1) (copyfiles (source "Benoit.elf") (dest whereBenoit) (optional "nofail") (infos)) )
 )
)

;********************************************************************
; Copy Coords
;*******************************************************************
(if (IN ToDo 1) 
 (  
  (if (< (exists (tackon where "Benoit")) 2) (makedir (tackon where "Benoit") (infos)) )
  (if (< (exists (tackon where "Benoit/Coords")) 2) (makedir (tackon where "Benoit/Coords") (infos)) )
 
  (copyfiles (source "Coords") (dest (tackon where "Benoit/Coords")) (all) (infos) (optional "nofail") ) 
 )
)


;********************************************************************
; Copy Coords
;*******************************************************************
(if (IN ToDo 2) 
 (  
  (copyfiles (source "Benoit.guide") (dest whereBenoit) (infos) (optional "nofail") ) 
 )
)

;*********************************************************************************
; Exit                                                           
;*********************************************************************************
(set @default-dest (tackon where "Benoit"))
(if (> (exists ("c:multiview")) 0) (set #mpath "c:") )
(if (> (exists ("sys:Utilities/multiview")) 0) (set #mpath "sys:Utilities") )
(run (cat "run " #mpath "/multiview Benoit.guide") )
(exit #byebye)
