;*****************************************************************************
;    ______        __                  ______                     __  __   __
;   / __  /       / /                 / __  /      Update        / /  \ \ / /
;  / /  -'__  __ / /___ ______ _____ / /_ -'_____ ______ ______ / /__  \ \ /
; / /     \ \/ // __  // ____// .__// // \ / .__// __  // __  // __  / /  / V4
;/ /___    \  // /_/ // __/_ / /   / /_/ // /   / __  // /_/ // / / / / \ \
;\____/    / //_____//_____//_/   /_____//_/   /_/ /_// ____//_/ /_/ /_/ \_\
;         /_/                                        / /
;                                                   /_/
; S3           : CyberVision64/3D, CyberVision64
; Cirrus Logic : Picasso II(+), Picasso IV, Spectrum, Piccolo, Piccolo SD64, Inferno
; Symbios (NCR): Retina BLT Z3
; Texas Inst.  : CyberVisionPPC (Permedia), BlizzardVisionPPC (Permedia)
;          
; CyberGraphX V4 1998 Vision Factory Development
; CyberGraphX V4 Update/Upgrade Installer 1995,1996,1997,1998 by Robert C. Reiswig 
; $VER: V0.75 (October-22-1998)
; 
; If you wish to use any part of this installer you must ask. May not be 
; integrated/placed into any other package! You may NOT change this in an way!
; You man NOT take or use the ENV definitions and use them without direct
; permission from me! Changes, suggestions or problems: robr@phase5.de or vgr@best.com
;********************************************************************************



;********************************************************************************
; Cyber Release & Boards
;********************************************************************************
(set @user-level 2)
(set #cyberver "V4 42.0")
(set NoBoard 0)
(set whereback "SYS:Storage")
(message (cat "\nCyberGraphX " #cyberver "\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
              "CyberVisionPPC & BlizzardVisionPPC\n\nCyberVision64/3D & CyberVision64\n\nPicasso II(+) & Picasso IV & Inferno\n\n"
              "Piccolo & Piccolo SD64 & Spectrum 28/24\n\nRetina BLT Z3"
         )
)

(welcome)
;********************************************************************************
; Read All System information
;********************************************************************************
(set cpu (database "cpu")) (if (> (exists ("sys:libs/68060.library")) 0) (set cpu "68060") )
(set vblank (database "vblank")) (set graphmem (database "graphics-mem"))
(set totmem (database "total-mem")) (set osver (/ (getversion "LIBS:version.library") 65536))
(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))
( if (= osver 37) ( (set workbench "2.0")) ( if (= osver 38) ( (set workbench "2.1"))
( if (= osver 39) ( (set workbench "3.0")) ( if (= osver 40) ( (set workbench "3.1"))
( if (= osver 41) ( (set workbench "3.2")) )))))
(set cgx_root "CGraphX4")
(set pick 0)

