

; Photogenics Installer script. © Almathera 1994-5. All rights reserved.

; $VER: Photogenics-SE_Installer 1.0 (22.08.95)

; Authored & Hacked To Death by THP / Citrus'95.

;                                   <The idiot wing of Almathera>

;  pain / adrenalin / alcohol / irony. all else is futile.

;                And now over to Tom with the weather.


; /**************************************************************************/
;                             The "wurdZ"
; /**************************************************************************/


(set #GOINGIN
	(cat "\n\nWelcome to the Photogenics (TM) installation system\n\n\n"
	     "1.2a Special Edition Bundled exclusively for Amiga Technologies GmbH\n\n\n"
	     "Photogenics © 1994-5 Paul Nolan & Almathera Systems Ltd."
	     " All Rights Reserved.")
)

(set #MAINPROG-PROMPT
	(cat "Where do you wish to install Photogenics SE?\n"
	     "(A drawer named 'Photogenics-SE' will be created in which the"
	     " program will reside)")
)

(set #MAINPROG-HELP
	(cat "\nThe Photogenics package is extremely modular - effects, loaders and"
	     " savers, brushes and image manipulators are all separate files"
	     " which the main program calls as-and-when it needs to. This makes"
	     " efficient use of memory.\n\n"
	     "When installed, the main program sits at the top of its directory"
	     " tree under which drawers containing the various external modules"
	     " are positioned - these will be installed soon.")
)

(set #SUPPORT-HELP
	(cat "\n\n\n\nThis section installs the generic loader, saver, brush"
	     " and effects modules which the Photogenics main program calls."
	     " These all sit in their various subdirectories, so it's just"
	     " a simple recursive copy with no version-check.")
)

