;-------------------------------------------------------------------
; $VER: Install-GCB-Produkte V2.00 Dienstag 24.01.95
;       Gabriele Christine Bauer
;       St.-Augustinus-Str 74
;       81825 München
;       Deutschland
;-------------------------------------------------------------------
; Globalvariablen
;-------------------------------------------------------------------
(set produkt (cat "GCBVideo"))
(set version (cat "V3.11"))
(delopts AskUser)
(set @language "deutsch")
(set false 0)
(set true 1)
;-------------------------------------------------------------------
; Begrüßung
;-------------------------------------------------------------------
(set gruss (cat "Willkommen bei der Installation von "produkt" "version))
(welcome gruss)
;-------------------------------------------------------------------
; Copyright
;-------------------------------------------------------------------
(set copyright
  (cat "\n\n" 
       produkt"-Installationsskript."
       "\n"
	     "Diese Installationsroutine installiert "produkt" auf Ihrem Amiga."
	     "\n(Ab Betriebssystem Version 2.04 lauffähig)"
	     "\n"
	     "Lesen Sie bitte die Dokumentation für "
       "weitere Informationen über die Weitergeabe. "
       "\n\n"
       produkt" "version" © 1995 Gabriele Christine Bauer "
       "\n"
       "Alle Rechte vorbehalten."
  )
)
(message copyright)
(complete 10)
;-------------------------------------------------------------------
; Abfrage auf vorhandene Installation
;-------------------------------------------------------------------
(set gcbvorhanden false)
(set produktvorhanden false)
(if (= (exists "S:GCBProdukt.exists") true)
  (
    (set gcbvorhanden true)
    (if (= (exists (cat "GCBProdukte:"produkt)) true)
      (
	(set produktvorhanden true)
      )
    )
    (if ( and (= produktvorhanden false) (= (exists (cat "SYS:WBStartup/"produkt)) true))
      (
	(set produktvorhanden true)
      )
    )
  )
)
(complete 20)
;-------------------------------------------------------------------
; Abfrage auf Installationsart
;-------------------------------------------------------------------
(set frage
  (cat "Bitte wählen Sie eine der unten stehenden Möglichkeiten aus:"
  )
)
(if (= produktvorhanden false)
  (
    (set inst
      (cat "Installation von "produkt" "version
      )
    )
  )
)
(if (= produktvorhanden true)
  (
    (set inst
      (cat "Update auf "produkt" "version
      )
    )
  )
)
(set remo
  (cat produkt" von Festplatte entfernen"
  )
)
(set vers
  (cat "Systeminformationen abrufen"
  )
)
(set wahl
  (askchoice
    (prompt frage)
    (choices inst remo vers)
    (help @askchoise-help)
  )
)
(complete 30)
;-------------------------------------------------------------------
; Abfrage auf Remove
;-------------------------------------------------------------------
(set abbruch
  (cat "\n\n" 
       "Sie können "produkt" nicht von der Festplatte entfernen, "
       "da Sie es noch nicht installiert haben."
  )
)
(if (and (= produktvorhanden false) (= wahl 1))
  (
    (message abbruch)
    (exit (quiet))
  )
)
(complete 40)
;-------------------------------------------------------------------
; Sichern der pers. Daten
;-------------------------------------------------------------------
(if (and (= wahl 0) (= produktvorhanden true))
  (
    (run ("makedir >nil: RAM:GCBDAT"))
    (set text
      (cat "\n\nDa Sie schon eine Version von "produkt" installiert haben, "
	   "werden zuerst Ihre persönlichen Daten zwischengespeichert."
      )
    )
    (message text)
    (set text
      (cat "Sichere persönliche Daten nach RAM:GCBDAT"
      )
    )
    (if (= produkt (cat "GCBPlaner"))
      (
	(if (= (exists "GCBProdukte:GCBPlaner.key") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBPlaner.key")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBPlaner.Dat") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBPlaner.Dat")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBPlaner.Konfig") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBPlaner.Konfig")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBPlaner.History") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBPlaner.History")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "SYS:WBStartup/GCBPlaner.info") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "SYS:WBStartup/GCBPlaner.info")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
      )
    )
    (if (= produkt (cat "GCBVideo"))
      (
	(if (= (exists "GCBProdukte:GCBVideo.Key") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Key")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Konfig") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Konfig")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Archiv") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Archiv")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.ArchivCam") TRUE)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.ArchivCam")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Aufnahmen") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Aufnahmen")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Frei") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Frei")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.FreiCam") TRUE)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.FreiCam")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Kategorien") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Kategorien")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Genres") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Genres")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.Programme") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.Programme")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBVideo.info") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBVideo.info")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
      )
    )
    (if (= produkt (cat "GCBAdresse"))
      (
	(if (= (exists "GCBProdukte:GCBAdresse.Key") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Key")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.Orte") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Orte")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.Bank") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Bank")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.Konfig") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Konfig")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.Adressen") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Adressen")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.GrpSchalt") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.GrpSchalt")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.Gruppen") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.Gruppen")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBAdresse.info") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBAdresse.info")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
      )
    )
    (if (= produkt (cat "GCBNotiz"))
      (
	(if (= (exists "GCBProdukte:GCBNotiz.Key") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBNotiz.Key")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBNotiz.Konfig") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBNotiz.Konfig")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBNotiz.Notizen") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBNotiz.Notizen")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBNotiz.info") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBNotiz.info")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
      )
    )
    (if (= produkt (cat "GCBDruck"))
      (
	(if (= (exists "GCBProdukte:GCBDruck.Key") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBDruck.Key")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBDruck.Konfig") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBDruck.Konfig")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
	(if (= (exists "GCBProdukte:GCBDruck.info") true)
	  (
	    (copyfiles
	      (prompt text)
	      (source "GCBProdukte:GCBDruck.info")
	      (dest "RAM:GCBDAT/")
	    )
	  )
	)
      )
    )
  )
)
(complete 50)
;-------------------------------------------------------------------
; Entferne bisherige Installation bei (wahl < 2)
;-------------------------------------------------------------------
(if (and (< wahl 2) (= produktvorhanden true))
  (
    (set text
      (cat "\n\nAuf Ihrer Festplatte wird nun "produkt" entfernt"
      )
    )
    (message text)
    (run
      (cat "delete >nil: SYS:WBStartUp/"produkt"#? all"
      )
    )
    (run
      (cat "delete >nil: GCBProdukte:"produkt"#? all"
      )
    )
    (set produktvorhanden false)
  )
)
(complete 70)
;-------------------------------------------------------------------
; Entferne Assign & s:gcbprodukt.exists
;-------------------------------------------------------------------
(set sonstgcbprodukt false)
(if (and (< wahl 2) (= gcbvorhanden true))
  (
    (if (= (exists "SYS:WBStartup/GCBPlaner") true)
      (
	(set sonstgcbprodukt true)
      )
    )
    (if (= (exists "GCBProdukte:GCBVideo") true)
      (
	(set sonstgcbprodukt true)
      )
    )
    (if (= (exists "GCBProdukte:GCBAdresse") true)
      (
	(set sonstgcbprodukt true)
      )
    )
    (if (= (exists "GCBProdukte:GCBNotiz") true)
      (
	(set sonstgcbprodukt true)
      )
    )
    (if (= (exists "GCBProdukte:GCBDruck") true)
      (
	(set sonstgcbprodukt true)
      )
    )
    (if (= sonstgcbprodukt false)
      (
	(run ("execute gcbwo"))
	(set srcdir (getenv "GCBTemp"))
	(delete "ENV:GCBTemp")
	(set text
	  (cat "Da Sie keine weiteren GCB-Produkte installiert haben, "
	       "wird die Schublade "srcdir" auf Ihrer Festplatte gelöscht und "
	       "der Assign in der Datei USER-Startup entfernt."
	  )
	)
	(startup "GCB-Produkte"
	  (prompt text)
	  (help @startup-help)
	)
	(run "assign GCBProdukte: remove")
	(run
	  (cat "delete >nil: \""srcdir"\" all"
	  )
	)
	(delete "S:GCBProdukt.exists")
	(set gcbvorhanden false)
      )
    )
  )
)
(if (= wahl 1)
  (
    (exit (quiet))
  )
)
(complete 80)
;-------------------------------------------------------------------
; Installieren neue Version (wahl = 0)
;-------------------------------------------------------------------
(if (= wahl 0)
  (
    (if (= (exists (cat "WBStartUp/"produkt)) true)
      (
	(set text
	  (cat "\n\nKopiere das Startprogramm von "produkt" in die Schublade "
	       "SYS:WBStartUp. Beim nächsten Rechnerstart wird das Startprogramm "
	       " aktiv."
	  )
	)
	(message text)
	(copyfiles
	  (prompt "Installiere Startprogramm")
	  (source "WBStartUp/")
	  (pattern "#?")
	  (dest "SYS:WBStartUp")
	)
      )
    )
    (if (= gcbvorhanden false)
      (
	(set GCBWahl
	  (askdir
	    (prompt
	      (cat "Wohin soll "produkt" installiert werden ?\nEin Verzeichnis"
		   " GCBProdukte wird erzeugt."
	      )
	    )
	    (help @askdir-help)
	    (default "SYS:")
	  )
	)
	(set GCBDir (tackon GCBWahl "GCBProdukte"))
	(makedir GCBDir)
	(run (cat "assign GCBProdukte: \""GCBDir"\""))
	(set GCBORGXX GCBDir)
	(set GCBDir "GCBProdukte:")
      )
    )
    (if (= gcbvorhanden true)
      (
	(set GCBDir "GCBProdukte:")
      )
    )
    (set text
      (cat "\nKopiere die Oberfläche von "produkt" und die Dokumentation"
	   " in das Verzeichnis "GCBDir
	   "\n\n"
	   "\nDies ist eine nicht registrierte Public-Domain-Version. Mit dieser "
	   "Version sind nur 5 Einträge möglich."
      )
    )
    (if (= (exists (cat "GCBProdukte/"produkt".key")) true)
      (
	(set text
	  (cat "\nKopiere die Oberfläche von "produkt" und die Dokumentation"
	       " in das Verzeichnis "GCBDir
	       "\n\n"
	       "\nDies ist eine registrierte Shareware-Verion. Nochmals "
	       "vielen Dank für die Unterstützung des Shareware-Konzepts"
	  )
	)
	(run
	  (cat "delete >nil: RAM:GCBDAT/"produkt".key")
	)
      )
    )  
    (if (= (exists (cat "RAM:GCBDAT/"produkt".key")) true)
      (
	(set text
	  (cat "\nKopiere die Oberfläche von "produkt" und die Dokumentation"
	       " in das Verzeichnis "GCBDir
	       "\n\n"
	       "\nDies ist eine registrierte Shareware-Verion. Nochmals "
	       "vielen Dank für die Unterstützung des Shareware-Konzepts"
	  )
	)
      )
    )  
    (message text)
    (copyfiles
      (prompt (cat "Installiere "produkt))
      (source "GCBProdukte/")
      (pattern "#?")
      (dest GCBDir)
    )
    (set frage
      (cat "Bitte wählen Sie einen geeigneten Monitor-Treiber aus:"
      )
    )
    (set tpal
      (cat "PAL"
      )
    )
    (set tmulti
      (cat "MultiScan-Monitor"
      )
    )
    (set monitor
      (askchoice
	(prompt frage)
	(choices tpal tmulti)
	(help @askchoise-help)
      )
    )
    (if (= produkt "GCBPlaner")
      (set gespfad
	(cat GCBDIR Produkt".bearb"
	)
      )
    )
    (if (NOT (= produkt "GCBPlaner"))
      (set gespfad
	(cat GCBDIR Produkt
	)
      )
    )
    (run
      (cat "delete >nil: "gespfad)
    )
    (if (= monitor 0)
      (
	(run
	  (cat "rename >nil: "gespfad".Pal "gespfad)
	)
      )
    )
    (if (= monitor 1)
      (
	(run
	  (cat "rename >nil: "gespfad".MultiScan "gespfad)
	)
      )
    )
    (if (= (exists "libs/CanDo.library") true)
      (
	(copylib
		(prompt "Installiere CanDo.library")
		(help @copylib-help)
		(confirm)
		(source "libs/CanDo.library")
		(dest "Libs:")
	)
      )
    )
    (if (= (exists "libs/CanDoGfx.library") true)
      (
	(copylib
		(prompt "Installiere CanDoGfx.library")
		(help @copylib-help)
		(confirm)
		(source "libs/CanDoGfx.library")
		(dest "Libs:")
	)
      )
    )
    (if (= (exists "libs/INOVAMusic.library") true)
      (
	(copylib
		(prompt "Installiere INOVAMusic.library")
		(help @copylib-help)
		(confirm)
		(source "libs/INOVAMusic.library")
		(dest "Libs:")
	)
      )
    )
    (if (= (exists "libs/lowlevel.library") true)
      (
	(copylib
		(prompt "Installiere lowlevel.library")
		(help @copylib-help)
		(confirm)
		(source "libs/lowlevel.library")
		(dest "Libs:")
	)
      )
    )
    (if (= (exists "Fonts/GCBPlaner.font") true)
      (
	(copyfiles
	  (prompt "Installiere Fonts")
	  (source "Fonts/")
	  (pattern "#?")
	  (dest "Fonts:")
	)
      )
    )
    (if (= (exists "s/GCBProdukt.exists") true)
      (
	(copyfiles
	  (prompt "Installiere GCB-Marker")
	  (source "S/")
	  (pattern "#?")
	  (dest "S:")
	)
      )
    )
    (if (= gcbvorhanden false)
      (
	(copyfiles
	  (prompt "Installiere Schubladen-Icon")
	  (source "GCBProdukte.info")
	  (dest GCBWahl)
	)
      )
    )
    (if (= gcbvorhanden false)
      (
	(set user_script
	  (cat "  Assign GCBProdukte: \"" GCBORGXX "\""
	  )
	)
	(working omp "Updating S:User-Startup.")
	(startup "GCB-Produkte"
	  (prompt
		  "Diese Instruktionen müssen an die Datei \"S:User-Startup\" hinzugefügt"
			"werden."
			"Somit ist Ihr System für den Einsatz von "produkt" konfiguriert.\n\n"
			user_script
		)
		(help @startup-help)
		(command user_script)
	)
      )
    )
  )
)
(complete 90)
;-------------------------------------------------------------------
; Kopieren Zwischendateien aus RAM: (pattern produkt & wahl = 0)
;-------------------------------------------------------------------
(if (and (= wahl 0) (= (exists "RAM:GCBDAT/GCBPlaner.info") 1))
  (
    (copyfiles
      (prompt "Kopiere pers. Datenfiles in neue Installation")
      (source "RAM:GCBDAT/GCBPlaner.info")
      (dest "SYS:WBStartup/")
    )
    (run "delete >nil: ram:gcbdat/GCBPlaner.info")
  )
)
(if (and (= wahl 0) (= (exists "RAM:GCBDAT/") 2))
  (
    (copyfiles
      (prompt "Kopiere pers. Datenfiles in neue Installation")
      (source "RAM:GCBDAT/")
      (pattern (cat produkt"#?"))
      (dest GCBDir)
    )
    (run "delete >nil: ram:gcbdat all")
  )
)
(complete 100)
;-------------------------------------------------------------------
; Auskunft über System (wahl = 2)
;-------------------------------------------------------------------
(if (= wahl 2)
   (
     (run "Version >ENV:GCBInfo")
     (set systeminfo
       (cat "Information über Ihr System:\n\n"
	    (getenv "GCBInfo")
	    "\n"produkt" "version
       )
     )
     (delete "ENV:GCBInfo")
     (message systeminfo)
     (exit (quiet))
   )
)
(complete 100)
;-------------------------------------------------------------------
; Endlich am Ende
;-------------------------------------------------------------------
(set @default-dest GCBDir)
(set text
  (cat "Die Installation von "produkt" "version" ist nun abgeschlossen."
       "\n\nBitte lesen Sie die Dokumentation, zu diesem Produkt, die Sie "
       "in "GCBDir" finden können, bzw. mir der Help-Taste aus dem Programm heraus"
       " aufrufen können.\n\nViel Spaß mit Ihrer neuen Software"
  )
)
(exit text)
