; $VER: GoldDock 1.0

(delopts "oknodelete" "force" "askuser")
(complete 0)

; This install script is public domain. Feel free to include it with
; your own API clients.

(if (exists "GoldED:" (NOREQ))

    (
        (set vernum (getversion "golded:golded"))
        (set ver (/ vernum 65536))
        (set rev (- vernum (* ver 65536) ) )

        (if (< rev 987)

            (
                (message "\nSorry, GED 0.987 or better required")
                (exit (quiet))
            )
        )
    

        (message (cat "\n"

            "                   GoldDock                    \n"
            "                   ~~~~~~~~                    \n"
            "               by Markus Aretz                 \n"
            "                                               \n"
            "       Internet: ma@ph-cip.uni-koeln.de        \n"
            "                                               \n"
            "                   GIFTWARE                    \n"
        ))

        (welcome)

        (complete 10)

        ; ask where to install GoldDock
        (set @target
        (askdir
           (prompt "Please select the directory where you would like to install"
                   " GoldDock. ")
           (help (cat "\n"

                " Simply select a directory where you want to have  \n"
                " GoldDock installed. I prefer 'GoldED:API'. I'm    \n"
                " going to create a new directory coalled 'GoldDock' \n"
                " within the directory you specify.                 \n"
                "                                                   \n"
                " The GoldDock directory will keep the main program,\n"
                " several prefs-files and a subdirectory with icons.\n"
           ))
           (default "GoldED:API")
           )
        )

        (if (not (exists (tackon @target "GoldDock"))) (makedir (tackon @target "GoldDock")))

        (set @target (tackon @target "GoldDock"))

        (if (not (exists (tackon @target "Icons"))) (makedir (tackon @target "Icons")))

        (copyfiles
            (source (pathonly @icon))
            (dest   @target)
            (pattern "(GoldDock|ReadMe)#?")
            (infos)
        )


        ; what docks should be installed ?

        (copyfiles
            
            (prompt  "\n Select what GoldED docks do you want to have installed ? \n")

            (help @copyfiles-help)
            (source  "DockPrefs")
            (pattern "#?")
            (dest    @target)
            (confirm)
        )


        (complete 20)

        (copyfiles
            
            (prompt  "\n Select dock images to install \n")

            (help @copyfiles-help)
            (source "Icons")
            (pattern "#?")
            (files)
            (dest   (tackon @target "Icons"))
            (confirm)
        )


        (complete 40)

        (copyfiles
                (prompt "Would you like to install the German AmigaGuide\n"
                        "documentation for GoldDock ?")
                (help @copyfiles-help)
                (source "Anleitung")
                (dest @target)
                (infos)
                (confirm)
        )
        
        (complete 50)
        
        (copyfiles
            (prompt "Would you like to install the ARexx-Scripts ?"
                    "They are necessary for full functionality of the docks.")
            (help @copyfiles-help)
            (source  "ARexx")
            (pattern "#?.ged")
            (dest    "GoldED:ARexx")
            (confirm)
        )

        (complete 60)

        (copyfiles
            (prompt "Would you like to install some GoldED presets ?")
            (help @copyfiles-help)
            (source "Presets")
            (pattern "#?")
            (dest "sys:Prefs/Presets/GoldED")
            (confirm)
        )
        (complete 70)

        (set @texsupport (askbool
            (prompt "\n Would you like to install the PasTeX-related files?\n"
                    "\n (dock icons, dock prefs, arexx-macros)\n")
            (help @askoptions-help)
            (default 1)))

        (if @texsupport) (
            (copyfiles
            
                (prompt  "\n Select dock images to install \n")

                (help @copyfiles-help)
                (source "texsupport")
                (all)
                (dest   @target)
            ))


        (complete 100)

        (message (cat "\n"

            "API client installed. Please load the approriate   \n"
            "api-file from within GoldED's API requester (<load>\n"
            "gadget).                                        \n"
            "The attribute 'Small' in the api-filename stands   \n"
            "for a configuration which fits on an standard HIRES\n"
            "screen. The attribute 'WithTeX' means BuiltIn-Docks\n"
        ))
    )
    (
        (message (cat "\n"

            "Please install GoldED before attempting to\n"
            "install this client.                      \n"
        ))
    )
)

(exit (quiet))