(set #PGXDIR "Creating Photogenics-SE directory...")

(set #PGX-BINARY "Installing Photogenics SE main program...")

(set #GENIXFONT-HELP
	(cat "\n\n\n\n\nInstalling Photogenics font into FONTS: - this is the"
	     " internal font used by the program.")
)

(set #PGX-ICONPROMPT "Installing Photogenics-SE icon...")

(set #PGX-ICONPOSPROMPT "Setting up icon position")

(set #PGX-ENVARC "Creating Photogenics directory in ENVARC:...")

(set #PGX-ENV "Creating Photogenics directory in ENV:...")

(set #PGX-DATA-PROMPT "Installing Photogenics-SE data files...")

(set #PGX-FONT-PROMPT "Installing Photogenics-SE font in FONTS:")

(set #PGX-ASL "Checking and updating ASL.library, if needed...")

(set #PGX-SETPATCH "Checking and updating SetPatch. Photogenics *requires* v40.16")

(set #USERSTARTUP-HELP
	(cat "\n\nPhotogenics SE needs an AmigaDOS assignment so it knows where"
	     " to find all its program modules.\n\nThe assignment PGSSE: is best"
	     " made on bootup - the standard way of doing this being an extra"
	     " few lines in the file S:User-Startup.\n\nThis section of the"
	     " install procedure will add these lines for you.")
)

(set #OLDBOX-HELP "\n You must be using at least KickStart 3.1 (V40) to install or run Photogenics SE!")

(set #FINAL-MESSAGE 
	(cat "\n"
	     "Photogenics 1.2a Special Edition has been installed.\n\n"
	     "Go ahead and start Photogenics by double-clicking on its"
	     " icon - this can be found in the drawer in which you"
	     " installed the package.\n\n( %s )")
)

(set #STARTUP-1
	(cat "\n\n\nDo you want the installer to automatically make"
	     " the required changes for %s to S:User-StartUP?\n\n"
	     "If you don't, it will create a script file containing"
	     " commands which you should add to your S:User-StartUP script.")
)

(set #STARTUP-2
	(cat "\n\n\nNow adding the %s lines to S:User-StartUP.\n\n"
	     "These are:\n\n%s")
)

(set #STARTUP-3
	(cat "\n\n\n\nThe file:\n\n%s\n\nhas been "
	     "generated, which you must add to S:User-StartUP manually.")
)


; /**************************************************************************/
;                   there's something dead in here
; /**************************************************************************/


(procedure do-the-startup
	(
	(if
		(askbool
			(prompt
				(#STARTUP-1 SECTION-NAME)
				)
			(help STARTUP-HELP))
		(startup SECTION-NAME
			(prompt
				(#STARTUP-2 SECTION-NAME ADD-TO-USER-STARTUP)
				)
			(help STARTUP-HELP)
			(command ADD-TO-USER-STARTUP))
		(
		(textfile
			(dest (tackon OUTPUT STARTUP-FILE))
			(append ADD-TO-USER-STARTUP))

		(message
			(#STARTUP-3 (tackon OUTPUT STARTUP-FILE))
			)
		)
	)
	)
)


; /**************************************************************************/
;                  Oh no, it's the Central Cavern!
; /**************************************************************************/


(if (< (/ (getversion) 65536) 40)
	((abort #OLDBOX-HELP))
)

(run "Avail >nil: <nil: FLUSH")

(message #GOINGIN)

(if (= (getassign "WORK" "v") "" )
	(set NORMAL @default-dest)
	(set NORMAL "WORK:")
)

(set BINARIES
	(askdir
		(prompt #MAINPROG-PROMPT)
		(help #MAINPROG-HELP)
		(default NORMAL)
		(disk)
	)
)
(set BINARIES (tackon BINARIES "Photogenics-SE"))

(set @default-dest BINARIES)

(set ADD-TO-USER-STARTUP (cat "assign pgsse: \"" BINARIES "\"\n"))

              ; Copying the main bit...

(if ( < (exists BINARIES (noreq) ) 2)
	(makedir BINARIES
		(prompt #PGXDIR)
		(help @makedir-help) 
		(infos)
	)
)

(copyfiles
	(prompt #PGX-BINARY)
	(help #MAINPROG-HELP)
	(source "Photogenics-SE")
	(dest BINARIES)
	(confirm)
)

(copyfiles
	(prompt #PGX-ICONPROMPT)
	(help #MAINPROG-HELP)
	(source "Photogenics-SE.icon")
	(dest BINARIES)
	(newname "Photogenics-SE.info")
)

(tooltype
	(prompt #PGX-ICONPOSPROMPT)
	(help #MAINPROG-HELP)
	(dest (tackon BINARIES "Photogenics-SE.info"))
	(noposition)
	(setstack 25000)
)

; ENV variables now used for all preference files. GIO and main code...

(if ( < (exists "envarc:Photogenics" (noreq) ) 2)
	(
	(makedir "envarc:Photogenics"
		(prompt #PGX-ENVARC)
		(help @makedir-help) 
		)

	(makedir "env:Photogenics"
		(prompt #PGX-ENV)
		(help @makedir-help) 
		)
	)
)

(copyfiles
	(prompt #PGX-DATA-PROMPT)
	(help #SUPPORT-HELP)
	(source "Data/")
	(dest (tackon BINARIES "Data") )
	(all)
	(confirm)
)

(copyfiles
	(prompt #PGX-FONT-PROMPT)
	(help #GENIXFONT-HELP)
	(source "Fonts/")
	(dest "fonts:")
	(pattern "Photogenics#?")
	(fonts)
	(confirm)
)

(copylib
	(prompt #PGX-ASL)
	(help @copylib-help)
	(source "libs/asl.library")
	(dest "libs:")
	(confirm)
)

(copylib
	(prompt #PGX-SETPATCH)
	(help @copylib-help)
	(source "c/SetPatch")
	(dest "c:")
	(confirm)
)

(run "c/SetPatch QUIET")


(set SECTION-NAME "Photogenics-SE")
(set STARTUP-HELP #USERSTARTUP-HELP)
(set OUTPUT BINARIES)
(set STARTUP-FILE "add-to-user-startup")
(do-the-startup)

(makeassign "pgsse" BINARIES)

(message
	( #FINAL-MESSAGE BINARIES )
	)

(exit (quiet))

