; * $VER: Install-FLIGHT RECORDER v1.0 (02.21.93)
; * It handles both FULL Installation and upgrade from FIGHTER DUEL PRO

(set OSVersion (/ (getversion) 65536))

(onerror
	(makeassign "Disk1" (safe))
	(makeassign "Disk2" (safe))
	(makeassign "Disk3" (safe))
)
(set Libs_Dir "Libs:")
(set FlightRecorder_dest 
	(tackon
		(askdir
			(prompt "In which disk or drawer should FlightRecorder be installed?")
			(help @askdir-help)
			(default @default-dest)
		)
		"FlightRecorder"
	)
)

; ****** Check for enough free space on volume  *****

(set hd_space (getdiskspace(pathonly(FlightRecorder_dest))))

(if (< hd_space 3000000)
	(abort
            
            "In order to install FLIGHT RECORDER,\n"
	    "the hard disk must have 3000000 bytes of free space.\n\n"

            (pathonly (FlightRecorder_dest))"\n" 

	    ("only has %ld free bytes.\n" hd_space) 
            ("Still need %ld free bytes.\n" (- 3000000 hd_space))
	    "\nPlease free some space and try reinstalling ")
)
; ****** now lock on to volume 'Disk1'
(askdisk
	(prompt "Please insert the disk labeled \"Disk1\".\n")
	(help	"The FlightRecorder program and data files will\n"
		" be copied from the \"Disk1\" into your system.")
	(dest  "Disk1")
)
; ****** make FlightRecorder drawer & copy icon 
(makedir FlightRecorder_dest (infos))
(set @default-dest FlightRecorder_dest)
(copyfiles
	(source "Disk1:FlightRecorder")
	(dest FlightRecorder_dest)
        (infos)
)
(copyfiles
	(source "Disk1:Flight.config")
	(dest FlightRecorder_dest)
        (infos)
)
; *** only need Arp file requester icon for Kickstart 1.3 machines
(if (< OSVersion 37) 
	(copylib
		(prompt	("Copying ARP.LIBRARY to LIBS:"))
		(help	
			"\n"
			"If you already have a copy of ARP.library in the selected destination directory, the library "
			"included on the distribution disk will be compared to the one you "
			"already have.  If your current library is an old version, the newer "
			"version will be installed.\n"
			"\n"
		)
		(source "Disk1:libs/ARP.LIBRARY")
		(dest Libs_Dir)
		(confirm)
	)
)
(if (< OSVersion 37) 
	(copyfiles ; 
		(source "Disk1:Icons/FlightRecorder.INFO")
		(dest FlightRecorder_dest)
	)
)
; ***** Always copy disk version of FDRCX.LIBRARY
(copyfiles
		(prompt	("Copying FDRCX.LIBRARY to LIBS:"))
		(help	
			"\n"
			"The FDRCX.library is needed by FLIGHT RECORDER for all of its Motion Path Conversions"
			"\n"
		)
		(source "Disk1:libs/FDRCX.LIBRARY")
		(dest Libs_dir)
		(confirm)
)
(complete 10)
(copyfiles
	(source "Disk1:Recorder.readme")
	(dest FlightRecorder_dest)
	(infos)
)
(complete 11)
(copyfiles
	(source "Disk1:Readme1st")
	(dest FlightRecorder_dest)
	(infos)
)
(complete 12)
(copyfiles
	(source "Disk1:Data")
	(dest (tackon FlightRecorder_dest "Data")); make DATA directory
	(all)
)
(complete 20)
(copyfiles
	(source "Disk1:Objects")
	(dest (tackon FlightRecorder_dest "Objects")); make Objects directory
	(all)
)
(copyfiles
	(source "Disk1:IObjects")
	(dest (tackon FlightRecorder_dest "IObjects")); make IObjects directory
	(all)
)
(complete 35)
(copyfiles
	(source "Disk1:Scenes")
	(dest (tackon FlightRecorder_dest "Scenes")); make Scenes directory
	(all)
)
(complete 40)
(copyfiles
	(source "Disk1:Examples")
	(dest (tackon FlightRecorder_dest "Examples")); make Examples directory
	(all)
)
(complete 50)
; ****** This is the end if this is an update installation from FIGHTER DUEL PRO
; ****** Get lock on Disk2
(askdisk
	(prompt 
	"All files specific to FLIGHT RECORDER have been installed.\n"
	"\n"
	"If you are upgrading from FIGHTER DUEL PRO and installing to the same directory,"
	" you may abort the installation now. \n"
	"To continue the FULL installation,\n"
	"Please insert the disk labeled \"Disk2\".\n"
	)
	(help	"The \"Disk2\" contains additional data usefull to "
			"FLIGHT RECORDER."
	)
	(dest  "Disk2")
)
(copyfiles
	(source "Disk2:Data")
	(dest (tackon FlightRecorder_dest "Data")); **** Copy disk2 data directory files
	(all)
)
(complete 75)
; **** Get lock on Disk3
(askdisk
	(prompt "Please insert the disk labeled \"Disk3\".")
	(help	"The \"Disk3\" contains additional data usefull to "
			"FlightRecorder.")
	(dest  "Disk3")
)
(copyfiles
	(source "Disk3:Data")
	(dest (tackon FlightRecorder_dest "Data")); **** Copy disk3 data directory
	(all)
)
(complete 100)
; Cleanup
(makeassign "Disk1" (safe))
(makeassign "Disk2" (safe))
(makeassign "Disk3" (safe))
(exit)
