;
;$VER: Uridium-II HD Installer script v1.00 (c) 1997 John Girvin
;

(welcome "Welcome to the Uridium-II Hard Drive Installer")
(set @app-name (cat "Uridium-II_HD"))
(set #UROOTDIR "DH0:")
(set #UDESTDIR "")
(set #UDATFILE1 "")
(set #UDATFILE2 "")
(set #UMDRET 0)

(if
	(<> @user-level 2)
	(abort "You must select 'Expert' user level")
)

(message "\n\nWelcome to the Uridium-II Hard Drive Installer\n"
		 "(c) 1997 John Girvin\n\n"
		 "Please read the documentation thoroughly before"
		 " attempting to use this installer!\n\n"
		 "This is version 1.00\n\n"
		 "Click 'Proceed' to begin."
)

(set #UROOTDIR
	(askdir
		(prompt "Where would you like Uridium-II installed?\n"
				"(a new drawer called 'Uridium-II' will be created here)"
		)
		(help @askdir-help)
		(default #UROOTDIR)
	)
)
(set #UDESTDIR (tackon #UROOTDIR "Uridium-II/"))
(set @default-dest #UDESTDIR)
(set #UDATFILE1 (tackon #UDESTDIR "Disk.1"))
(set #UDATFILE2 (tackon #UDESTDIR "Disk.2"))

(makedir #UDESTDIR
	(prompt "I will now create the directory '" #UDESTDIR "'")
	(help @makedir-help)
	(infos)
	(confirm)
)

(message "\n\n\nPlease insert Uridium-II Disk 1 in drive DF0:\n\n"
         "*** WARNING ***\n"
         "Multitasking will be disabled while the disk image"
         " is being created. After inserting the disk, please"
         " ensure that all disk and network activity has finished"
         " before clicking 'Proceed'.\n\n"
		 "Click 'Proceed' when ready."
)

(working "Creating image of disk 1 in '" #UDATFILE1 "'\n\n"
         "*** Multitasking is disabled. DON`T PANIC! ***"
)
(set #UMDRET  (run (cat "U2MakeDat " #UDATFILE1)))

(if (<> #UMDRET 0)
	(abort (cat "Could not create image of disk 1!\n\nError: " #UMDRET))
)

(message "\n\n\nPlease insert Uridium-II Disk 2 in drive DF0:\n\n"
         "*** WARNING ***\n"
         "Multitasking will be disabled while the disk image"
         " is being created. After inserting the disk, please"
         " ensure that all disk and network activity has finished"
         " before clicking 'Proceed'.\n\n"
		 "Click 'Proceed' when ready."
)

(working "Creating image of disk 2 in '" #UDATFILE2 "'\n\n"
         "*** Multitasking is disabled. DON`T PANIC! ***"
)
(set #UMDRET  (run (cat "U2MakeDat " #UDATFILE2)))

(if (<> #UMDRET 0)
	(abort (cat "Could not create image of disk 2!\n\nError: " #UMDRET))
)

(copyfiles
	(prompt "Copying HD drawer icon")
	(help @copyfiles-help)
	(source "Uridium-II.inf")
	(newname "Uridium-II.info")
	(dest #UROOTDIR)
	(nogauge)
	(optional fail force)
)

(copyfiles
	(prompt "Copying WHDLoad program")
	(help @copyfiles-help)
	(source "WHDLoad")
	(dest #UDESTDIR)
	(nogauge)
	(noposition)
	(optional fail force)
)

(copyfiles
	(prompt "Copying slave program")
	(help @copyfiles-help)
	(source "Uridium-II_HD")
	(dest #UDESTDIR)
	(nogauge)
	(noposition)
	(optional fail force)
)

(copyfiles
	(prompt "Copying slave program icon")
	(help @copyfiles-help)
	(source "Uridium-II_HD.inf")
	(newname "Uridium-II_HD.info")
	(dest #UDESTDIR)
	(nogauge)
	(optional fail force)
)
