; Installer Script for EZCron
; 01/17/96  Jim Hines

; set up an error cleanup routine
(onerror
    (makeassign "EZsrc" (safe))
    (makeassign "EZdest" (safe))
)

;started
(complete 0)

;cancel the assign in case of installation restart
(makeassign "EZsrc" (safe))
(makeassign "EZdest" (safe))

; get the dest dir for EZCron (create it if it does not exist)
(set ez_dest
    (tackon
        (askdir
            (prompt "Where should EZCron be installed? A drawer named `EZCron' will be created there.")
            (help @askdir-help)
            (default @default-dest)
        )
        "EZCron"
    )
)
(makeassign "EZdest"
    (pathonly ez_dest)
    (safe)
)
(if (exists "EZdest:EZCron")
    (+ 1 1)
    (makedir
        "EZdest:EZCron"
        (infos)
        (safe)
    )
)

(if (exists "EZdest:EZCron/Prefs")
    (+ 1 1)
    (makedir
        "EZdest:EZCron/Prefs"
        (safe)
    )
)

(if (exists "EZdest:EZCron/Doc")
    (+ 1 1)
    (makedir
        "EZdest:EZCron/Doc"
        (safe)
		(infos)
    )
)


(if (exists "EZdest:EZCron/rexx")
    (+ 1 1)
    (makedir
        "EZdest:EZCron/rexx"
        (safe)
    )
)

;We now have a valid destination, so tell Installer where EZCron will end up
;so the exit page will be correct.
(set @default-dest ez_dest)

;copy program files from source to dest
        (copyfiles
            (source "EZCron")
            (dest "EZdest:EZCron")
            (infos)
        )

(copyfiles
    (source "EZCronGUI")
    (dest "EZdest:EZCron")
    (infos)
)


;copy program files from source to dest
(copyfiles
	(source "EZCronGUI.info")
    (dest "EZdest:EZCron")
    (infos)
)

(copyfiles
    (source "ezc.gui")
    (dest "EZdest:EZCron")
)


;copy program files from source to dest
        (copyfiles
            (source "ezcron.readme")
            (dest "EZdest:EZCron")
            (infos)
        )

;copy program files from source to dest
        (copyfiles
            (source "Doc")
            (dest "EZdest:EZCron/Doc")
        (all)
        )


(working "Copying the rexx scripts.")
;copy rexx files from source to dest
        (copyfiles
            (source "rexx")
            (dest "EZdest:EZCron/rexx")
		(all)
        )

(working "Copying the prefs files.")
;copy prefs files from source to dest
        (copyfiles
            (source "prefs")
            (dest "EZdest:EZCron/prefs")
		(all)
        )



;copy program files from source to dest
        (copyfiles
            (source "s/cron.config")
            (dest "s:")
            (infos)
        )


;copy library files from source to dest with version checking
        (copylib
            (source "Libs/arexxport.library")
            (dest "libs:")
        )

;copy library files from source to dest with version checking
        (copylib
            (source "Libs/rexxreqtools.library")
            (dest "libs:")
        )

;copy library files from source to dest with version checking
        (copylib
            (source "rexxc/Varexx")
            (dest "sys:rexxc")
        )

;copy library files from source to dest with version checking
        (copylib
            (source "rexxc/VXC")
            (dest "sys:rexxc")
        )


;add the assign for EZCron: to user-startup
(set ezassign ("Assign EZCron: \"%s\"\n" ez_dest))

;add program startup to s:user-startup sequence
(set ezrexxstart ("run >NIL: rx >NIL: EZCron:EZCron start \n"))
(startup
        "EZCron"
        (prompt "EZCron requires that an AmigaDOS assign be created. It WILL NOT work properly without it! The following will be added to your s:user-startup file:\n\n"
            ezassign
            "\nIs it okay to add this now?"
            "\n\nIMPORTANT: REBOOT YOUR COMPUTER BEFORE EZCRON FOR THE FIRST TIME.")
        (help @startup-help)
        (command ezassign)
		(command ezrexxstart)
)

(complete 95)

;un-snapshot the EZCron drawer icon
(tooltype
    (dest ez_dest)
    (noposition)
)


;finished with install
(complete 100)

;cleanup
(makeassign "EZsrc" (safe))
(makeassign "EZdest" (safe))

;display the readme file
(run "run more EZCron.readme" (safe))

;leave
(exit)

