; Installationsscript für Merlin-Demo/Upgrade (© ProDev 1997)
; $VER: DemoUpPB3 1.1 (09.02.97)

(set #hrgcardsyslib (cat "Copy hrgcardsys.library to libs: ... "))
(set #hrgsystemlib (cat "Copy hrgsystem.library to libs: ... " ))
(set #hrgrenderlib (cat "Copy hrgrender.library to libs: ... " ))
(set #hrgblitterunilib (cat "Copy hrgblitter-uni.library to libs: ... " ))
(set #hrgblitterspzlib (cat "Copy hrgblitter-spz.library to libs: ... " ))
(set #hrgemulib (cat "Copy hrgemu.library to libs: ... " ))
(set #hrtoollib (cat "Copy hrtool.library to libs: ... " ))
(set #cyberlib (cat "Copy cyberprobench.library to libs: ... " ))
(set #nohelp (cat "No help available. " ))
(set #bad-kick (cat "You need Kickstart 3.1 for ProBench V3.1." ))
(set #bad-cpu (cat "You need a 68020 CPU." ))

(set  @default-dest "SYS:")

(set osversion (getversion "exec.library" (resident)))
(set osversion (/ osversion 65536))

(set DefaultEmuDir "Devs:Monitors")

(run "protect libs:hrg#?.library RWED")
(run "protect libs:hrtool.library RWED")

(message "\n\nHello! I try to give good explanations with my (old and bad) shool english. I've been told that english people prefer this instead of none or german texts (H.Raaf)")

(if (askbool
	(prompt "\n\nWelcome to ProBench V3.1 Demo/Update!\n\nThis Installer-Skript is able to:\n\n1. Install and Deinstall the Demo-Version of ProBench Version 3.1\n\n2. Update your ProBench V3.1 full-version to Rev8")
	(choices "Demo (De)Install" "Update full-version")
	(help "Please have a look into ProBench3.guide!")
	(default 1))
	; 1
	(
		(message "\n\nMake sure that there is no older Emulation active! If there is any emulation running you have to abort the installation now!")
		(message "\n\nNOTICE: We can not guarantee that this installation/deinstallation-script works on all possible configurations! Please consider to additional backup your old emulator first!")
			(if (exists "devs:monitors/probench-demo")
			( ; ProBench Demo deinstall
				(message "\n\nFound an installed Demoversion of ProBench V3.1! Deinstalling now!")
				(if (exists "sys:ProBench-Backup/probench")
					(
						(message "\nRestoring the backuped files. Notice that the new tools and the monitorfile of the Demo-Version will be deleted!")
						(copyfiles
							(prompt "\nRestoration of the old libraries!")
							(help @copyfiles-help)
							(source "SYS:ProBench-Backup/")
							(dest "libs:")
							(pattern "(hrgcardsys.library|hrgsystem.library|hrgrender.library|hrgblitter.library)")
							(optional nofail askuser)
							(files)
							(confirm)
							(infos))
							
						(copyfiles
							(prompt "\nRestoration of the old monitorfile!")
							(help @copyfiles-help)
							(source "SYS:ProBench-Backup/probench")
							(dest "devs:monitors/")
							(optional nofail askuser)
							(confirm)
							(infos))

						(copyfiles
							(prompt "\nRestoration of the old modeinfos!")
							(help @copyfiles-help)
							(source "SYS:ProBench-Backup/hrg_modeinfos")
							(dest "s:")
							(optional nofail askuser)
							(confirm)
							(infos))
					)
					(delete "devs:monitors/probench-demo" (prompt "The monitorfile of the demo is now obsolete!") (infos)(help #nohelp) (confirm))
					(delete "sys:WBStartup/HRControl3" (infos))
					(delete "sys:WBStartup/SProDBase3" (infos))
					(message "\nThe old configuration should be restored by now!")
				)
				(
					(delete "devs:monitors/probench-demo" (prompt "The monitorfile of the demo is now obsolete!") (infos)(help #nohelp) (confirm))
					(delete "sys:WBStartup/HRControl3" (infos))
					(delete "sys:WBStartup/SProDBase3" (infos))
					(message "\nThe demo-monitorfile and the ProBench 3 Tools in WBStartup are now deleted!")
				)

			)
			( ; ProBench Demo install
			(if (exists "devs:monitors/probench")
				( ; Anderes ProBench gefunden!
					(if (askbool
						(prompt "\nFound an installation of ProBench. Do you want to create a backup for later deinstallation of ProBench3-Demo?\n\nAll files needed for deinstallation will be copied to SYS:ProBench-Backup!")
						(choices "Yes" "No")
						(help #nohelp)
						(default 1))
						( ; Sicherung
							
							(copyfiles
								(prompt "\nCreating a backup of the old monitorfile!")
								(help @copyfiles-help)
								(source "devs:monitors/probench")
								(dest "SYS:ProBench-Backup")
								(optional nofail askuser)
								(confirm)
								(infos))

							(delete "devs:monitors/probench" (prompt "\n\nThe old monitorfile will be deleted now and replaced by the monitorfile of the demo-version") (infos)(help #nohelp) (confirm))

							(copyfiles
								(prompt "\nCreating a backup of all incompatible libraries!")
								(help @copyfiles-help)
								(source "libs:")
								(dest "SYS:ProBench-Backup")
								(pattern "(hrgcardsys.library|hrgsystem.library|hrgrender.library|hrgblitter.library)")
								(optional nofail askuser)
								(files)
								(confirm)
								(infos))
	
							(copyfiles
								(prompt "\nCreating backup of your old modeinfos!")
								(help @copyfiles-help)
								(source "s:hrg_modeinfos")
								(dest "SYS:ProBench-Backup")
								(optional nofail askuser)
								(confirm)
								(infos))
	
							(message "\n\nPreparation for later deinstallation is finished!\n\nPlease remove your old tools from WBStartup and user-startup by yourself!")
						)
						; oder nicht
						(message "\nIf you want to create a backup by yourself abort the installer now!\n\nIf you continue installation your current version will be overwritten and an automatic deinstallation is impossible for this script")
					)
				)
				(
					(message "\nNo old ProBench installation found. If you are using the original X-Pert Emulation you have to remove it now!")
					(message "\nIf you want to create a backup by yourself abort the installer now!\n\nIf you continue installation a later deinstallation will be only able to remove the demo monitorfile")
				)
			)
			(run "cinst/killlib hrtool#?")

			(if (exists "s:HRG_ModeInfos")
				(
				(message "\n\n\nConverting old HRG_Modeinfos to new format.\n\nAll current screenmodes will be available in the converted file")
	
				(run "cinst/makeids")

				(copyfiles
					(prompt "\nWriting a DEFAULT 'HRG_Modeinfos' File!")
					(help "")
					(source "s/HRG_Modeinfos-DEFAULT")
					(dest "s:")
					(newname "HRG_Modeinfos-DEFAULT"))
				)
				(
				(message "\n\n\nThere are no 'HRG_ModeInfos' on your system! Writing DEFAULT File!")

				(copyfiles
					(prompt "\nWriting 'HRG_Modeinfos' File!")
					(help "")
					(source "s/HRG_Modeinfos-DEFAULT")
					(dest "s:")
					(newname "HRG_Modeinfos"))
			))
			; Nun die Bösewichter finden und vernichten
			(run "cinst/changelines s:startup-sequence #?prospeed#? correct")
      
			(message "\nNext step: Installation of the demo-version libraries!")

     	(copylib
     		(prompt #hrgcardsyslib)
     		(source "libs/hrgcardsys.library")
     		(dest "libs:")
     		(help #nohelp))
         
     	(copylib
     		(prompt #hrgsystemlib)
     		(source "libs/hrgsystem.library")
     		(dest "libs:")
     		(help #nohelp))
         
     	(copylib
     		(prompt #hrgrenderlib)
     		(source "libs/hrgrender.library")
    		(dest "libs:")
    		(help #nohelp))
         
    	(copylib
     		(prompt #hrgemulib)
     		(source "libs/hrgemu.library")
     		(dest "libs:")
     		(help #nohelp))
         
     	(copylib
     		(prompt #hrtoollib)
     		(source "libs/hrtool.library")
     		(dest "libs:")
     		(help #nohelp))
         
     	(copylib
     		(prompt #cyberlib)
     		(source "libs/cyberprobench.library")
     		(dest "libs:")
     		(confirm)
     		(help #nohelp))
         
     	(copylib
     		(prompt #hrgblitterunilib)
     		(source "libs/hrgblitter-uni.library")
     		(dest "Libs:")
     		(help #nohelp))
         
     	(copylib
     		(prompt #hrgblitterspzlib)
     		(source "libs/hrgblitter-spz.library")
     		(dest "Libs:")
     		(help #nohelp))
         
     	(if (askbool
     		(prompt "\n'hrgblitter.library' exists in two versions. Which one should be installed ?")
     		(choices "Universal" "A4/40-A3/Z3")
     		(help "Universal works on all Amiga-Models but the special version is faster on A4000/040 or A3000-ZorroIII !")
     		(default 1))
     		(copyfiles
   				(prompt "Universal-Version ACTIVE")
   				(help "")
   				(source "libs:hrgblitter-UNI.library")
   				(optional nofail askuser)
   				(newname "hrgblitter.library")
   				(dest "Libs:"))
         		(copyfiles
         				(prompt "Special-Version ACTIVE")
         				(help "")
         				(source "libs:hrgblitter-SPZ.library")
         				(optional nofail askuser)
         				(newname "hrgblitter.library")
         				(dest "Libs:"))
			)
      
      		(copyfiles
			 			(prompt "\nInstallation of ModeMaster (3.4 ist für MUI 3.6!)")
      			(help @copyfiles-help)
      			(source "Prefs")
      			(dest "SYS:Prefs")
      			(pattern "ModeMaster3.#?")
      			(optional nofail askuser)
      			(files)
      			(infos)
      			(confirm)
      		)

      		(set UDDir
      			(askdir
      			(prompt "\nWhere should I place the Merlin Tools?")
      			(help @askdir-help)
      			(default "SYS:Tools/Merlin3")
      			(newpath)
      			)
      		)
      
      		(copyfiles
      			(prompt "\nSelect Merlin Tools to install")
      			(help @copyfiles-help)
      			(source "Tools")
      			(dest UDDir)
      			(infos)
      			(all)
      			(confirm)
      		)
      
      		(if (askbool
      			(prompt "\nShould HRControl be started after every reboot ?")
      			(choices "Yes" "No")
      			(help "If you select yes it will be placed in WBStartup drawer!")
      			(default 1))
      
      			(copyfiles
      				(prompt "\nPlacing HRControl in WBStartup drawer")
      				(help @copyfiles-help)
      				(source "tools/HRControl3")
      				(dest "SYS:WBStartup/")
      				(infos)
      				(confirm)
      			)
      		)
      
      		(if (askbool
      			(prompt "\nShould SProDBase be started after every reboot ?")
      			(choices "Yes" "No")
      			(help "If you select yes it will be placed in WBStartup drawer!")
      			(default 1))
      
      			(copyfiles
      				(prompt "\nPlacing SProDBase in WBStartup drawer")
      				(help @copyfiles-help)
      				(source "tools/SProDBase3")
      				(dest "SYS:WBStartup/")
      				(infos)
      				(confirm)
      			)
      		)
				
				; Hier das, worauf alle Leute gewartet haben
				(copyfiles
					(prompt "\nInstallation of the demo monitorfile! You should place it in DEVS:MONITORS !\nThe filename must not be changed!!")
					(help @copyfiles-help)
					(source "devs/Monitors/")
					(dest DefaultEmuDir)
					(pattern "#?")
					(files)
					(infos)
					(optional nofail askuser)
					(confirm))

    		(if (askbool
    			(prompt "\nWould you like to install the online-documentation ?")
    			(choices "Yes" "No")
    			(help #nohelp)
    			(default 1))
    
    			(copyfiles
    				(prompt "\nPlacing ProBench3.guide in help:")
    				(help @copyfiles-help)
    				(source "ProBench3.guide")
    				(dest "help:")
    				(infos)
    				(confirm)
    			)
    		)
				(message "\nATTENTION: Notice that only 800x600 Screenmodes are available in the Demo-Versopm!\n\nFor safety you should reboot your computer in an amiga native mode first after installation!")
				(message "\nProDev - Firma H.Raaf\n\n"
			"The Demo-Version installation has be finished. Please reboot your machine! If you encounter problems feel free to contact us by email!\n\n"
			"EMail: m.jantz@public.ndh.com")
			) ; Ende: Check auf alte Version
		) ; Ende: Demo-Installation
	) ; Ende: Demo-(De)Installation

	; 2
	(
		(message "\nUpdating your ProBench V3.1 (full version) now!")
   
   	(copylib
   		(prompt #hrgcardsyslib)
   		(source "libs/hrgcardsys.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrgsystemlib)
   		(source "libs/hrgsystem.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrgrenderlib)
   		(source "libs/hrgrender.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrgemulib)
   		(source "libs/hrgemu.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrtoollib)
   		(source "libs/hrtool.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #cyberlib)
   		(source "libs/cyberprobench.library")
   		(dest "libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrgblitterunilib)
   		(source "libs/hrgblitter-uni.library")
   		(dest "Libs:")
   		(confirm)
   		(help #nohelp))
   
   	(copylib
   		(prompt #hrgblitterspzlib)
   		(source "libs/hrgblitter-spz.library")
   		(dest "Libs:")
   		(confirm)
   		(help #nohelp))
   
     	(if (askbool
     		(prompt "\n'hrgblitter.library' exists in two versions. Which one should be installed ?")
     		(choices "Universal" "A4/40-A3/Z3")
     		(help "Universal works on all Amiga-Models but the special version is faster on A4000/040 or A3000-ZorroIII !")
     		(default 1))
     		(copyfiles
   				(prompt "Universal-Version ACTIVE")
   				(help "")
   				(source "libs:hrgblitter-UNI.library")
   				(optional nofail askuser)
   				(newname "hrgblitter.library")
   				(dest "Libs:"))
         		(copyfiles
         				(prompt "Special-Version ACTIVE")
         				(help "")
         				(source "libs:hrgblitter-SPZ.library")
         				(optional nofail askuser)
         				(newname "hrgblitter.library")
         				(dest "Libs:"))
			)

		(copyfiles
 			(prompt "\nInstallation of the ModeMaster (3.4 should be used together with MUI 3.6!)")
			(help @copyfiles-help)
			(source "Prefs")
			(dest "SYS:Prefs")
			(pattern "ModeMaster3.?")
			(optional nofail askuser)
			(files)
			(infos)
			(confirm)
		)

		(set UDDir
			(askdir
			(prompt "\nPlease choose a drawer for the Merlin tools?")
			(help @askdir-help)
			(default "SYS:Tools/Merlin")
			(newpath)
			)
		)

		(copyfiles
			(prompt "\nInstallation of the Merlin tools")
			(help @copyfiles-help)
			(source "Tools")
			(dest UDDir)
			(infos)
			(all)
			(confirm)
		)

		(if (askbool
			(prompt "\nShould HRControl be started after every reboot ?")
			(choices "Yes" "No")
			(help "If you select yes it will be placed in wbstartup drawer")
			(default 1))

			(copyfiles
				(prompt "\nPlacing HRControl in WBStartup drawer")
				(help @copyfiles-help)
				(source "tools/HRControl3")
				(dest "SYS:WBStartup/")
				(infos)
				(confirm)
			)
		)

		(if (askbool
			(prompt "\nShould SProDBase be started after every reboot ?")
			(choices "Yes" "No")
			(help "If you select yes it will be placed in wbstartup drawer")
			(default 1))

			(copyfiles
				(prompt "\nPlacing SProDBase in WBStartup drawer")
				(help @copyfiles-help)
				(source "tools/SProDBase3")
				(dest "SYS:WBStartup/")
				(infos)
				(confirm)
			)
		)

    		(if (askbool
    			(prompt "\nWould you like to install the online-documentation ?")
    			(choices "Yes" "No")
    			(help #nohelp)
    			(default 1))
    
    			(copyfiles
    				(prompt "\nPlacing ProBench3.guide in help:")
    				(help @copyfiles-help)
    				(source "ProBench3.guide")
    				(dest "help:")
    				(infos)
    				(confirm)
    			)
    		)

			(message "\nProDev - Firma H.Raaf\n\n"
			"The update procedure has be finished. Please reboot your machine! If you encounter problems feel free to contact us by email!\n\n"
			"EMail: m.jantz@public.ndh.com")
	)
)

(exit)
