; $VER: The Jormas: Epilesbian 5/7/94
; Installer Revision 1 1/7/94
; Copyright (C) The Jormas

; ### VARIABLES
;** The amount of space needed on the hard disk to install
(set EssentialHDSpace 2)
; ### INSTALL DISK NAMES
(set #DocDefaultTool "Epilesbian")
(set #Install1Disk "Epilesbian!_1")
(set #Install2Disk "Epilesbian!_2")
(set #ProgName
(cat "Epilesbian"
))
(set #HardDiskWorkingMsg
(cat "\n\n\nPlease wait...\n\n" #ProgName " is being installed to your hard disk."
))
(set #NoDiskSpaceMsg1
(cat "\nThere is insufficient available space on your hard disk to install "
	#ProgName ". You will need a minimum of "
))
(set #NoDiskSpaceMsg2
(cat "MB of free disk space.\n\nEither click \"Abort Install\" to exit this "
	"installation and delete some files from your hard disk, or click \"Proceed\" and try a "
	"different partition."
))
(set #HardDiskDestChoiceMsg
(cat "Where do you want to install " #ProgName "?"
))
(set #HardDiskDestChoiceHelp
(cat "Select the drawer where you want to install " #ProgName ", then click Proceed."
))
(set #Welcome
(cat "\n\n\n\nWelcome to the " #ProgName " installer.\n\n"
	"Copyright (C) 1994 The Jormas.\n\n\n\n"
	"Epilesbian! was written by Vesoin/The Jormas! "
))
(set #Loppu
(cat "\n\n\n\nIf you don't have LIBS:PowerPacker.library, please remember "
	"to copy it from Epilebsian!_1:Libs/ to your LIBS: assign. "
	"To run Epilebsian!, go to " (cat #DestDrawer ) " and type Epilebsian!"
	" By the way, please press both mousebuttons now to free some memory."
))
(set #InsertDiskMsg
(cat "\n\n\nPlease insert the disk labelled\n\n"
))
(set #diskhelp
	(cat "\nIf you know that the correct disk is in the drive, but you still cannot proceed, "
		"then the name of the disk is incorrect.\n"
		"Ensure that the disk name is not preceded by 'copy_of_', or blank spaces before or after the disk name.\n\n\n" @askdisk-help
	)
)

; ### PROCEDURE DEFINITIONS

;** routine to get disk specified in '#FileSourceDisk'
(procedure @GetDisk
	(
		(askdisk
			(prompt #InsertDiskMsg #FileSourceDisk)
			(help #diskhelp)
			(dest #FileSourceDisk)
		)
	)
)

;** Procedure to choose the hard disk destination
(procedure @FindHDDest
(
(@ChooseHDDest)
	(while (< (getdiskspace #DestDrawer) HDSpaceNeededBytes)
		(
			(if (< (getdiskspace #DestDrawer) HDSpaceNeededBytes)
				(
					(if (= @user-level 0)
						(
							(user 2)
							(set #UserNovice 1)
						)
					)
				(message #NoDiskSpaceMsg1 (/ (/ HDSpaceNeededBytes 1024) 1024) #NoDiskSpaceMsg2)
				(@ChooseHDDest)
				)
			)
		)
	) ;end while
	(if (= #UserNovice 1)
		(
			(user 0)
		)
	)
))

(procedure @ChooseHDDest
(
	;** Find default drawer
	(set #DefaultDest (getassign "Work" "d"))
		(if (= #DefaultDest "")
		(
			(set #DefaultDest (getassign "SYS:" "d"))
		)
		)
	;** Ask for destination
	(set #DestDrawer
		(askdir
			(prompt #HardDiskDestChoiceMsg)
			(help #HardDiskDestChoiceHelp)
		(default #DefaultDest)
		)
	)
))

(welcome)
(message #Welcome)

(set #DestDrawer "")
(set HDSpaceNeededBytes (+ (* (* EssentialHDSpace 1024) 1024) TotalSpace))
(@FindHDDest)          ;ask for destination drawer
(set #FileSourceDisk #Install1Disk)
(@GetDisk)
(working #HardDiskWorkingMsg)
(copyfiles
	(source (cat #Install1Disk ":C"))
	(dest (cat #DestDrawer ))
	(pattern "Epilesbian!")
	(optional "force")
)
(copyfiles
	(source (cat #Install1Disk ":"))
	(dest (cat #DestDrawer ))
	(pattern "*.(mod|pic)")
	(optional "force")
)

(complete 50)
(set #FileSourceDisk #Install2Disk)
(@GetDisk)
(working #HardDiskWorkingMsg)
(copyfiles
	(source (cat #Install2Disk ":"))
	(dest (cat #DestDrawer ))
	(pattern "*.(mod|pic)")
	(optional "force")
)

(complete 100)
(message #Loppu)
