; Libs nicht mehr mitliefern also auch nicht kopieren
; 



; This piece installs the Eagleplayer (TM) to your hard disk
; © 1997 DEFECT INC. All rights reserved.
; May only be distributed within the Eagleplayer package
;
; Written by Defect
; Date: 22 Feb 97

(set #EP_Version (cat "2.00"))					;Eagleplayer Version
(set #Space (cat "1.8 "))					;Megabytes needed for
                                                        	;installation.
(set KickVersion (/ (getversion) 65536))
(debug "Kickversion:" Kickversion)

;=========================== English texts ==================================
(set #which-disk
(cat "In which drawer shall I install the Eagleplayer?\n"
     "(a directory called "Eagleplayer" will be created.)"
))

(Set #intro
(cat "This procedurce lets you install the full Eagleplayer Version "
     #EP_Version
     "including the needed libraries on your hard drive. Any previous "
     "release already present will be replaced. For installing the full "
     "package you need about "
     #Space
     "MBytes free space on your harddisk. \n"
     "With the default installation settings the Eagleplayer uses the "
     "Playerbatch & Playerloader functions to save memory by guessing "
     "the type of a module. "
     "If you dislike this awesome feature you "
     "only have to switch it off. (See Doc for instructions) "
     "Note: If switched off all Players need >800 KByte of free "
     "memory ! So delete unused ones if you have not much memory."
))

(Set #WhatInstall
(cat  "Which parts of the Eagleplayer Package do you want to install now ?"
))

(Set #WhatHelp
(cat "Here you are asked to choose between the different parts of the "
     "Eagleplayer package you want to get. Simply to start the Eagleplayer "
     "the Main Program and the needed libraries are enough. \n"
     "To be able playing modules of all supported formats you have to install "
     "the supplied replayers. \n"
     "For the analyzing and some extended controlling features you may choose "
     "to install the so called Userprograms. \n"
     "The Documentation is recommended to read for learning to know and to "
     "handle all the abilities of this package. READ IT BEFORE COMPLAINING "
     "ABOUT SEVERAL PROBLEMS !! \n"
     @askoptions-help
))

(Set MainProgname
(cat "Eagleplayer Main Program"
))
(set Eagleplayersname
(cat "External Replayers"
))
(set PrefsName
(cat "Predefined Prefs"
))
(set Enginesname
(cat "Engines (Analyzers, etc.)"
))
(set Documentationname
(cat "Documentations"
))
(set ArexxScriptsname
(cat "Arexx Example Scripts"
))
(set DeveloperKitname
(cat "Developer Examples & include Files"
))

(set #where-key
(cat "Enter the Path where your DEVS: Directory is situated when you "
     "boot from your Harddisk !"
))

(set #where-envarc
(cat "Enter the Path where your ENVARC: Directory is situated when you "
     "boot from your Harddisk !"
))


(set #InstallReplays
(cat "Installing the external Replayers, please wait."
))

(set #which-user20
(cat "Which Engines requiering OS 2.0 you wish to be installed ?"
))

(set #which-user30
(cat "Which Engines requiering OS 3.0 you wish to be installed ?"
))

(set #which-user-help
(cat "This procedure asks you for selecting the Engines"
     " this program should install. Engines are the external modules"
     " the Eagleplayer loads out of the external Players. These can be"
     " Analyzers, Scopes or new Surfaces. Please notice that some"
     " Engines may take a lot of memory, so if you only own 1 MB"
     " of even less memory, choose only these you really like. The Userprograms"
     " marked with a "R"- sign at the beginning are only available for the"
     " registered users and won`t be loaded in the general version. So if"
     " you are not registered you don`t need to install them.      "
     @Askoptions-help
))

(set #copyingdocs
(cat "Installing the Amigaguide® Documentation File"
))

(set #copyingexamples
(cat "Installing the Developer Example Files"
))

(set #copyarexxhelp
(cat "The Program asks you if you want to get the supplied ARexx®"
     " examples for controlling Eagleplayer from other programs like"
     " Directory Opus®, Maxon Tools® etc."
))


(set #copyingarexx
(cat "Installing the Arexx Example Files"
))

(set #copymods
(cat "Where to copy the supplied Soundmodules ?"
))

(set #copymodshelp
(cat "Simply select whether you want the modules on your hard disk or"
     "not and when yes, where you want them."
))

(set #copyprefs
(cat "Copying default preferences.... (to \"ENVARC:\")"
))

(set #copyprefsenv
(cat "Copying default preferences.... (to \"ENV\")"
))

(set #copykey
(cat "Copying your personal Keyfile to devs:"
))

(set #copyprefsok
(cat "Proceed"
))

(set #copyprefsno
(cat "Skip this part"
))

(set #copyincludes
(cat "Where to copy the Eagleplayer include files ?"
))

(set #copyincludeshelp
(cat "Only for developers, the Eagleplayer include file needed for"
     " creating own Replayroutines or Engines (not documented yet)."
))


;=========================== Deutsche Texte =================================
(if (= @language "deutsch")
(

(set Docfile ("Eagleplayer.Dok.Guide"))

(set #which-disk
(cat "Wo soll der Eagleplayer installiert werden ? "
     "(Ein Verzeichnis "Eagleplayer" wird angelegt)"
))

(Set #intro
(cat "Dieser Vorgang ermöglicht es Ihnen, das komplette Eagleplayer-Paket "
     #EP_Version
     " samt den benötigten Bibliotheken auf Ihrer Harddisk zu installieren. "
     " jede vorherige Version wird ersetzt. Zur Installation des kompletten "
     " Paketes werden etwa "
     #Space
     "MBytes freier Platz auf der Festplatte benötigt. Mit den dabei "
     "installierten Einstellungen wird die \"Playerbatch\" Funktion "
     "sowie der Playerloader benutzt, mit denen sich erheblich Speicher "
     " sparen läßt. Lesen Sie dazu in der Anleitung! "
     "Wenn Sie diese Funktion abschalten, werden beim Start alle "
     "externen Player mitgeladen, was >800 KByte extra Speicher erfordert !"
))

(Set #WhatInstall
(cat  "Welche Teile des Eagleplayerpaketes möchten Sie jetzt installieren ?"
))

(Set #WhatHelp
(cat "Sie sollten nun auswählen, welche Teile des Eagleplayerpaketes Sie "
     "haben wollen. Um den Eagleplayer starten zu können ist lediglich "
     "das Hauptprogramm notwendig. (bei Bedarf die Libraries noch dazu) \n"
     "Um Musikstücke aller unterstützter Formate abzuspielen müssen Sie "
     "zwangsweise auch die externen Abspieler mit installieren.\n"
     "Für die Analyzer und einige externe Kontrollfunktionen benötigen "
     "Sie die sogenannten \"Engines\".\n"
     "Die Dokumentation zu installieren wird ihnen wärmstens ans Herz gelegt, "
     "schließlich handelt es sich hier um ein Paket von weit über 1MB Umfang. "
     "Falls Sie noch keinen Eagleplayer >2.xx installiert haben sollten, so "
     "sollten Sie sich die \"Voreinstellungen\" installieren, da man sich "
     "sonst beim Start ein totales Chaos von Fenstern einhandeln würde, die "
     "alle gleichzeitig geöffnet werden. \n"
     "AUßERDEM SOLLTEN SIE ERST IN DER ANLEITUNG NACHLESEN, BEVOR SIE SICH "
     "ÜBER IRGEND ETWAS BESCHWEREN, DA EINIGE FUNKTIONEN ERST OPTIONAL ZUR "
     "VERFÜGUNG STEHEN.\n\n"
     @askoptions-help
))

(Set MainProgname
(cat "Eagleplayer Hauptprogramm"
))
(set Eagleplayersname
(cat "Externe Abspieler"
))
(set PrefsName
(cat "Voreinstellungen (siehe Hilfe)"
))
(set Enginesname
(cat "Engines"
))
(set Documentationname
(cat "Dokumentation"
))
(set ArexxScriptsname
(cat "Arexx Beispieldateien"
))
(set DeveloperKitname
(cat "Entwicklerunterlagen"
))

(set #where-key
(cat "Bitte geben Sie den Pfad an, wo sich das DEVS: Verzeichnis befindet, "
     "wenn Sie von Festplatte booten !"
))

(set #where-envarc
(cat "Bitte geben Sie den Pfad an, wo sich das ENVARC: Verzeichnis befindet, "
     "wenn Sie von Festplatte booten !"
))

(set #InstallReplays
(cat "Installiere die externen Abspieler, bitte warten ...."
))

(set #which-user20
(cat "Welche Engines, die OS 2.0 erfordern, möchten Sie installieren ?"
))

(set #which-user30
(cat "Welche Userprogramme, die OS 3.0 erfordern, möchten Sie installieren ?"
))

(set #which-user-help
(cat "Dieser Programmteil fragt Sie, welche Engines Sie installieren"
     " möchten. Engines sind die externen Module, die außer den externen"
     " Abspielroutinen beim Start des Programmes oder später geladen werden."
     " Dieses können Spektrum Analyzer, Oszilliscopesimulatoren oder neue"
     " Oberflächen sein. Bitte beachten Sie, daß einige Engines eine"
     " ganze Menge Speicher beanspruchen und somit sollten Sie bei nur 1 MB"
     " oder gar weniger Hauptspeicher nur die auswählen, die Sie auch wirklich"
     " oft nutzen. Diejenigen Engines, die mit einem "R" am Anfang"
     " gekennzeichnet sind, können nur geladen werden, wenn Sie im Besitz"
     " einer registrierten Eagleplayer "
     "version sind und Ihr Keyfile richtig installiert haben. "
     @Askoptions-help
))

(set #copyingdocs
(cat "Installiere die Amigaguide® Dokumentationsdatei"
))

(set #copyingexamples
(cat "Installiere die Entwicklerbeispiele..."
))

(set #copyingarexx
(cat "Installiere die Arexx Beispieldateien"
))


(set #copyprefs
(cat "Kopiere die vordefinierten Einstellungen (nach ENVARC:) ..."
))

(set #copyprefsenv
(cat "Kopiere die vordefinierten Einstellungen (nach ENV:) ..."
))

(set #copykey
(cat "Kopiere Ihr persönliches Keyfile nach devs:"
))

(set #copyhelp
(cat "Kopiere Datei für Online-Hilfe"
))

(set #copyprefsok
(cat "Weiter"
))

(set #copyprefsno
(cat "Diesen Teil überspingen"
))

)
)


;============================== Welcome the User ===========================

(set @app-name (cat "Eagleplayer" #EP_version))
(set APPNAME (cat "Eagleplayer" #EP_version))

;(welcome)

(set old_level @user-level)

(user 2)
(message #intro)
(user old_level)

;======================== Ask what he wants to install =======================

(set #InstallParts
		(askoptions
			(prompt #WhatInstall)
			(help #WhatHelp)
			(choices
				("%s" MainProgname)		;Bit 0
				("%s" Eagleplayersname)		;Bit 1
				("%s" Enginesname)		;Bit 2
				("%s" PrefsName)		;Bit 3
				("%s" Documentationname)	;Bit 5
				("%s" ArexxScriptsname)		;Bit 6
				("%s" DeveloperKitname)		;Bit 7
			)
                        (default 63)
		)
)
;====== get target directory where the Eagleplayer is to be installed =====
    (user 2)

    (set target (askdir (prompt #which-disk)
			        (help @askdir-help)
			        (default "Work:")
			        (disk)
		)
    )

(	(makedir (tackon target "Eagleplayer")) 
	(copyfiles
		(source ("EagleplayerDir.info"))
		(dest target/Eagleplayer.info)

	(set @default-dest target)
	)
)



   (user old_level)

(exit)


;----------- set libs,devs and rexx path if needed  ----------
(set Booted
  (expandpath "sys:")
)

(set Libpath ('Libs:'))
(set Keypath ('Devs:'))
(set Envarcpath "Envarc:")


;=================== Ask for the Engines ============================



(if (AND (= @user-level 1) (IN #InstallParts 2))
 (
  (set user13
   (askoptions (prompt #which-user13)
               (help #which-user-help)
               (choices 
                               "R Analyze.small" 	;1
                               "- Levelgraph"    	;2
                               "R Levelmeter"    	;4
                               "- Time"          	;8
                               "- Noiseeagle"   	;16
                               "- Patternscroll_1.3"	;32
                               "- Space-Scope+"   	;64
                               "- Moduleinfo")   	;128


               (default user13)
   )
  )

  (set user20
   (askoptions (prompt #which-user20)
               (help #which-user-help)
               (choices 
                              "- Analyzer"			;1
                              "- DirList Viewer"		;2
                              "- HiFi"				;4
                              "- M.E.L.G.U"			;8
                              "- Messagewindow"			;16
                              "R Monoscope"			;32
                              "- Patternscroll"			;64
                              "- Patternscroll++"		;128
                              "- Public Screen Manager"		;256
                              "- Space-Scope"			;512
                              "R Stereoscope"			;1024
                              "- Quadrascope"			;2048
                              "R Voicemeter")			;4096
               (default user20)
   )
  )

  (set user30
   (askoptions (prompt #which-user30)
               (help #which-user-help)
               (choices 
                              "- Levelmeter  AGA"		;1
                              "- Stereoscope AGA")		;2
               (default user30)
   )
  )

 )
)
(debug "Ausgewählte Userprogramme:" user13 user20 user30)

;Disk 1 ============  Copy LHX to Ram: (to depack all archives) ==============
	(copyfiles
		(prompt "")
		(help "")
		(source (tackon #EP_Disk1 "lhx"))
		(dest "RAM:")
	)

;Disk 1 ========== Copy the Eagleplayer to the desired directory =============
;       ==========                   if Exist:                   =============
;              beside of this: default prefs, keyfile and helpfile
(if (IN #InstallParts 0)
 (
    (copyfiles (source (tackon #EP_Disk1 "Eagleplayer"))
               (dest target)
               (infos)
               (optional "force" "nofail")
    )

     (set keypresent (exists (tackon #EP_Disk1 "Eagleplayer.key"))
     )
     (debug "KeyPresent ist" keypresent)

      (if (= keypresent 1)

       (

         (set keypresent (exists (tackon keypath "Eagleplayer.key"))
         )

         (if (<> keypresent 1)
          (copyfiles (optional "nofail")
                     (source (tackon #EP_Disk1 "Eagleplayer.key"))
                     (dest keypath)
                     (prompt #copykey)
                     (help "Read the Docs")
                     (confirm)
          )
         )
       )

      )
    

     (set keypresent (exists (tackon #EP_Disk1 "Eagleplayer.help"))
     )

      (if (= keypresent 1)

       (

        (copyfiles (optional "nofail")
                 (source (tackon #EP_Disk1 "Eagleplayer.help"))
                 (dest target)
                 (prompt #copyhelp)
                 (help "Read the Docs")
                 (confirm)
        )
       )
      )
 )
)
;========================= copy Preferences  ===================================
(if (IN #InstallParts 3)
 (
     (set keypresent (exists Envarcpath))
     (debug "Envarc gefunden:" keypresent)

      (if (= keypresent 2)
       (
         (copyfiles (optional "nofail")
                    (source (tackon #EP_Disk1 "prefs/env-archive"))
                    (dest Envarcpath)
                    (prompt #copyprefs)
                    (help "")
                    (confirm)
                    (all)
         )
       )
      )

     (if (<> #EP_Disk1 Booted)
      (

       (set keypresent (exists "Env:"))
       (debug "Env: gefunden:" keypresent)

       (if (= keypresent 2)
        (
         (copyfiles (optional "nofail")
                    (source (tackon #EP_Disk1 "prefs/env-archive"))
                    (dest "env:")
                    (prompt #copyprefsenv)
                    (help "")
                    (confirm)
                    (all)
         )
        )
       )
      )
     )
 )
)
;Disk 1 ================= copy Libraries ===================================
(if (IN #InstallParts 4)
 (
  (copylib
	  (prompt "Copy XPKMaster.library")
	  (help @copylib-help)
	  (source (tackon #EP_Disk1 "LIBS/XPKMaster.library"))
	  (dest Libpath)
	  (confirm)
	  (optional "nofail")
  )

  (copyfiles
	 (prompt "Copy XPKNuke/XPKSQSH/XPKCRMS.library")
	 (help @copylib-help)
	 (source (tackon #EP_Disk1 "LIBS/Compressors/"))
	 (dest (tackon Libpath "Compressors"))
	 (confirm)
	 (optional "nofail")
	 (all)
  )

  (copylib
	 (prompt "Copy Powerpacker.library")
	 (help @copylib-help)
	 (source (tackon #EP_Disk1 "LIBS/Powerpacker.library"))
	 (dest Libpath)
	 (confirm)
	 (optional "nofail")
  )

  (copylib
	 (prompt "Copy LH.library")
	 (help @copylib-help)
	 (source (tackon #EP_Disk1 "LIBS/lh.library"))
	 (dest Libpath)
	 (confirm)
	 (optional "nofail")
  )

  (copylib
	 (prompt "Copy Req.library")
	 (help @copylib-help)
	 (source (tackon #EP_Disk1 "LIBS/req.library"))
   (dest Libpath)
	 (confirm)
   (optional "nofail")
  )

  (copylib
	 (prompt "Copy Reqtools.library")
	 (help @copylib-help)
	 (source (tackon #EP_Disk1 "LIBS/req.library"))
   (dest Libpath)
	 (confirm)
   (optional "nofail")
  )
 )
)

;Disk 2 ============== copy the external Players to be installed ========
(if (IN #InstallParts 1)
  (
    (set yo (exists (tackon target "Eagleplayers")))
      (if (<> yo 0)
       (
        (debug "so ein schit!!")
	(set eplayers (tackon target "Eagleplayers"))
	(set Error (run ("c:delete %s all" eplayers)))
       )
      )

    (makedir (tackon target "Eagleplayers")
             (infos)
    )

   (set #Message #InstallReplays)
   (set ArchiveName ("%sEagleplayers.lha" #EP_Disk2))
   (set Destination (tackon target "Eagleplayers/"))
   (Depackfiles)
  )
)

;Disk 2======================== copy Docs ===================================
;              Betriebssystem < 3.0 -> Install Amigaguide
(if (IN #InstallParts 5)
  (
    (set doctarget (askdir (prompt #copydocs)
                           (help #copydocshelp)
                           (default target)
                           (disk)
                   )
    )

    (set #Message #copyingdocs)
    (set ArchiveName ("%sDocs.lha" #EP_Disk2))
    (set Destination "ram:")
    (set FileName Docfile)
    (Depackfile)

    (set #Message #copyingdocs)
    (set ArchiveName ("%sDocs.lha" #EP_Disk2))
    (set Destination "ram:")
    (set FileName ("%s.info" Docfile))
    (debug Filename)
    (debug Archivename)
    (Depackfile)

    (set ramtest (expandpath doctarget))
    (set ramtest2 (expandpath "ram:"))

    (if (<> ramtest ramtest2)
     (
      (copyfiles (source (tackon "ram:" docfile))
               (dest doctarget)
               (infos)
               (optional "force" "nofail")
      )

      (delete (tackon "ram:" docfile))
      (delete ("ram:%s.info" docfile))
     )
    )
  )
)

;Disk 2 =============== copy the Userprograms ===========================
(if (IN #InstallParts 2)
 (
  (set yo (exists (tackon target "EP-Userprograms")))
    (if (<> yo 0)
     (
      (debug "so ein schit!!")
      (set eplayers (tackon target "EP-Userprograms"))
      (set Error (run ("c:delete %s all" eplayers)))
     )
    )

  (makedir (tackon target "EP-Userprograms")
           (infos)
  )

  (if (<> user13 0)
   (
    (set n 0)
    (set maxfiles user13)
    (set ArchiveName ("%sUserprograms.lha" #EP_Disk2))
	  (while (set UPSFileName
	          (select n
			"Analyze.small"
			"Levelgraph"
			"Levelmeter"
			"Time"
			"Noiseeagle"
                        "Patternscroll_Kick1.3"
                        "Space-Scope+"
                        "Moduleinfo"
			""
		    )
	         )
		   (Depackuserprg)
		   (set n (+ n 1))
    )
	 )
  )

  (if (<> user20 0)
   (
    (set n 0)
    (set maxfiles user20)
	  (while (set UPSFileName
	          (select n
                         "Analyzer"
                         "DirListViewer"
                         "HiFi"
                         "M.E.L.G.U"
                         "Messagewindow"
                         "Monoscope"
                         "Patternscroll"
                         "Patternscroll++"
                         "PublicScreenmanager"
                         "Space-scope"
                         "Stereoscope"
                         "Quadrascope"
                         "Voicemeter"
                         ""
		    )
	         )
		   (Depackuserprg)
		   (set n (+ n 1))
    )
	 )
  )

  (if (<> user30 0)
   (
    (set n 0)
    (set maxfiles user30)
	  (while (set UPSFileName
	          (select n
                         "LevelmeterAGA"
                         "StereoscopeAGA"
                         ""
		    )
	         )
		   (Depackuserprg)
		   (set n (+ n 1))
    )
	 )
  )


 )
)

;Disk 2 ================== copy Developer Examples =============================
(if (IN #InstallParts 7)
  (
    (set examplestarget (askdir (prompt #copyexamples)
                                (help #copyexampleshelp)
			                (default target)
			                (disk)
                        )
    )

    (set bha (substr examplestarget (- (strlen examplestarget) 1) 1))
    (if (and (<> bha "/") (<> bha ":"))
    (set examplestarget (cat examplestarget "/"))
    )

   (set #Message #copyingexamples)
   (set ArchiveName ("%sDeveloper.lha" #EP_Disk2))
   (set Destination examplestarget)
   (Depackfiles)
  )
)

;Disk 2 ===================== copy Arexx-Scripts =======================
(if (IN #InstallParts 6)
  (
    (set examplestarget (askdir (prompt #copyarexx)
                                (help #copyarexxhelp)
			                (default Rexxpath)
			                (disk)
                        )
    )

   (set bha (substr examplestarget (- (strlen examplestarget) 1) 1))
   (if (and (<> bha "/") (<> bha ":"))
   (set examplestarget (cat examplestarget "/"))
   )
   (debug "Ziel für Arexx " examplestarget bha)

   (set #Message #copyingarexx)
   (set ArchiveName ("%sArexxExamples.lha" #EP_Disk2))
   (set Destination examplestarget)
   (Depackfiles)
  )
)

;============= ready installing the Eagleplayer  =======================
(delete "ram:lhx")

(exit)
