;Standard Installer script
;Written by Marco Biondi
;@1995/96 Light Shock software s.n.c

(set destinazione @default-dest)

(set destinazione
	(askdir 
		(prompt ("Choose the drawer where %s should be installed:" @app-name))
		(help @askdir-help)
		(default destinazione)
	)
)

(if (NOT (exists destinazione (quiet))) 
	(abort "The specified path is not a valid path!")
)

(set spaziorichiesto 3520)

(set disponibile (/ (getdiskspace destinazione) 1024) )

(if (< disponibile spaziorichiesto)
	(set domanda "WARNING : THE AVAILABLE SPACE IS INSUFFICIENT.\nPROCEED WITH INSTALLATION ?"
	)
	(set domanda ""
	)	
)

(message 
	("The installation of %s requires about %ld Kbytes of free disk space.\n\n"
		@app-name
		spaziorichiesto
	)
	("In the choosen drawer (%s) there are %ld Kbytes availables.\n\n"
		destinazione
		disponibile
	)
	domanda
)

(copyfiles
	(prompt "Writing files...")
	(help @copyfiles-help)
	(source "FSpirit-INSTALL:FsDiskID")
	(dest "T:")
)

(copyfiles
	(help @copyfiles-help)
	(source "FSpirit-INSTALL:Disk2Bin")
	(dest "T:")
)

(copyfiles
	(help @copyfiles-help)
	(source "FSpirit-INSTALL:Spirit")
	(dest "T:")
)

(copyfiles
	(help @copyfiles-help)
	(source "FSpirit-INSTALL:Spirit.in")
	(dest "T:")
)

(complete 1)

(working "Insert Disk 1 into DF0:")

(until
	(= "1\n"
		(
			(run "T:FsDiskID >env:Number")
			(set risultato (getenv "Number"))
		)
	)
)

(message "Installing Disk 1")

(run ("T:Disk2Bin %s" (tackon destinazione "Spirit1.bin")))

(complete 25)

(working "Insert Disk 2 into DF0:")

(until
	(= "2\n"
		(
			(run "T:FsDiskID >env:Number")
			(set risultato (getenv "Number"))
		)
	)
)

(message "Installing Disk 2")

(run ("T:Disk2Bin %s" (tackon destinazione "Spirit2.bin")))

(complete 49)

(working "Insert Disk 3 into DF0:")

(until
	(= "3\n"
		(
			(run "T:FsDiskID >env:Number")
			(set risultato (getenv "Number"))
		)
	)
)

(message "Installing Disk 3")

(run ("T:Disk2Bin %s" (tackon destinazione "Spirit3.bin")))

(complete 75)

(working "Insert Disk 4 into DF0:")

(until
	(= "4\n"
		(
			(run "T:FsDiskID >env:Number")
			(set risultato (getenv "Number"))
		)
	)
)

(message "Installing Disk 4")

(run ("T:Disk2Bin %s" (tackon destinazione "Spirit4.bin")))

(complete 99)

(copyfiles
	(prompt "Writing files...")
	(help @copyfiles-help)
	(source "T:Spirit")
	(dest destinazione)
)

(copyfiles
	(prompt "Writing files...")
	(help @copyfiles-help)
	(source "T:Spirit.in")
	(dest destinazione)
	(newname "Spirit.info")
)

(complete 100)

(exit "To run the game double-click on the icon.\n\n"
	"WARNING: You can exit from the game only if you RESET your computer\n\n"
	"Have fun!\n\n" "@1995/96 Light Shock software s.n.c." 
)

