;
;         IMPACT! Installer
;
;         by Andrew Frerking
;       ©1994 Dynamic Realities
;
; $VER: IMPACT! Installer 1.0b (1-07-95)
;

(set @appname "IMPACT!")


(set default_dir (if (exists "Work:Toaster" (noreq))
                     ("Work:Toaster")
                     ("SYS:")))


;************** Help Text **************

(set help_find_area (cat "The installer needs to know where to install "
                       "IMPACT!  The default is your Video Toaster Drawer.  There "
                       "will be a directory called 'IMPACT!' created here.\n"))

(set help_insert_disk (cat "The Installer needs this disk to be inserted "
                           "to continue the installation process."))

;************** Main **************

(complete 0)
(welcome)


(set impact_dir (askdir (prompt (cat "Please locate the area where "
                                    "you wish to install IMPACT!  There will be "
                                    "a directory called IMPACT! created here.\n"))
                       (default default_dir)
                       (help help_find_area)))

(set @default-dest impact_dir)

(set tempdir (if (= ":" (substr impact_dir (- (strlen impact_dir) 1) 1))
    impact_dir
    (cat impact_dir "/")))

(working "\n\nDecompressing IMPACT! to " impact_dir)
(run ("c/lx x impact!.lha \"%s\"" tempdir))

(complete 50)

(copyfiles (source "Defaults")
           (dest "ENV:mui")
           (all))

(copyfiles (source "Defaults")
           (dest "ENVARC:mui")
           (all))

(complete 60)

(if (exists "MUI:" (noreq))
   ((copylib
      (prompt ("Copying muimaster.library..."))
      (help "This library is necessary."
       @copylib-help)
    (source "libs/muimaster.library")
    (dest "MUI:libs")
    (confirm))
    (complete 100)
    (exit)))

(set mui_dir (tackon impact_dir "IMPACT!"))

(working "\n\nDecompressing MUI to " mui_dir)
(run ("c/lx x mui.lha \"%s/\"" mui_dir))

(complete 90)
(set destination (tackon mui_dir "MUI"))

(startup "MUI"
	(prompt "Some required commands will be added to your \"s:user-startup\" file.")
    (help @startup-help)
	(command "if exists \"" destination "\"\n")
	(command "   assign MUI: \"" destination "\"\n")
	(command "   if exists MUI:Libs\n")
	(command "      assign add LIBS: MUI:Libs\n")
	(command "   endif\n")
	(command "   if exists MUI:Locale\n")
	(command "      assign add LOCALE: MUI:Locale\n")
	(command "   endif\n")
	(command "   version >nil: exec.library 39\n")
	(command "   if not warn\n")
	(command "      if exists MUI:Docs\n")
	(command "         if exists HELP:dummy ; do not remove\n")
	(command "         endif                ; this entry!\n")
	(command "         assign add HELP: MUI:Docs\n")
	(command "      endif\n")
	(command "   endif\n")
	(command "endif")
)


(complete 100)
(exit "Please reboot your computer before running IMPACT!")
