;$VER: MasterISO_Demo v2.0 (13.11.97) 
;installer routine Copyright ©1994-1997 Asimware Innovations Inc.

(onerror (makeassign "MasterISOInst") )

(set #wbversion (getversion "libs:version.library"))
(set #wbversion (/ #wbversion 65536) )

(set @default-dest "Work:")

(set #theirlevel @user-level )

(set #English 0)

;*****
; set the language we will be using
;
(if (= @language "english") 
	(set #our_language #English) 
)



;****************************
; set English language strings
(if (= #our_language #English) (
(set #text_needwb_2 			(cat "\n\nAmigaDOS 2.0 or higher is required for MasterISO_Demo v2.x"
			 						"\n\nAn upgrade will be needed for your Amiga."
			 						"\n\nYou are currently running version " #wbversion "."
))


(set #text_abort1				"\n\nApproximately ")
(set #text_abort2				"K of disk space is needed on your SYS: volume.\n\nYou only have ")
(set #text_abort3				"K free.\n\nDelete or transfer some files from the SYS: volume and try again.")


(set #tp_ask_iso 				"Specify where the MasterISO_Demo directory will be created:" )
(set #th_ask_iso 				"A drawer called MasterISO_Demo will be created in this specified directory." )

(set #tp_create_iso			"Creating the MasterISO_Demo: directory..." )
(set #th_create_iso 			"This will create the specified directory for the program." )

(set #tp_ask_installiso 	"\n\nShould MasterISO_Demo be installed?" )
(set #th_ask_installiso_1 	"\n\nThis will copy over the MasterISO_Demo program to the ")
(set #th_ask_installiso_2 	" directory\n\nIf you do not wish the MasterISO_Demo program to be transferred to your system, skip this step.\n" )

(set #tp_copying_iso_1		"\n\nCopying the MasterISO_Demo program to the " )
(set #tp_copying_iso_2		" directory.\n" )
(set #th_copying_iso_1		"\n\nThis will copy over the MasterISO_Demo program to your")
(set #th_copying_iso_2		" directory.\n" )

(set #tp_make_projects 		"Creating the MasterISO_Demo:Projects directory..." )
(set #th_make_projects 		"This will create a sub-directory which will be used to store saved projects.")

(set #tp_copying_addendum	"\n\nCopying information files to the MasterISO_Demo:Information directory.\n" )
(set #th_copying_addendum	"\n\nThis will copy over any information text files to the MasterISO_Demo:Information directory.\n" )

(set #tp_startup 				"Inserting assignment command into the startup-sequence:\n\n" )
(set #th_startup 				(cat "Assignment commands are being inserted into your "
									"\"S:Startup-Sequence\" or \"S:User-Startup\" file to "
									"allow MasterISO_Demo to find the needed files.") )
))






;****************************
;  Need WB 2.0 or higher.
(if (< #wbversion 37)
	(abort #text_needwb_2)
)



;****************************
;  Since we are installing from a drawer, not a disk, just lock
;  the current directory
(makeassign "MasterISOInst" "" )




;****************************
; compute our space required
(set #installsize 0)
(set #installsize (+ #installsize (getsize "MasterISOInst:MasterISO") ))





;****************************
;  ask for MasterISO
(user 2)
(set #MasterISODir
	(askdir
		(prompt #tp_ask_iso )
		(help #th_ask_iso)
		(default @default-dest)
		(newpath)
	)
)
(user #theirlevel)



;****************************
; make sure there is enough space 

(if (< (getdiskspace #MasterISODir) #installsize)
	(abort  #text_abort1 (/ #installsize 1024) #text_abort2 (/ (getdiskspace "SYS:") 1024)	#text_abort3 )
)


(set #MasterISODir (tackon #MasterISODir "MasterISO_Demo"))
(set @default-dest #MasterISODir)




;****************************
;  create directory if it doesn't exist
(if (not (exists #MasterISODir (noreq)))
	(makedir #MasterISODir
		(prompt #tp_create_iso)
		(help #th_create_iso)
		(infos)
		)
)
(makeassign "MasterISODest" #MasterISODir)



;****************************
;  Install MasterISO?
(set #instMasterISO
	(askbool
		(prompt #tp_ask_installiso)
		(help #th_ask_installiso_1 #MasterISODir #th_ask_installiso_2 )
		(default 1)
	)
)

(if #instMasterISO
	((protect "MasterISODest:MasterISO" "rwed" )
	(protect "MasterISODest:MasterISO.info" "rwed" )




;***************************************************
; copy over main program 
	(run "MasterISOInst:c/lx e MasterISOInst:MasterISO.lha MasterISODest:"
		(prompt #tp_copying_iso_1 #MasterISODir #tp_copying_iso_2 )
		(confirm)
		(help  #th_copying_iso_1 #MasterISODir #th_copying_iso_2 )
	)








;***************************************************
; make Projects directory
	(set #temp "MasterISODest:Projects")
	(if (not (exists #temp (noreq)))
		(makedir #temp
			(prompt #tp_make_projects)
			(help #th_make_projects )
			(infos)
			)
	)



	

;***************************************************
; and copy over any files that may be present
	(copyfiles
		(prompt #tp_copying_addendum)
		(source "MasterISOInst:Information")
		(dest "MasterISODest:")
		(infos)
		(pattern "#?.txt")
		(help  #th_copying_addendum)
		(confirm)
	)
	




;***************************************************
; set assignments 

	(makeassign "MasterISO" #MasterISODir)

	(protect "S:User-Startup" "rwed" )
	(protect "S:Startup-Sequence" "rwed" )
	(set #assign_cmd (cat "assign MasterISO: \"" #MasterISODir "\"\n"))

	(startup "MasterISO"
		(command #assign_cmd)
		(prompt (cat #tp_startup #assign_cmd))
		(help #th_startup)
	)
))





	
(makeassign "MasterISOInst")
