; $VER: Placeholder script 1.0 (22.11.98); installer script ©1998 Dietmar Eilert

(delopts "oknodelete" "force" "askuser")

(complete 0)

(onerror

    (if (> @ioerr 0)

        (
            (delete "env:INSTALLOPTIONS")

            (message "An error has occurred. Please inform our support (Dietmar.Eilert@post.rwth-aachen.de)")
        )
    )
)

; initialize return code

(textfile (dest "env:COMPONENTINSTALL") (append "INCOMPLETE"))

; initialize strings

(set #addon_name "SAS/C")

(if (= @language "deutsch")

    (
        (set #addon_uninstalling

            (cat "Die " #addon_name " Erweiterung wird entfernt ...")
        )

        (set #addon_badversion   "Diese Software benötigt GoldED 5 !")

        (set #addon_welcome

            (cat

                #addon_name " Erweiterung:"

                "                                                    \n"
                "Diese Erweiterung ist aus Platzgründen nicht in der \n"
                "Demonstrationsversion enthalten !                   \n"
            )
        )

        (set #addon_install      "Installieren")

        (set #addon_uninstall    "Entfernen")

        (set #addon_golded       "Bitte installieren Sie GoldED, bevor Sie diese Installation ausführen !")

        (set #addon_registry     "Registry wird aktualisiert...")
    )

    (
        (set #addon_uninstalling

            (cat "Uninstalling " #addon_name " AmigaGuide add-on ...")
        )

        (set #addon_badversion   "This software requires GoldED 5 !")

        (set #addon_welcome

            (cat #addon_name " Add-On:"

                "                                                    \n"
                "Due to space restrictions, this add-on is not       \n"
                "included in the demo version !                      \n"
            )
        )

        (set #addon_install      "Install")

        (set #addon_uninstall    "Uninstall")

        (set #addon_golded       "Please install GoldED before you install this add-on !")

        (set #addon_registry     "Updating registry ...")
    )
)

(if (exists "golded:" (NOREQ))

    (
        (set vernum (getversion "golded:demo"))

        (set ver (/ vernum 65536))
        (set rev (- vernum (* ver 65536)))

        (set version (+ (* 10 ver) rev))

        (if (< version 50)

            (
                (message #addon_badversion)
            )
        )

        ; read command passed in to our script in the env variable INSTALLOPTIONS

        (if (exists "env:INSTALLOPTIONS" (noreq))

            ; (getenv) may not be used without checking if var exists (installer bug)

            (
                (set addon_installmode (getenv "INSTALLOPTIONS"))

                (if (= addon_installmode "UNINSTALL")

                    (working #addon_uninstalling)

                    (message #addon_welcome)
                )
            )

            (set addon_installmode "ASK")
        )

        (if (= addon_installmode "ASK")

            (if

                (askbool

                    (prompt #addon_welcome)

                    (choices

                        #addon_install
                        #addon_uninstall
                    )

                    (help @askbool_help)
                )

                (set addon_installmode "INSTALL")

                (set addon_installmode "UNINSTALL")
            )
        )

        (delete "env:INSTALLOPTIONS")

        (if (= addon_installmode "UNINSTALL")

            ; uninstall

            (
                ; update registry

                (working #addon_registry)

                (exit (quiet))
            )

            ; install

            (
                (textfile (dest "env:COMPONENTINSTALL") (append "OK"))

                (complete 100)

                (exit (quiet))
            )
        )
    )

    (message #addon_golded)
)

(exit (quiet))

(welcome)
