; This is test of many of the features of the Installer
; Prints out debugging info if run from CLI

(set @default-dest "T:")

(transcript "Installing PEGGER Libraries")
(working "Installing PEGGER Libraries" )

(copylib
	(transcript "copylib")
	(prompt "Installing the pegger.library.")
	(help @copylib-help)
	(source "Pegger:Libs/pegger.library")
	(dest "LIBS:")
	(confirm)
)

(copylib
	(transcript "copylib")
	(prompt "Installing the peggersnoop.library.")
	(help @copylib-help)
	(source "Pegger:Libs/peggersnoop.library")
	(dest "LIBS:")
	(confirm)
)

(copylib
	(transcript "copylib")
	(prompt "Installing the dctv.library.")
	(help @copylib-help)
	(source "Pegger:Libs/dctv.library")
	(dest "LIBS:")
	(confirm)
)

(transcript "Getting Location of PEGGER Directory")

(set pegger_dir "Work:")

(if (NOT (exists pegger_dir (noreq)))
	(set pegger_dir "Sys:")
)

(set pegger_dir
	(askdir
		(prompt
		"PEGGER requires 800K of free space on your disk. "
		"Where would you like PEGGER's directory installed?")
		(help @askdir-help)
		(default pegger_dir)
	)
)

(if (NOT (exists (tackon pegger_dir "PEGGER")(noreq)))
	(
	(copyfiles
		(source "Pegger:PEGGER.info")
		(dest pegger_dir))
	(tooltype
		(dest (tackon pegger_dir "PEGGER"))
		(noposition))
	(makedir (tackon pegger_dir "PEGGER"))
	)
)

(set pegger_dir (tackon pegger_dir "PEGGER"))

(set @default-dest pegger_dir)

(transcript "Installing PEGGER Program")

(copyfiles
	(prompt "Installing PEGGER program.")
	(help @copyfiles-help)
	(source "Pegger:PEGGER/PEGGER")
	(infos)
	(dest pegger_dir)
)

(transcript "Installing PEGGER ReadMe Files")
(copyfiles
	(prompt "Installing Pegger ReadMe Files.")
	(help @copyfiles-help)
	(source "Pegger:Pegger/PEGGERChanges")
	(infos)
	(dest pegger_dir)
)

(transcript "Installing PEGGER data files.")

(working "Installing PEGGER Data Files" )

(set dataok
	(run (cat "Pegger:c/PeggerCreate " pegger_dir) )
)

(if (= dataok 0)
	((set dataok
		(askbool
			(prompt "Could not install all of PEGGER's data files."
			" Proceed with PEGGER installation?")
			(help)
			(choices "Proceed" "Cancel")
		)
	)
	(if (= dataok 1)
		(transcript "PEGGER Installation Aborted")
		(exit "PEGGER Installation Aborted")
	))
)

(set installfiles
	(askoptions
		(prompt "Which of the following optional directorys should be installed in the PEGGER Directory?")
		(help @askoptions-help)
		(choices "TutorialFiles" "Rexx")
		(default 3)
	)
)

(if (BITAND installfiles 2)
	(
	(transcript "Installing PEGGER ARexx scripts.")

	(if (NOT (exists (tackon pegger_dir "Rexx") (noreq)))
		(
		(copyfiles
			(source "Pegger:Pegger/Rexx.info")
			(dest pegger_dir))
		(makedir (tackon pegger_dir "Rexx"))
		)
	)

	(copyfiles
		(prompt "Installing PEGGER ARexx scripts.")
		(help @copyfiles-help)
		(source "Pegger:Pegger/Rexx")
		(all)
		(infos)
		(dest (tackon pegger_dir "Rexx"))
	)
	)
)

(if (BITAND installfiles 1)
	(
	(transcript "Installing PEGGER Tutorial JPEG files.")

	(if (NOT (exists (tackon pegger_dir "TutorialFiles") (noreq)))
		(
		(copyfiles
			(source "Pegger:Pegger/TutorialFiles.info")
			(dest pegger_dir))
		(makedir (tackon pegger_dir "TutorialFiles"))
		)
	)

	(copyfiles
		(prompt "Installing PEGGER Tutorial JPEG files.")
		(help @copyfiles-help)
		(source "Pegger:Pegger/TutorialFiles")
		(all)
		(infos)
		(dest (tackon pegger_dir "TutorialFiles"))
	)

	(if (NOT (exists (tackon pegger_dir "Images") (noreq)))
		(
		(copyfiles
			(source "Pegger:Pegger/Images.info")
			(dest pegger_dir))
		(makedir (tackon pegger_dir "Images"))
		)
	)

	(if (NOT (exists (tackon pegger_dir "JPEGs") (noreq)))
		(
		(copyfiles
			(source "Pegger:Pegger/JPEGs.info")
			(dest pegger_dir))
		(makedir (tackon pegger_dir "JPEGs"))
		)
	)
	)
)

(transcript "Setting PEGGER ToolTypes")

(tooltype
	(dest (tackon pegger_dir "PEGGER"))
	(settooltype "PEGGER_DIR" (cat "\"" pegger_dir "\""))
	(settooltype "SCREEN_TYPE" "NOLACE")
	(settooltype "SCREEN" "WORKBENCH")
	(settooltype "SCREEN_QUIET" "NO")
	(settooltype "SNOOP_WORKBENCH_MENU" "YES")
	(settooltype "SNOOP_WORKBENCH_ICON" "YES")
	(settooltype "SNOOP_POPUP" "NO")
	(settooltype "SNOOP_POPKEY" "alt p")
	(settooltype "SNOOP_DELAY" "0")
	(settooltype "SNOOP_CRIPPLE" "NO")
	(settooltype "CJPEG_WORKBENCH_MENU" "YES")
	(settooltype "CJPEG_WORKBENCH_ICON" "YES")
	(settooltype "CJPEG_POPUP" "NO")
	(settooltype "CJPEG_POPKEY" "alt c")
	(settooltype "CJPEG_PRIORITY" "0")
	(settooltype "CJPEG_SHUTDOWN" "0")
	(settooltype "QUALITY" "85")
	(settooltype "DJPEG_WORKBENCH_MENU" "YES")
	(settooltype "DJPEG_WORKBENCH_ICON" "YES")
	(settooltype "DJPEG_POPUP" "NO")
	(settooltype "DJPEG_POPKEY" "alt d")
	(settooltype "DJPEG_PRIORITY" "0")
	(settooltype "DJPEG_SHUTDOWN" "0")
	(settooltype "SMOOTHING" "OFF")
	(settooltype "DONOTWAIT" "")
	(settooltype "CJPEG_H_SAMPLE" "2")
	(settooltype "CJPEG_V_SAMPLE" "2")
	(settooltype "TEMPORARY_DIR" (cat "\"T:\""))
	(settooltype "BACKUP_TEMP_DIR" (cat "\"" pegger_dir "\""))
)

(transcript "Installation Completed")