;********************************************************************************
;English Strings
;********************************************************************************
(set #askzorro "\nWhat type of machine is CyberGraphX V4 installed on?\n")
(set #askcpu "\nWhat CPU does the machine have that you are updating CyberGraphX V4 on? The installer has found:\n")
(set #wherelibs "Where are your CyberGraphX V4 libraries located? The default is 'SYS:Libs'")
(set #todo-prompt "\nDo you wish to install:\n")
(set #cgxmode-todo " CGXMode - Create & Change Screen Modes")
(set #wheremode "Where do you wish to copy the CGXMode Program?")
(set #whereshowcgxconfig "Where do you wish to copy the ShowCGXconfig Program?")
(set #showcgxconfig " ShowCGXconfig - CGX Info Program")

;*********** NEW English Strings:  Monday 01-Dec-97 *************************
(set #nocgxmode "\n\nOne of the graphic card(s) you selected does not currently support the use of CGXMode.\n\nA2410 or AGA(PPC)\n\nCGXMode can be use with all of the other CyberGraphX supported cards!")

;*********** NEW English Strings:  Wednesday 21-Jan-98 **********************
(set #updatep4flash "\nTo use CyberGraphX with the Picasso IV you should be running version 2.0 or greater of the Picasso IV FlashROM.\n\nThe installer has found a version lower then 2.0.\n\nForm more information and newer FlashROMs you can contact:\nYour Dealer\nVillage Tronic\nVillage Tronic Web site\n")

;*********** NEW English Strings:  Wednesday 11-Mar-98 **********************
(set #noppc1 "\n\nYou selected the PPC option for one of your CPUs. The installer did not find the 'libs:PPC.library'.\n\nCyberGraphX may not work correctly.\n\n Do you wish to reselect the CPU type?")
(set #noppcaga "\nYou selected the 'AGA (PPC Only)' option when picking what graphics card (display device) to use with CyberGraphX. The installer did not find the 'libs:PPC.library'.\n\n The AGACGX driver needs a PPC card installed to work correctly.\n\nDo you wish to Abort the install now?.")
(set #agaquit "\nCyberGraphX install/update exiting.")

;*********** NEW English Strings:  Thursday 22-Oct-98 **********************
(set #needcd "\n\n\nPlease place your CyberGraphX V4 CDROM into your CDROM drive to continue.")
(set #nobackup "\n\nThis installer will copy the correct new V4 Libs and Monitor to the correct places. It will also upgrade a _working_ V3 system to a V4 system. It does not do any back up currently.\n\nThis will not install V4 for the first time, it just _updates_ or _upgrades_ a CGX V3/V4 system.")
(set #whatboard (cat "Please Select the Graphics Board you wish to update CyberGraphX Monitor File for. (*=Not Supported)"))
(set #guide " CGX Docs - AmigaGuide file")
(set #commy " CyberGraphX - Settings Tool")
(set #wheredocs "Where do you wish to install the CGX AmigaGuide file?")
(set #wherecomm "Where do you wish to install the CGX Settings Tool?")
(set #By (cat "\n\nCyberGraphX\n\nRelease Version " #cyberver "\n\n\n\n"
              "1998 by:\n\nVision Factory Development"
          
         )
)

;********************************************************************************
;German Strings by the King!
;********************************************************************************
(if (= @language "deutsch")
(
 (set #nobackup "\n\nDieses Installationsskript kopiert die neuen V4 Bibliotheken und Monitore in die entsprechenden Verzeichnisse. Es wird keine Sicherung vorgenommen.\n\nEs ist keine V4 Erstinstallation, das V4 System wird nur _erneuert_ . Ein V2->V4 Update ist aber bereits in Arbeit.")
 (set #askzorro "\nWelche Erweiterungsslots besitzt der Computer, auf dem Sie CyberGraphX V4 installieren ?\n")
 (set #askcpu "\nWelchen Prozessor besitzt der Computer, auf dem Sie CyberGraphX V4 installieren wollen ? Der installer hat folgendes gefunden:\n")
 (set #wherelibs "Wo befinden sich die CyberGraphX V4 Bibliotheken ? Standard ist 'SYS:Libs'")
 (set #whatboard (cat "Bitte whlen Sie die Grafikkarte, deren CyberGraphX Monitordatei erneuern wollen:"))
 (set #todo-prompt "\nWelches der folgenden Programme wollen Sie installieren: ?\n")
 (set #cgxmode-todo " CGXMode - Erstellen & ndern von Bildschirmmodis")
 (set #wheremode "Wohin wollen Sie das CGXMode Programm kopiert haben?")
 (set #whereshowcgxconfig "Wohin wollen Sie das ShowCGXconfig Programm kopiert haben?")
 (set #showcgxconfig " ShowCGXconfig - CyberGraphX Informationsprogramm")

;*********** NEW German Strings:  Monday 01-Dec-97 *************************
 (set #nocgxmode "\n\nEine/Mehrere Grafikkarte(n), die Sie ausgewhlt haben, wird/werden von CGXMode momentan nicht untersttzt.\n\nA2410 oder AGA(PPC)\n\nCGXMode kann mit allen anderen Karten, die CyberGraphX untersttzt, jedoch benutzt werden!")

;*********** NEW German Strings:  Wednesday 11-Mar-98 **********************
 (set #noppc1 "\n\nYou selected the PPC option for one of your CPUs. The installer did not find the 'libs:PPC.library'.\n\nCyberGraphX may not work correctly.\n\n Do you wish to reselect the CPU type?")
 (set #noppcaga "\nYou selected the 'AGA (PPC Only)' option when picking what graphics card (display device) to use with CyberGraphX. The installer did not find the 'libs:PPC.library'.\n\n The AGACGX driver needs a PPC card installed to work correctly.\n\nDo you wish to Abort the install now?.")
 (set #agaquit "\nCyberGraphX Installation/Erneuerung endet.")

;*********** NEW German Strings:  Wednesday 21-Jan-98 **********************
 (set #updatep4flash "\nUm CyberGraphX3 mit der PicassoIV zu benutzen, sollten sie auf jeden Fall die Version 2.0 oder grer des PicassoIV FlashROMs installieren.\n\nDas Installationsskript entdeckte eine ltere Version.\n\nFr weitere Informationen und eine neuere FlashROM Version kontaktieren Sie bitte:\nIhren Hndler\nVillageTronic\ndie VillageTronic WWW Seite\n")

;*********** NEW German Strings:  Thursday 22-Oct-98 **********************
 (set #needcd "\n\n\nBitte legen Sie die CyberGraphX V4 CDROM in das CDROM Laufwerk ein, um fortzufahren.")
 (set #nobackup "\n\nDieses Installationsskript kopiert die neuen V4 Bibliotheken and Monitortreiber in die entsprechenden Verzeichnisse. Es erneuert ebenso ein _vorhandenes_ V3 System auf V4. Es wird keine Sicherung der alten Dateien vorgenommen.\n\nDieses Skript kann nicht zur Erstinstallation verwendet werden, es _erneuert_ lediglich ein CGX V3/V4 System.")
 (set #whatboard (cat "Bitte whlen Sie die Grafikkarte, deren CyberGraphX Monitortreiber Sie erneuern wollen. (*=Nicht untersttzt)"))
 (set #guide " CGX Dokumentation - AmigaGuide Datei")
 (set #commy " CyberGraphX - Einstellungs-Commodity")
 (set #wheredocs "Wohin wollen Sie die CyberGraphX4 AmigaGuide Dokumentation installieren ?") 
 (set #wherecomm "Wohin wollen Sie das CyberGraphX Commodity installieren ?")
 (set #By (cat "\n\nCyberGraphX\n\nRelease Version " #cyberver "\n\n\n\n"
              "1998 by:\n\nVision Factory Development"
          )
 )
)
)
;********************************************************************************
; French Strings by Gregory Eycken <geycken@geocities.com>
;********************************************************************************
(if (= @language "franais")
(
 (set #nobackup "\n\nCe script d'installation va copier les nouvelles bibliothques et les nouveaux moniteurs de CyberGraphX V4 aux endroits adquats. Il n'effectuera aucun archivage.\n\nCe script n'est pas prvu pour installer CyberGraphX V4 pour la premire fois, il ne peut faire que la _mise  jour_ d'un systme CyberGraphX V4 existant.\nUne mise  jour V2->V4 est  l'tude.")
 (set #askzorro "\nSur quel type d'ordinateur CyberGraphX V4 est-il install?\n")
 (set #askcpu "\nQuel est le processeur de l'ordinateur sur lequel vous voulez mettre  jour CyberGraphX V4? L'installeur a trouv :\n")
 (set #wherelibs "O sont installes les bibliothques de CyberGraphX V4? Par dfaut, c'est 'SYS:Libs'.")
 (set #whatboard (cat "Veuillez slectionner la carte graphique dont vous voulez mettre le fichier moniteur  jour :"))
 (set #todo-prompt "\nDsirez-vous installer :\n")
 (set #cgxmode-todo " CGXMode - Crer et modifier les modes d'cran")
 (set #wheremode "O dsirez-vous installer le programme CGXMode?")
 (set #whereshowcgxconfig "O dsirez-vous installer le programme ShowCGXconfig?")
 (set #showcgxconfig " ShowCGXconfig - Programme d'informations CyberGraphX")
)
)

;********************************************************************************
; Start Update
;********************************************************************************
;**CD CHECK
;(askdisk (dest "CyberGraphX_4") (prompt #needcd) (help #needcd) )
;(message #by)
;(message #nobackup)
;******

;*******************************************************************
; ASK what board to update
;*******************************************************************
(set BGuess 0) (set AGA 0)

(if (> (exists ("devs:monitors/CVision3D")) 0)  (set BGuess (+ BGuess 1)) )
(if (> (exists ("devs:monitors/CVision64")) 0)  (set BGuess (+ BGuess 2)) )
(if (> (exists ("devs:monitors/PicassoII")) 0)  (set BGuess (+ BGuess 4)) )
(if (> (exists ("devs:monitors/Spectrum")) 0)   (set BGuess (+ BGuess 8)) )
(if (> (exists ("devs:monitors/Piccolo")) 0)    (set BGuess (+ BGuess 16)) )
(if (> (exists ("devs:monitors/PiccoSD64")) 0)  (set BGuess (+ BGuess 32)) )
(if (> (exists ("devs:monitors/Inferno")) 0)    (set BGuess (+ BGuess 64)) )
(if (> (exists ("devs:monitors/PicassoIV")) 0)  (set BGuess (+ BGuess 128)) )
(if (> (exists ("devs:monitors/CGXAGA")) 0)     (set BGuess (+ BGuess 256)) )
(if (> (exists ("devs:monitors/RetinaZ3")) 0)   (set BGuess (+ BGuess 512)) )
(if (> (exists ("devs:monitors/A2410")) 0)      (set BGuess (+ BGuess 1024)) )
(if (> (exists ("devs:monitors/CVisionPPC")) 0) (set BGuess (+ BGuess 2048)) )
(if (> (exists ("devs:monitors/BVisionPPC")) 0) (set BGuess (+ BGuess 4096)) )

  (set board (askoptions (choices  " CyberVision64/3D" " CyberVision64" " PicassoII(+)" " Spectrum 28/24"
                                   " Piccolo" " Piccolo SD64" " Inferno" " Picasso IV" " *AGA (PPC Only)"
                                   " Retina BLT Z3" " *A2410" " CyberVisionPPC" " *BlizzardVisionPPC"
                          (prompt #whatboard)
	                  (help #whatboard)
                          (default BGuess)
                         )
             )     
  )


;********************************************************************
; Double Check on the CPU
;********************************************************************
(procedure askaboutcpu

(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 1)) (if (= cpu 68060) (set #cpu 1)) 
(if (= @installer-version 0)
  (if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 1) )
  (if (= cpu 68060) (set #cpu 1))
)
;;(if (> (exists ("libs:PPC.library")) 0) (set #cpu 2) )

(set cpuPick (askchoice (choices "68020 or 68030" "68040 or 68060") ; "PPC with 68040 or 68060")
			(prompt #askcpu)
	                (help   #askcpu)
          		(default #cpu)
	  )
)

(if (= cpuPick 0) ((set cpuadd ".020") (set cpuadd-1 ".020")) ) 
(if (= cpuPick 1) ((set cpuadd ".040") (set cpuadd-1 ".040")) )
;;(if (= cpuPick 2) ((set cpuadd ".040") (set cpuadd-1 ".ppc")) )

)

(askaboutcpu)

;*******************************************************************
; Check on PPC
;*******************************************************************
;(set redocpu 0)
;(if (AND (= (exists ("libs:PPC.library")) 0) (= cpuPick 2)) 
; (set redocpu     (askbool (prompt #noppc1)
;			   (help   #noppc1)
; 		          
;	          )
; )
;)

;(if (= redocpu 1) (askaboutcpu))

;(set agaquit 0)
;(if (AND (= (exists ("libs:PPC.library")) 0) (IN board 8)) 
; (set agaquit     (askbool (prompt #noppcaga)
;			   (help   #noppcaga)
; 		          
;	          )
; )
;)

;(if (= agaquit 1) (abort #agaquit))
 

;*******************************************************************
;  ASK where cybergfx libs are
;*******************************************************************
(set wherelibs   (askdir (prompt #wherelibs)
			 (help   #wherelibs)
 		         (default "SYS:Libs")
		 )
)

;*******************************************************************
;  Copy libs if there
;*******************************************************************
(if (exists (tackon cgx_root (tackon "cgxsystemlib" (cat "cgxsystem.library" cpuadd-1))) )
  (copyfiles (source (tackon cgx_root (tackon "cgxsystemlib" (cat "cgxsystem.library" cpuadd-1))) ) (dest wherelibs) (newname "cgxsystem.library") (optional "nofail") ) 
)

(if (exists (tackon cgx_root (tackon "cgxmpeglib" (cat "cgxmpeg.library" cpuadd))) )
  (copyfiles (source (tackon cgx_root (tackon "cgxmpeglib" (cat "cgxmpeg.library" cpuadd))) ) (dest wherelibs) (newname "cgxmpeg.library") (optional "nofail") ) 
)


(if (AND (exists (tackon cgx_root "cgxbootpiclib/cgxbootpic.library")) (= 0 (exists "libs:cgxbootpic.library")) )
  (copyfiles (source (tackon cgx_root"cgxbootpiclib/cgxbootpic.library")) (dest wherelibs) (optional "nofail") ) 
)

;*******************************************************************
;  Installer monitor file and handle extra libs 
;*******************************************************************
  (if (IN board 0)
   (
     (set error (run (tackon cgx_root "tools/ChkCV3DZorro")))  ; 0 Z3, 5 Z2 
     (if (= error 0) (set guessZ 1) (set guessZ 0) )
  
     (set pickZ (askchoice (choices "zorro2 - Amiga 2000/zorro2 Expansion Box" "zorro3 - Amiga 3000(T)/4000(T)")
	                   (prompt #askzorro)
	                   (help   #askzorro)
                           (default guessZ)
                )
     )
  
     (if (= pickZ 0) (set zadd ".Z2"))   (if (= pickZ 1) (set zadd ".Z3")) 

     (if (exists (tackon cgx_root (tackon "S3Drivers" (cat "CVision3D" zadd))))
      (if (= (exists (tackon "devs:monitors" "CVision3D.info")) 0)      
       (copyfiles (source (tackon cgx_root (tackon "S3Drivers" (cat "CVision3D" zadd)))) (dest "devs:monitors") (newname "CVision3D") (infos) (optional "nofail") ) 
       (copyfiles (source (tackon cgx_root (tackon "S3Drivers" (cat "CVision3D" zadd)))) (dest "devs:monitors") (newname "CVision3D") (optional "nofail") ) 
      )      
     )

     (if (exists (tackon cgx_root (tackon "cgxvideolib" (cat "cgxvideo.library" cpuadd))) )
       (copyfiles (source (tackon cgx_root (tackon "cgxvideolib" (cat "cgxvideo.library" cpuadd)))) (dest wherelibs) (newname "cgxvideo.library") (optional "nofail") ) 
     )

     (if (exists (tackon cgx_root (tackon "cgx3dvirgelib" (cat "cgx3dvirgin.library" ""))) )
       (copyfiles (source (tackon cgx_root (tackon "cgx3dvirgelib" (cat "cgx3dvirgin.library" "")))) (dest wherelibs) (newname "cgx3dvirgin.library") (optional "nofail") ) 
     )

   )
  )


  (if (AND (exists (tackon cgx_root (tackon "S3Drivers" "CVision64"))) (IN board 1) )
   (if (= (exists (tackon "devs:monitors" "CVision64.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "S3Drivers" "CVision64"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "S3Drivers" "CVision64"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "PicassoII"))) (IN board 2) )
   (if (= (exists (tackon "devs:monitors" "PicassoII.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PicassoII"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PicassoII"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "Spectrum"))) (IN board 3) )
   (if (= (exists (tackon "devs:monitors" "Spectrum.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "Spectrum"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "Spectrum"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "Piccolo"))) (IN board 4) )
   (if (= (exists (tackon "devs:monitors" "Piccolo.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "Piccolo"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "Piccolo"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "PiccoSD64"))) (IN board 5) )
   (if (= (exists (tackon "devs:monitors" "PiccoSD64.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PiccoSD64"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PiccoSD64"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "Inferno"))) (IN board 6) )
   (if (= (exists (tackon "devs:monitors" "Inferno.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "Inferno"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source(tackon cgx_root  (tackon "CLDrivers" "Inferno"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "CLDrivers" "PicassoIV"))) (IN board 7) )
   (
    (set error1 (run "tools/ChkPIVResource"))   ; 0 <2, 5 >=2
    (if (< error1 5) (message #updatep4flash)) 
     
    (if (= (exists (tackon "devs:monitors" "PicassoIV.info")) 0)  
     (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PicassoIV"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
     (copyfiles (source (tackon cgx_root (tackon "CLDrivers" "PicassoIV"))) (dest "devs:monitors") (optional "nofail") ) 
    )
   )
  )

  ;;(if (AND (exists (tackon "AADrivers" "CGXAGA")) (IN board 8) )
  ;; (if (= (exists (tackon "devs:monitors" "CGXAGA.info")) 0)  
  ;;  (copyfiles (source (tackon "AADrivers" "CGXAGA")) (dest "devs:monitors") (infos) (optional "nofail") ) 
  ;;  (copyfiles (source (tackon "AADrivers" "CGXAGA")) (dest "devs:monitors") (optional "nofail") ) 
  ;; )
  ;;)
  ;;(if (IN board 8) (set AGA 1) (set AGA 0)) ; AGA TRUE

  (if (AND (exists (tackon cgx_root (tackon "SLDrivers" "RetinaZ3"))) (IN board 9) )
   (if (= (exists (tackon "devs:monitors" "RetinaZ3.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "SLDrivers" "RetinaZ3"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "SLDrivers" "RetinaZ3"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  ;;(if (AND (exists (tackon "TIDrivers" "A2410")) (IN board 10) )
  ;;(if (= (exists (tackon "devs:monitors" "A2410.info")) 0)  
  ;;(copyfiles (source (tackon "TIDrivers" "A2410")) (dest "devs:monitors") (infos) (optional "nofail") ) 
  ;;  (copyfiles (source (tackon "TIDrivers" "A2410")) (dest "devs:monitors") (optional "nofail") ) 
  ;; )
  ;;)

  (if (AND (exists (tackon cgx_root (tackon "TIDrivers" "CVisionPPC"))) (IN board 11) )
   (if (= (exists (tackon "devs:monitors" "CVisionPPC.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "TIDrivers" "CVisionPPC"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "TIDrivers" "CVisionPPC"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )

  (if (AND (exists (tackon cgx_root (tackon "TIDrivers" "BVisionPPC"))) (IN board 12) )
   (if (= (exists (tackon "devs:monitors" "BVisionPPC.info")) 0)  
    (copyfiles (source (tackon cgx_root (tackon "TIDrivers" "BVisionPPC"))) (dest "devs:monitors") (infos) (optional "nofail") ) 
    (copyfiles (source (tackon cgx_root (tackon "TIDrivers" "BVisionPPC"))) (dest "devs:monitors") (optional "nofail") ) 
   )
  )





;*********************************************************************************
;* Ask user to install Tools 
;*********************************************************************************
(set toolpick 15)

;;(if (OR (IN board 8) (IN board 10)) ;**Check&Msg for non CGXMode Drivers.
 ;;( 
;;  (message #nocgxmode)
;;  (set toolpick 2)
;; )
;;)

(set ToDo (askoptions (choices #cgxmode-todo #showcgxconfig #guide #commy)
                      (prompt #todo-prompt)
                      (help #todo-prompt)
                      (default toolpick)
          )
) 

(if (IN ToDo 0) 
  ( 
    (set wheremode   (askdir (prompt #wheremode)
                             (help   #wheremode)
	                     (default "SYS:Prefs")
		     )
    )

    (if (exists "CGXMode/CGXMode")
     (if (= (exists (tackon wheremode "CGXMode.info")) 0)
      (copyfiles (source (tackon cgx_root "CGXMode/CGXMode"))  (dest wheremode) (infos) (optional "nofail")) 
      (copyfiles (source (tackon cgx_root "CGXMode/CGXMode"))  (dest wheremode) (optional "nofail"))          
     )
    )

    (if (IN board 12) (set TTBOARD "BVisionPPC") )  (if (IN board 11) (set TTBOARD "CVisionPPC") ) 
    ;(if (IN board 10) (set TTBOARD "A2410") )       (if (IN board 9)  (set TTBOARD "RetinaZ3") ) 
    ;(if (IN board 8) (set TTBOARD "CGXAGA") )      (if (IN board 7)  (set TTBOARD "PicassoIV") ) 
    (if (IN board 6)  (set TTBOARD "Inferno") )     (if (IN board 5)  (set TTBOARD "PiccoSD64") ) 
    (if (IN board 4)  (set TTBOARD "Piccolo") )     (if (IN board 3)  (set TTBOARD "Spectrum") ) 
    (if (IN board 2)  (set TTBOARD "PicassoII") )   (if (IN board 1)  (set TTBOARD "CVision64") )    
    (if (IN board 0)  (set TTBOARD "CVision3D") )

    ;;(if (> board 0)
     ;; (tooltype	(dest (tackon wheremode "CGXMode")) (settooltype "BOARD" TTBOARD) ) 
    ;;)

    (if (= @language "deutsch")
     (
       (if (= (exists "Locale:Catalogs") 0) (makedir "sys:Locale/Catalogs") )
       (if (= (exists (tackon "Locale:Catalogs" "deutsch")) 0) (makedir (tackon "sys:Locale/Catalogs" "deutsch")) )
       (if (exists (tackon cgx_root "CGXMode/catalogs/deutsch/cgxmode.catalog"))
         (copyfiles (source (tackon cgx_root "CGXMode/catalogs/deutsch/cgxmode.catalog")) (dest "sys:Locale/Catalogs/deutsch") )
       )
     )
    )

    (if (exists (tackon cgx_root (cat "prefs/presets/monitors/" "monitors.dat")))  
      (copyfiles (source (tackon cgx_root (cat "prefs/presets/monitors/" "monitors.dat")))  (dest "sys:prefs/presets/monitors")) 
    )
    
    (if (exists (tackon cgx_root "gtlayoutlib/gtlayout.library"))
      (copylib (source (tackon cgx_root "gtlayoutlib/gtlayout.library")) (dest wherelibs) (optional "nofail") ) 
    )

  )
)


(if (IN ToDo 1) 
  ( 
    (set whereshowcgxconfig   (askdir (prompt #whereshowcgxconfig)
                             (help   #whereshowcgxconfig)
	                     (default "SYS:Tools")
		     )
    )

    (if (exists (tackon cgx_root "tools/showcgxconfig"))
     (if (= (exists (tackon whereshowcgxconfig "CGXMode.info")) 0)
      (copyfiles (source (tackon cgx_root "tools/showcgxconfig"))  (dest whereshowcgxconfig) (infos) (optional "nofail")) 
      (copyfiles (source (tackon cgx_root "tools/showcgxconfig"))  (dest whereshowcgxconfig) (optional "nofail"))          
     )
    )

  )
)


(if (IN ToDo 2) 
  ( 
    (set wheredocs   (askdir (prompt #wheredocs)
                             (help   #wheredocs)
	                     (default "HELP:")
		     )
    )

    (if (= @language "deutsch") (set docname "CyberGraphX4_D.guide") (set docname "CyberGraphX4_E.guide"))

    (if (exists (tackon cgx_root (tackon "docs" docname)))
     (if (= (exists (tackon wheredocs (cat docname ".info"))) 0)
      (copyfiles (source (tackon cgx_root (tackon "docs" docname)))  (dest wheredocs) (newname "CyberGraphX4.guide") (infos) (optional "nofail")) 
      (copyfiles (source (tackon cgx_root (tackon "docs" docname)))  (dest wheredocs) (newname "CyberGraphX4.guide") (optional "nofail"))          
     )
    )

   (textfile (dest "ENV:CyberGraphX/CGXHELPPATH") (append (cat "" wheredocs "") ) )
   (copyfiles (source "ENV:CyberGraphX/CGXHELPPATH") (dest "ENVARC:CyberGraphX") ) 

  )
)

 
(if (IN ToDo 3) 
  ( 
    (set wherecomm   (askdir (prompt #wherecomm)
                             (help   #wherecomm)
	                     (default "SYS:Prefs")
		     )
    )

    (if (exists (tackon cgx_root "tools/commodities/CyberGraphX"))
     (if (= (exists (tackon wherecomm "CyberGraphX.info")) 0)
      (copyfiles (source (tackon cgx_root "tools/commodities/CyberGraphX"))  (dest wherecomm) (infos) (optional "nofail")) 
      (copyfiles (source (tackon cgx_root "tools/commodities/CyberGraphX"))  (dest wherecomm) (optional "nofail"))          
     )
    )

    (if (= @language "deutsch")
     (
       (if (= (exists "Locale:Catalogs") 0) (makedir "sys:Locale/Catalogs") )
       (if (= (exists (tackon "Locale:Catalogs" "deutsch")) 0) (makedir (tackon "sys:Locale/Catalogs" "deutsch")) )
       (if (exists (tackon cgx_root "tools/commodities/catalogs/deutsch/cybergraphx.catalog"))
         (copyfiles (source (tackon cgx_root "tools/commodities/catalogs/deutsch/cybergraphx.catalog")) (dest "sys:Locale/Catalogs/deutsch") )
       )
     )
    )
    (if (exists (tackon cgx_root "gtlayoutlib/gtlayout.library"))
      (copylib (source (tackon cgx_root "gtlayoutlib/gtlayout.library")) (dest wherelibs) (optional "nofail") ) 
    )

  )
)
 


;*******************************************************************
;  END
;*******************************************************************
(if (> (exists ("c:multiview")) 0) (set #mpath "c:") )
(if (> (exists ("sys:Utilities/multiview")) 0) (set #mpath "sys:Utilities") )

(run (cat "run " #mpath "/multiview " (tackon cgx_root "Changes.txt")) )

(set @default-dest "sys:")

(set #done "Update Complete!")
(if (= @language "deutsch") (set #done "Update fertig!") )

(exit #done)
