; Install script for EClock 1.0


;*********
; Strings
;*********

(set #bad-kick
(cat "You must be using Kickstart 2.04 or higher to install using this script!"
))

(set #copy-main "\n\n\n\n\nInstall EClock main program?")
(set #copy-main-help
(cat "\nThis will install the EClock main program (recommended)."
))

(set #copy-prefs "\n\n\n\n\nInstall EClockPrefs program?")
(set #copy-prefs-help
(cat "\nThis will install the EClockPrefs program (recommended)."
))

(set #copy-ereq "\n\n\n\n\nInstall ERequester program?")
(set #copy-ereq-help
(cat "\nThis will install the ERequester program (recommended)."
))

(set #copy-cats "\n\n\n\n\nDo you want to install EClockPrefs catalog files?")
(set #copy-cats-help
(cat "\nThis will install the EClockPrefs catalog files (recommended)."
))

(set #copy-docs "\n\n\n\n\nDo you want to install EClock documentation?")
(set #copy-docs-help
(cat "\nThis will install the EClock documentation (recommended)."
))

(set #install-msg
(cat "Installation program for EClock V1.0\n\n"
"The Clock you won't stand to miss if you've seen it once :-)\n\n"
"©1993-94 by Bernd Grunwald. All rights reserved.\n\n"
"PLEASE read the documentation first!\n\n"
"This program is Shareware.\n"
"If you use it longer than 1 week you have to register\n"
"See doc file for more information.\n"
))


;*******************************************
; make sure Kick 2.0 or higher is available
;*******************************************

(if (< (/ (getversion) 65536) 37)
(
    (abort #bad-kick)
))


(message #install-msg)

(welcome)

;*********************
; Install Main Program
;*********************


(set oldlevel @user-level)
(if (= oldlevel 0)
    (user 1)
)

(set eclockmain-dir
    (askdir
        (prompt "Please select directory where to store EClock main program:\n"
        )
        (help @askdir-help)
        (default ("SYS:WBStartup"))
        (newpath)
    )
)

(set @default-dest eclockmain-dir)

(user oldlevel)

(if
    (askbool
        (prompt #copy-main)
        (help #copy-main-help)
        (default 1)
    )
    (
        (copyfiles
            (prompt "Installing EClock main program...")
            (source "EClock")
            (help #copy-main-help)
            (dest @default-dest)
            (infos)
        )
    )
)

;**********************
; Install Prefs Program
;**********************

(set oldlevel @user-level)
(if (= oldlevel 0)
    (user 1)
)

(set eclockprefs-dir
    (askdir
        (prompt "Please select directory where to store EClockPrefs program:\n"
        )
        (help @askdir-help)
        (default ("SYS:Prefs"))
        (newpath)
    )
)

(set @default-dest eclockprefs-dir)

(user oldlevel)

(if
    (askbool
        (prompt #copy-prefs)
        (help #copy-prefs-help)
        (default 1)
    )
    (
        (copyfiles
            (prompt "Installing EClockPrefs program...")
            (source "EClockPrefs")
            (help #copy-prefs-help)
            (dest @default-dest)
            (infos)
        )
    )
)

;***************************
; Install ERequester Program
;***************************

(set oldlevel @user-level)
(if (= oldlevel 0)
    (user 1)
)

(set ereq-dir
    (askdir
        (prompt "Please select directory where to store ERequester program:\n"
        )
        (help @askdir-help)
        (default ("C:"))
        (newpath)
    )
)

(set @default-dest ereq-dir)

(user oldlevel)

(if
    (askbool
        (prompt #copy-ereq)
        (help #copy-ereq-help)
        (default 1)
    )
    (
        (copyfiles
            (prompt "Installing ERequester program...")
            (source "ERequester")
            (help #copy-ereq-help)
            (dest @default-dest)
            (infos)
        )
    )
)


;*****************************
; Install EClockPrefs Catalogs
;*****************************
(if
    (askbool
        (prompt #copy-cats)
        (help #copy-cats-help)
        (default 1)
    )
    (
        (set oldlevel @user-level)
        (if (= oldlevel 0)
            (user 1)
        )

        (set cats-dir
            (askdir
                (prompt "Please select directory where to store the german catalog file:\n"
                )
                (help @askdir-help)
                (default ("Locale:Catalogs/Deutsch"))
                (newpath)
            )
        )

        (set @default-dest cats-dir)

        (user oldlevel)

        (if
            (askbool
                (prompt #copy-cats)
                (help #copy-cats-help)
                (default 1)
            )
            (
                (copyfiles
                    (prompt "Installing EClockPrefs german catalog file...")
                    (source "EClPrefs.catalog")
                    (help #copy-cats-help)
                    (dest @default-dest)
                    (infos)
                )
            )
        )

    )
)

;***********************
; Install Documentation
;***********************

(if
    (askbool
        (prompt #copy-docs)
        (help #copy-docs-help)
        (default 1)
    )
    (
        (set oldlevel @user-level)
        (if (= oldlevel 0)
            (user 1)
        )

        (set doc-dir
            (askdir
                (prompt "Please select directory where to store the documentation:\n"
                )
                (help @askdir-help)
                (default ("HELP:"))
                (newpath)
            )
        )

        (set @default-dest doc-dir)

        (user oldlevel)

        (if
            (askbool
                (prompt #copy-docs)
                (help #copy-docs-help)
                (default 1)
            )
            (
                (copyfiles
                    (prompt "Installing EClock documentation...")
                    (source "EClock Docs/EClock.eng.dvi")
                    (help #copy-cats-help)
                    (dest @default-dest)
                    (infos)
                )
                (copyfiles (source "EClock Docs/EClock.eng.guide")
                           (dest @default-dest)
                )
                (copyfiles (source "EClock Docs/EClock.doc")
                           (dest @default-dest)
                )
            )
        )

    )
)

(RUN
    (CAT "EClockPrefs")
)

(set @default-dest eclockmain-dir)
