; $VER: Install_ViNCEd 40.4 (26 Jan 1997)
; Script to install ViNCEd version 40.18
;  1993-97 THOR - Software
;
; The installer software is copyrighted  1993 CBM
;

; tell the user that we're 0% done
(complete 0)

;=============================================================================
; useful procedure

(procedure TERMINATE (makeassign "..VNC..")

)

(procedure JOIN (

(if (not (exists (name)))
        ;then
        (abort (#exit-not-found name 0))
)

(if (set ioerr (run ("c:copy \"%s\" to t:__tempfile__" name)))
        ;then
        (abort (#exit-not-found name ioerr))
)

(if (set ioerr (run ("c:join t:__tempfile__ \"%s\" to \"%s\"" joinsoure name)))
        ;then
        (abort (#exit-not-found name ioerr))
)
        
(run ("c:delete t:__tempfile__"))
                
))

;==========================================================================
; termination stuff

(onerror (TERMINATE))

;==========================================================================
; get current WB version
(set #version (/ (getversion "LIBS:version.library") 65536))

;get language specific strings
;==========================================================================
; English strings

(set default_lang 4)

(set #yes "Yes")
(set #no  "No")

(set #which-disk
(cat "In which disk should ViNCEd3.16 be installed?"
))

(set #which-disk-help
(cat "\nThis section lets you choose in which disk the "
     "ViNCEd files should be installed. These should normally go in the same "
     "location as the Workbenchfiles, i.e. the boot partition or -disk.\n\n"
     @askdir-help
))

(set #old-name
(cat "OLD"
))

(set #move-old
(cat "\n\nShall I backup the following files to the \"%s\" drawer?\n\n%s" ))

(set #move-old-help
(cat "\nInstalling ViNCEd will replace some current Workbench files, "
     "the Startup- and MountList files. "
     "In order to preserve any changes you have previously made to these "
     "files, the installation process will copy them to the \"%s\" drawer "
     "where they can later be retrieved."
))

(set #move-old-1
(cat "Copy"
))

(set #move-old-2
(cat "Skip"
))

(set #ask-vnc
(cat "\n\nPlease insert the \"ViNCEd Install\" disk in any floppy drive unit."
))

(set #ask-vnc-help
(cat @askdisk-help
))

(set #do-mount
(cat    "Do you want to add the mount entries for the ViNCEd handler?"
))

(set #mount-help
(cat    "If you want to install ViNCEd as a shell window driver "
        "you must MOUNT ViNCEd as a device, like the RAD ram disk or a "
        "hard disk. The information needed how to do this is "
        "included in mount entries, which must be added to the "
        "system list of devices. I advise you to answer with a YES "
        "since NOT mounting ViNCEd is rather useless. "
))

(set #modify-startup
(cat    "Do you want to mount ViNCEd automatically on startup?"
))

(set #override-con
(cat    "Replace the CON: handler by ViNCEd?"
))

(set #override-help
(cat    "With an extra command added to the startup-sequence "
        "ViNCEd can be configured to replace Commodore's "
        "system window handler, CON:. This results in opening "
        "every console window, like the windows used for ARexx, "
        "Ed and much more, as an ViNCEd window. If you choose to "
        "do so, I advice you NOT to turn on the "
        "\"Use Shell Mode by Default\" flag in the preferences "
        "editor. Read more about this in the guide."
))

(set #modify-startup-help
(cat    "The command to be added is \"%s\"\n\n"
        "This will mount ViNCEd automatically."
))

(set #which-name
(cat    "Mount ViNCEd under which name?"
))

(set #which-name-help
(cat    "ViNCEd can be mounted as VNC: or as NEWCON:. "
        "It works fine under both names, but you should use NEWCON: "
        "with Workbench 1.3 to replace the system window handler. "
))

(set #copy-lib
(cat    "Shall I copy the vnc.library to the LIBS: drawer?"
))

(set #copy-lib-help
(cat    "The vnc.library is the heard of the ViNCEd window driver and "
        "contains the handler itself. The window handler won't work "
        "with it, and not installing it makes the installation useless."
))

(set #copy-setvnc
(cat    "Shall I install the SetVNC control program to the C: drawer?"
))

(set #copy-setvnc-help
(cat    "The SetVNC program acts as a preference program for the ViNCEd "
        "system. It provides not only a complete preferences editor, but "
        "also functions for job control. Please consult the guide to find "
        "out more about this program."
))

(set #do-locale
(cat    "Shall I install the german catalog files?"
))

(set #locale-help
(cat    "ViNCEd can be localized for the german language. Please answer "
        "if you wish to add the necessary localization data."
))

(set #do-prefs
(cat    "Shall I install the preferences icon?"
))

(set #prefs-help
(cat    "This icon will be copied in your Prefs drawer and will "
        "invoke the preferences editor of ViNCEd, the SetVNC "
        "program. A nice graphical user interface will allow you "
        "to setup the parameters of ViNCEd then."
))

(set #copy-help
(cat    "O.K. to install the ViNCEd online Guide?"
))

(set #copy-help-help
(cat    "The ViNCEd guide is a complete documentation of "
        "the handler and the preferences editor, SetVNC. "
        "It is invoked by the Help key in the shell "
        "or by a Help button in the preferences editor. If you aren't "
        "really low on disk space, you should install it."
))

(set #help-dir
(cat    "Please select the drawer to install the help-guide:"
))

(set #help-help
(cat    "ViNCEd comes with an online help guide, using Commodore's "
        "AmigaGuide or MultiView program. Please select the drawer to copy "
        "this database to."
))

(set #do-docs
(cat    "Shall I install the ViNCEd include files?"
))

(set #docs-where
(cat    "Please select the drawer for the include and link library files:"
))

(set #docs-help
(cat    "If you want to use all the features of ViNCEd, you need "
        "the C- and assembler include files for writing own "
        "programs that call ViNCEd. It is recommended "
        "that you use the link library stub routines for this task. "
))

(set #browser-where
(cat    "Please locate your favorite AmigaGuide browser:"
))

(set #browser-help
(cat    "Please select a program that can display AmigaGuide files. "
        "This should be AmigaGuide or Multiview. As a last resort, "
        "select MORE or Ed, that can be found in the Utilities or "
        "C: drawer of your workbench disk."
))

(set #do-scripts
(cat    "Shall I install the shell scripts?"
))

(set #scripts-help
(cat    "The scripts replace the SetFont and the SetKeyboard command files "
        "in a ViNCEd compatible way. Three other tiny scripts are useful "
        "shortcuts for job control functions. "
))

(set #where-scripts
(cat    "Where shall I copy the scripts to?"
))

(set #where-scripts-help
(cat    "Shell scripts should be usually placed in the S directory of your "
        "startup device, where they will be found by the shell by default. "
        "However, if you prefer a different location, go ahead, but make "
        "shure the shell can find them, or they are useless."
))

(set #copy-icon
(cat    "Shall I replace the shell icon?"
))

(set #copy-icon-help
(cat    "If you want to use ViNCEd as shell editor, I advice you to "
        "replace the system icon by the icon that comes with this "
        "archive. It selects a ViNCEd path as shell window."
))

(set #where-shell
(cat    "Please select the directory the shell icon resides in:"
))

(set #where-shell-help
(cat    "If you want to replace the default shell icon, "
        "please tell me where you have put it. By default, this "
        "is either the root directory of your boot-volume, or "
        "the Systems drawer. Please note that I need the "
        "DIRECTORY, not the file!"
))

(set #do-patch
(cat    "Shall I patch ARexx to remove a bug?"
))

(set #patch-help
(cat    "The rexxsyslib.library function WaitDosPacket has a bug "
        "which might cause crashes. This is not a "
        "specific ViNCEd problem, and "
        "may also occure with other programs. You should install "
        "this patch to repair the library."
))

(set #copy-stringsnip
(cat    "Shall I install the StringSnip command?"
))

(set #install-stringsnip
(cat    "Shall I start StringSnip at startup time?"
))

(set #stringsnip-help
(cat    "StringSnip is a small utility, which, if installed, enhances "
        "the editor features of string gadgets in a way compareable "
        "to ViNCEd. Amiga-X cut the contents, Amiga-C copies them and "
        "Amiga-V inserts the clipboard. Additional cursor key "
        "combinations like those provided by ViNCEd make this a useful "
        "tool, which works independent from ViNCEd."
))

(set #copy-multiassigns
(cat    "Shall I install the TrueMultiAssigns command?"
))

(set #install-multiassigns
(cat    "Shall I start TrueMultiAssigns at startup time?"
))

(set #multiassigns-help
(cat    "The TrueMultiAssigns program is a patch command that makes the "
        "pattern matching routines of AmigaDOS operating correctly on "
        "multi directory assigns. Several programs can be found for the "
        "same job, but all I inspected are more or less broken, including "
        "MultiCX and the old TrueMultiAssigns 1.02 by Marcus Wild, and "
        "don't work with ViNCEd. I recommend to use my patch, since it has "
        "been tested to support ViNCEd."
))

(set #exit-not-found
(cat    "Unable to find your file \"%s\" - DOS error %ld "
        "- installation aborted. "
))

(set #exit-text
(cat    "Installation of ViNCEd done. Hope you enjoy it..."
))

;=============================================================================
; German strings

(if (= @language "deutsch")
(
(set default_lang 2)

(set #yes "Ja")
(set #no  "Nein")

(set #which-disk
(cat "Auf welcher Diskette oder Festplatte soll ViNCEd 3.16 "
     "installiert werden?"
))

(set #which-disk-help
(cat "\nHier knnen Sie whlen, auf welchem Gert "
     "die ViNCEd-Dateien installiert werden sollen. "
     "Sie sollten normalerweise an dieselbe Stelle installiert werden "
     "wie die Workbench-Dateien, also auf die "
     "Boot-Partition bzw. Diskette.\n\n"
     @askdir-help
))

(set #old-name
(cat "ALT"
))

(set #move-old
(cat "\n\nSollen folgende Dateien zur Sicherheit in die "
     "Schublade \"%s\" kopiert werden?\n\n%s"
))

(set #move-old-help
(cat "\nDie Installation von ViNCEd ersetzt die einige der bisherigen "
     "Workbench-Dateien, so die Startup- und MountList Files. "
     "Damit alle Ergnzungen, die Sie frher an diesen Dateien "
     "vorgenommen haben, nicht verloren gehen, werden sie bei der "
     "Installation in die Schublade \"%s\" kopiert, woher Sie "
     "sie spter zurckholen knnen."
))

(set #move-old-1
(cat "Kopieren"
))

(set #move-old-2
(cat "berspringen"
))

(set #ask-vnc
(cat "\n\nBitte legen Sie die Diskette \"ViNCEd Install\" "
     "in ein beliebiges Diskettenlaufwerk."
))

(set #ask-vnc-help
(cat @askdisk-help
))

(set #do-mount
(cat    "Sollen die Mount-Eintrge fr den ViNCEd Handler kopiert werden?"
))

(set #mount-help
(cat    "Falls Sie ViNCEd als einen Shell-Fester Treiber verwenden "
        "mchten, mu es als ein Gert vorher angemeldet werden, "
        "ebenso wie die RAD Ramdisk oder eine Festplatte. "
        "Die hierfr notwendigen Informationen befinden sich "
        "in Mount-Eintrgen, die zu der Systemliste der Gerte "
        "hinzugefgt werden. Sie sollten hier mit JA antworten, "
        "denn es ist recht witzlos, ViNCEd nicht als ein Gert "
        "anzumelden."
))

(set #modify-startup
(cat    "Wollen Sie ViNCEd beim Hochfahren des Systems automatisch einbinden?"
))

(set #modify-startup-help
(cat    "Das einzufgende Kommando ist \"%s\"\n\n"
        "Damit wird ViNCEd in das System eingebunden."
))

(set #override-con
(cat    "Soll der CON:-handler durch ViNCEd ersetzt werden?"
))

(set #override-help
(cat    "Durch ein zustzliches Kommando in der startup-sequence "
        "kann ViNCEd so konfiguriert werden, da es den System-"
        "Fenstertreiber CON: ersetzt. Dies fhrt dazu, da alle "
        "Programme, die ein Konsolenfenster ffnen, etwa ARexx "
        "Ed und einige mehr, stattdessen ein komfortableres "
        "ViNCEd Fenster erhalten. Falls Sie diese Option einstellen "
        "mchten, sollten Sie aber das Flag "
        "\"Shell Modus als Voreinstellung\" im Voreinsteller nicht "
        "anwhlen. Schauen Sie bitte auch in den Guide, um mehr "
        "hierber zu erfahren."
))

(set #which-name
(cat    "ViNCEd unter welchem Namen einbinden?"
))

(set #which-name-help
(cat    "ViNCEd kann als VNC: oder als NEWCON: in das System eingebunden "
        "werden. Der Handler funktioniert unter beiden Namen gleich "
        "gut, aber unter Workbench 1.3 sollten Sie NEWCON: verwenden, "
        "um den Betriebssystemtreiber zu ersetzen."
))

(set #copy-lib
(cat    "Soll die vnc.library in den LIBS:-Ordner kopiert werden?"
))

(set #copy-lib-help
(cat    "Die vnc.library ist eine Funktionsbibliothek und stellt "
        "das Herz des gesamten ViNCEd Systems dar, ohne die nichts "
        "funktioniert. Sie enthlt den Fenstertreiber, ohne den "
        "die ganze Installation recht witzlos wird."
))

(set #copy-setvnc
(cat    "Soll das SetVNC Programm in die C:-Schublade kopiert werden?"
))

(set #copy-setvnc-help
(cat    "Das SetVNC Programm ist der Voreinsteller fr ViNCEd. "
        "Es enthlt nicht nur eine graphische Oberflche fr die "
        "Voreinstellungen, sondern auch Funktionen fr die Job "
        "Kontrolle. Schauen Sie bitte in die Anleitung, um mehr "
        "ber dieses Programm herauszufinden."
))

(set #do-locale
(cat    "Soll die deutschen bersetzung installiert werden?"
))

(set #locale-help
(cat    "ViNCEd kann auf Deutsch eingestellt werden, bentigt dafr "
        "aber Katalogfiles, die in den Locale: Ordner kopiert "
        "werden mssen. "
))

(set #do-prefs
(cat    "Soll das Voreinsteller-Icon installiert werden?"
))

(set #prefs-help
(cat    "Dieses Piktogramm wird in den Prefs-Ordner kopiert "
        "und ruft das SetVNC-Programm als Voreinsteller von "
        "ViNCEd auf. Sie knnen dann mit einer netten graphischen "
        "Benutzeroberflche die Voreinstellungen des ViNCEd-Systems "
        "Ihren Bedrfnissen anpassen."
))

(set #copy-help
(cat    "Mchten Sie die ViNCEd Online-Dokumentation installieren?"
))

(set #copy-help-help
(cat    "Der ViNCEd Guide ist eine vollstndige Dokumentation des "
        "Fenstertreibers und des Einstellungsprogrammes SetVNC. "
        "Er wird aufgerufen, wenn Sie in der Shell die Help Taste "
        "oder einen Hilfe-Knopf im Voreinsteller drcken. "
        "Falls Ihre Platte nicht wirklich voll ist, sollten Sie "
        "diese Anleitung auch installieren."
))

(set #help-dir
(cat    "Bitte whlen Sie den Ordner, in den der VNC-Guide "
        "installiert werden soll."
))

(set #help-help
(cat    "ViNCEd besitzt eine Online-Hilfe, die mittels Commodores AmigaGuide "
        "oder Multiview Programmes Hilfestellung bei der Arbeit mit ViNCEd bietet. Geben Sie "
        "hier an, in welchen Order der Datensatz kopiert werden soll."
))

(set #do-docs
(cat    "Sollen die ViNCEd Include-Dateien installiert werden?"
))

(set #docs-where
(cat    "In welchen Ordner sollen die Include-Files installiert werden:"
))

(set #docs-help
(cat    "Wenn Sie alle Mglichkeiten ViNCEds nutzen wollen, so bentigen "
        "Sie zum Erstellen von Programmen, die ViNCEd aufrufen, "
        "die Include-Files und die Link-Libraries. "
        "Sie sollten dann ViNCEd durch die stub-Funktionen "
        "dieser Link-Libraries aufrufen. "
))

(set #browser-where
(cat    "Bitte whlen Sie ihr favorisiertes AmigaGuide - Anzeigeprogramm:"
))

(set #browser-help
(cat    "Whlen Sie hier bitte ein Programm, mit dem man sich AmigaGuide "
        "Dateieen anzeigen lassen kann. Dies sollte der AmigaGuide oder "
        "das Programm Multiview sein. Als letzen Ausweg kann hier "
        "MORE oder Ed angegeben werden. Diese Programme finden Sie "
        "in der Utilities oder C: Schublade Ihrer Workbench-Diskette."
))

(set #do-scripts
(cat    "Sollen die Shell Skripte installiert werden?"
))

(set #scripts-help
(cat    "Zwei dieser Skripte ersetzen die SetFont und SetKeyboard Kommandos "
        "durch ViNCEd kompatible Shell-Skripte. Drei weitere Skripte "
        "dienen als Abkrzung fr die Job-Kontrollfunktionen der "
        "VNC Bibliothek."
))

(set #where-scripts
(cat    "Wohin sollen die Skripte kopiert werden?"
))

(set #where-scripts-help
(cat    "Shell-Skripte gehren fr gewhnlich in den S:-Ordner Ihrer "
        "Boot-Platte, wo sie auch von der Shell gefunden werden knnen. "
        "Natrlich knnen Sie die Skripte auch an andere Stellen kopieren, "
        "jedoch sollten sie dort auch von der Shell gefunden werden, da sie "
        "sonst recht nutzlos sind."
))

(set #copy-icon
(cat    "Soll das Shell-Icon ersetzt werden?"
))

(set #copy-icon-help
(cat    "Falls Sie ViNCEd als Shell-Editor verwenden mchten, sollten "
        "sie das System-Icon durch das mitgeliferte Icon ersetzen, "
        "das als Shell-Fenster ein ViNCEd Pfad verwendet."
))

(set #where-shell
(cat    "Bitte spezifizieren Sie den Ordner, in dem sich das Shell-Icon "
        "befindet:"
))

(set #where-shell-help
(cat    "Falls Sie das Shell-Icon wirklich ersetzen wollen, mssen Sie "
        "hier angeben, wo es sich befindet. Dies ist blicherweise "
        "das Hauptverzeichnis des Boot-Gertes oder der Systems "
        "Ordner auf dem gleichen Gert. Bitte beachten Sie, da "
        "die Schublade bentigt wird und nicht das Icon selbst."
))

(set #do-patch
(cat    "Soll ein Fehler aus der ARexx Bibliothek entfernt werden?"
))

(set #patch-help
(cat    "The rexxsyslib.library Funktion WaitDosPacket hat einen Fehler, "
        "der manche anderen Programme abstrzen lassen kann. Dies ist "
        "kein spezifisches Problem von ViNCEd! Sie sollten diesen Patch "
        "installieren, um die Bibliothek zu reparieren."
))

(set #copy-stringsnip
(cat    "Soll das StringSnip-Kommand kopiert werden?"
))

(set #install-stringsnip
(cat    "Soll StringSnip beim Hochfahren gestartet werden?"
))

(set #stringsnip-help
(cat    "Stringsnip ist ein kleines Hilfsprogramm, das, einmal "
        "installiert, die Edier-Mglichkeiten der String-Gadgets "
        "entschieden verbessert. Zum einen werden Clipboard-Funktionen "
        "wie Amiga-C (Kopieren) Amiga-X (Ausschneiden) und Amiga-V "
        "(Clipboard-Inhalt einfgen) untersttzt, zum anderen werden "
        "Cursortastenkombinationen vergleichbar mit denen von ViNCEd "
        "zur Verfgung gestellt. StringSnip funktioniert auch unabhngig "
        "von ViNCEd und sollte als ntzliches Tool installiert "
        "werden."
))

(set #copy-multiassigns
(cat    "Soll das TrueMultiAssigns Kommando kopiert werden?"
))

(set #install-multiassigns
(cat    "Soll der TrueMultiAssigns Patch beim Hochfahren "
        "gestartet werden?"
))

(set #multiassigns-help
(cat    "Das TrueMultiAssigns Programm korrigiert the AmigaDOS Jokerzeichen "
        "routinen derart, da sie korrekt mit Mehrfach-Assigns "
        "zusammenarbeiten. Fr dieses Problem knnen mehrere Programme auf "
        "dem AmiNet gefunden werden, jedoch sind alle die ich getestet habe "
        "mehr oder minder defekt, wie z.B. MultiCX oder auch das alte "
        "TrueMultiAssigns 1.02 von Marcus Wild, und funktionieren darum "
        "nicht korrekt mit ViNCEd. Ich emfehle Ihnen, meinen Patch zu "
        "verwenden, denn er wurde erfolgreich mit ViNCEd getestet."
))

(set #exit-not-found
(cat    "Kann das File \"%s\" nicht finden - DOS Fehler %ld "
        "- Installation abgebrochen."
))

(set #exit-text
(cat    "ViNCEd Installation beendet."
))

))

;==========================================================================
;say hi !
(welcome)

;=============================================================================
; get target directory where update is to be installed

(set #old_wb "SYS:")

(set #target (askdir    (prompt #which-disk)
                        (help #which-disk-help)
                        (disk)
                        (default #old_wb)
))

(set #target (expandpath #target))
(set #target (cat (getdevice #target) ":"))
(set #target (expandpath #target))

;set @default-dest to user selected target
(set @default-dest #target)

;get directory to save old files
(set stash_old (tackon #target #old-name))

;==========================================================================
;rename old files

(set startup-sequence   (tackon #target "S/Startup-Sequence"))
(set mountlist          (tackon #target "DEVS/MountList"))

;get all existing files
(set oldfiles "")

(if (exists startup-sequence)
        ;then
        (set oldfiles (cat oldfiles startup-sequence "\n"))
)

(if (exists mountlist)
        ;then
        (set oldfiles (cat oldfiles mountlist "\n"))
)


;if some oldfiles found
(if (> (strlen oldfiles) 0)
(
    (if (askbool (prompt (#move-old stash_old oldfiles))
                 (help (#move-old-help stash_old))
                 (choices #move-old-1 #move-old-2)
                 (default 1)
        )
        ;then do it
    (
        ; create new directory w icon
        (makedir stash_old (infos))
        ; create s and devs subdirectory
        (makedir (tackon stash_old "S"))
        (makedir (tackon stash_old "Devs"))

        ; copy startup-sequence to old-drawer
        (if (exists startup-sequence)
                ;then
                (
                (delete (tackon stash_old "S/Startup-Sequence"))
                (copyfiles
                        (source startup-sequence)
                        (dest (tackon stash_old "S/Startup-sequence"))
                )                       
        ))

        ;copy mountlist to old-drawer
        (if (exists mountlist)
                ;then
                (
                (delete (tackon stash_old "DEVS/Mountlist"))
                (copyfiles
                        (source mountlist)
                        (dest   (tackon stash_old "DEVS/Mountlist"))
                )
        ))
    ))
))

(complete 10)
;==========================================================================
; now copy ViNCEd to target

; ask user to insert VNC
(askdisk        (prompt #ask-vnc)
                (help   #ask-vnc-help)
                (dest "ViNCEd Install")
                (newname "..VNC..")
)


;copy library
(if (> @user-level 1)
        ;then
        (
                (set #pi-copy-lib
                        (askbool        (prompt #copy-lib)
                                        (help #copy-lib-help)
                                        (default 1)
                                        (choices #yes #no)
                        )
                )
        )
        (set #pi-copy-lib 1)
)

(if #pi-copy-lib
        (
                (set #libs (tackon #target "LIBS"))

                (if (not (exists #libs))
                        (makedir #libs)
                )

                (copyfiles      (source "..VNC..:LIBS/vnc.library")
                                (dest #libs)
                )
        )
)

(complete 20)

;copy preference-program
(if (> @user-level 1)
        ;then
        (
                (set #pi-copy-setvnc
                        (askbool        (prompt #copy-setvnc)
                                        (help #copy-setvnc-help)
                                        (default 1)
                                        (choices #yes #no)
                        )
                )
        )
        (set #pi-copy-setvnc 1)
)

(if #pi-copy-setvnc
        (
                (set #cdir (tackon #target "C"))

                (if (not (exists #cdir))
                        (makedir #cdir)
                )

                (copyfiles      (source "..VNC..:C/SetVNC")
                                (dest #cdir)
                )
        )
)

(complete 30)
;add language-specific if 2.1 or higher
(if (>= #version 38)
        ;then
        (
                (if (> @user-level 1)
                        (set #pi-do-locale
                                (askbool        (prompt #do-locale)
                                                (help #locale-help)
                                                (default 1)
                                                (choices #yes #no)
                                )
                        )
                        (set #pi-do-locale 1)
                )

                (if #pi-do-locale
                        ;then
                        (
                                (set #locale (tackon #target "Locale"))

                                (if (not (exists #locale))
                                        (makedir #locale)
                                )

                                (set #locale (tackon #locale "Catalogs"))

                                (if (not (exists #locale))
                                        (makedir #locale)
                                )

                                (set #locale (tackon #locale "Deutsch"))

                                (if (not (exists #locale))
                                        (makedir #locale)
                                )

                                (set #locale (tackon #locale "VNC"))

                                (if (not (exists #locale))
                                        (makedir #locale)
                                )

                                (copyfiles
                                        (source "..VNC..:LOCALE/catalogs/deutsch/VNC")
                                        (dest #locale)
                                        (all)
                                )
                        )
                )
        )
)


(complete 40)
;add mountlist entry if release 2.0 or less


(if ( > @user-level 1)
        (set #mount-pi (askbool (prompt #do-mount)
                                (help #mount-help)
                                (default 1)
                                (choices #yes #no)
                        )
        )
        (set #mount-pi 1)
)

(if #mount-pi

        (if (< #version 38)
                ;then
                (
                        (set joinsoure  "..VNC..:DEVS/Mount_VNC")
                        (set name       (tackon #target "devs/MountList"))
                        (JOIN)
                        (set joinsoure  "..VNC..:DEVS/Mount_NEWCON")
                        (JOIN)
                )
                ;else copy the icons
                (
                        (copyfiles
                                (source "..VNC..:DEVS/DosDrivers")
                                (dest   (tackon #target "DEVS/DosDrivers"))
                                (infos)
                                (all)
                        )
                )
        )
)

;get drawer to copy preference-icon
(set #prefsdrawer #target)

(if (exists (tackon #prefsdrawer "Prefs"))
        ;then
        (set #prefsdrawer (tackon #prefsdrawer "Prefs"))
)

(complete 50)

(if (> @user-level 1)
        (set #pi-copy-prefs
                (askbool        (prompt #do-prefs)
                                (help #prefs-help)
                                (default 1)
                                (choices #yes #no)
                )
        )
        (set #pi-copy-prefs 1)
)

;copy preference-icon
(if #pi-copy-prefs
        (
                (copyfiles      (source "..VNC..:Prefs/SetVNC.info")
                                (dest   #prefsdrawer)
                )

                (tooltype       (dest   (tackon #prefsdrawer "SetVNC"))
                                (noposition)
                )

                (if (> #version 35)
                        (
                                (set #archive (tackon #prefsdrawer "Env-Archive/sys"))
                                (set #presets (tackon #prefsdrawer "Presets/sys"))

                                (if (exists #archive)
                                        (copyfiles      (source "..VNC..:Prefs/Env-Archive/sys")
                                                        (dest #archive)
                                                        (all)
                                        )
                                )

                                (if (exists #presets)
                                        (copyfiles      (source "..VNC..:Prefs/Env-Archive/sys")
                                                        (dest #presets)
                                                        (all)
                                        )
                                )
                        )
                        (
                                (set #archive (tackon #target "Devs"))

                                (if (exists #archive)
                                        (copyfiles      (source "..VNC..:Prefs/Env-Archive/sys")
                                                        (dest #archive)
                                                        (all)
                                        )
                                )
                        )
                )
        )
)

;==========================================================================
;ask user to install the vnc-guide
(if (> @user-level 1)
        (set #do-help   (askbool        (prompt #copy-help)
                                        (help #copy-help-help)
                                        (default 1)
                                        (choices #yes #no)
                        )
        )
        (set #do-help 1)
)

(if #do-help
        (
                (set #where-guide       (askdir         (prompt #help-dir)
                                                        (help   #help-help)
                                                        (default (tackon #target "Guides"))
                                        )
                )

                (if #where-guide
                        (
                                (copyfiles
                                        (source "..VNC..:Guides/VNC.Guide")
                                        (dest #where-guide)
                                )
                                (copyfiles
                                        (source "..VNC..:Guides/VNC.Guide.info")
                                        (dest #where-guide)
                                )

                
                                (if #pi-copy-prefs
                                        (tooltype
                                                (dest (tackon #prefsdrawer "SetVNC"))
                                                (settooltype "HELPPATH" (tackon #where-guide "VNC.guide"))
                                        )
                                )

                                (set #guide-path (askfile       (prompt #browser-where)
                                                                (help #browser-help)
                                                                (default (tackon #target "Utilities/MultiView"))
                                                )
                                )

                                (if #guide-path
                                        (tooltype
                                                (dest (tackon #where-guide "VNC.Guide"))
                                                (setdefaulttool #guide-path)
                                        )
                                )

                        )
                )
        )
)

(complete 60)
;==========================================================================
;now install the scripts
(if (> @user-level 1)
        (
                (set #pi-copy-scripts (askbool  (prompt #do-scripts)
                                                (help #scripts-help)
                                                (default 1)
                                                (choices #yes #no)
                                        )
                )

                (if #pi-copy-scripts
                        (
                                (set #script-location
                                        (askdir (prompt #where-scripts)
                                                (help #where-scripts-help)
                                                (default (tackon #target "S"))
                                                (newpath)
                                        )
                                )

                                (if #script-location
                                        (if (not (exists #script-location))
                                                (makedir (#script-location))
                                        )
                                        (set #pi-copy-scripts 0)
                                )

                        )
                )
        )
        (
                (set #pi-copy-scripts 1)
                (set #script-location (tackon #target "S"))
        )
)

(if #pi-copy-scripts
        (
                (copyfiles      (source "..VNC..:S/fg")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/fg s add"))

                (copyfiles      (source "..VNC..:S/bg")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/bg s add"))

                (copyfiles      (source "..VNC..:S/fork")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/fork s add"))

                (copyfiles      (source "..VNC..:S/SetFont")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/SetFont s add"))

                (copyfiles      (source "..VNC..:S/SetKeyboard")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/SetKeyBoard s add"))

                (copyfiles      (source "..VNC..:S/More")
                                (dest   #script-location)
                )
                (run ("c:Protect ..VNC..:S/More s add"))



        )
)


;==========================================================================
; now modify the startup-sequence
;first get the name 
(if (>= #version 36)
        (set #nametype 1)
        (set #nametype 2)
)

;now ask the expert user if it's O.K.

(if (> @user-level 1)
         (set #nametype  ( + (askchoice
                                (prompt #which-name)
                                (help   #which-name-help)
                                (choices "VNC" "NEWCON")
                            ) 1)        
         )
)

(if (= #nametype 1)
        (set #installcmd "Mount VNC:")
        (set #installcmd "Mount NEWCON:")
)

(if (>= #version 36)
        (set #installcmd (cat ";" #installcmd))
)

(if (> @user-level 1)
        (set #pi-copy-icon (askbool     (prompt #copy-icon)
                                        (help #copy-icon-help)
                                        (default 1)
                                        (choices #yes #no)
                                )
        )
        (set #pi-copy-icon 1)
)

(set #icon-pos #target)

(if (not (exists (tackon #icon-pos "Shell.info")))
        (set #icon-pos (tackon #target "System"))
)

(if (> @user-level 1)
        (if #pi-copy-icon
                (
                        (set #icon-pos  (askdir (prompt #where-shell)
                                                (help #where-shell-help)
                                                (default #icon-pos)
                                        )
                        )
                )
        )
)

(if #icon-pos
        (if #pi-copy-icon
                (

                        (if (exists (tackon #icon-pos "Shell.Info"))
                                (delete (tackon #icon-pos "Shell.info"))
                        )

                        (if (= #nametype 1)
                                (
                                        (copyfiles
                                                (source "..VNC..:Shell_VNC.info")
                                                (dest   #icon-pos)
                                        )
                                        (rename (tackon #icon-pos "Shell_VNC.info")
                                                (tackon #icon-pos "Shell.info"))
                                )
                                (
                                        (copyfiles
                                                (source "..VNC..:Shell.info")
                                                (dest   #icon-pos)
                                        )
                                )
                        )

                        (tooltype       (dest   (tackon #icon-pos "Shell"))
                                        (noposition)
                        )

                )
        )
)

(if (> @user-level 0)
        (set #do-override
                (askbool        (prompt #override-con)
                                (help #override-help)
                                (default 1)
                                (choices #yes #no)
                )
        )
        (set #do-override 1)
)

(if #do-override
        (set #installcmd (cat #installcmd "\nSetVNC Quiet Mount Override as CON:"))
)

(startup "VNC"
        (command #installcmd)
        (prompt #modify-startup)
        (help (#modify-startup-help #installcmd))
)

(complete 70)
;==========================================================================
;now install documentation-files for expert user

(if (> @user-level 1)
        (
                (if (askbool    (prompt #do-docs)
                                (help #docs-help)
                                (default 0)
                                (choices #yes #no)
                        )
                        (
                                (set #where-docs        (askdir (prompt #docs-where)
                                                                (help   #docs-help)
                                                                (default (tackon #target "Include"))
                                                        )
                                )

                                (if #where-docs
                                        (copyfiles
                                                (source "..VNC..:Include")
                                                (all)
                                                (dest #where-docs)
                                        )
                                )
                        )
                )
        )
)

;==========================================================================
(complete 80)
(if (exists (tackon #target "LIBS/rexxsyslib.library"))
        (
                (if (> @user-level 1)
                        (set #patch-arexx (askbool      (prompt #do-patch)
                                                        (help #patch-help)
                                                        (default 1)
                                                        (choices #yes #no)
                                                )
                        )
                        (set #patch-arexx 1)
                )

                (if #patch-arexx
                        (
                                (set #rlibs (tackon #target "LIBS/rexxsyslib.library"))
                                (set #libs (tackon #target "LIBS"))

                                (if (not (exists #libs))
                                        (makedir #libs)
                                )

                                (if (= 0 (run ("..VNC..:Extras/SPatch -ot:rexxsyslib.library -p..VNC..:ARexx/rexxsyslib.pch \"%s\"" #rlibs)))
                                        (copyfiles      (source "t:rexxsyslib.library")
                                                        (dest #libs)
                                        )
                                )
                        )
                )
        )
)
;==========================================================================
(complete 87)
(if (>= #version 37)
        (
                (if (> @user-level 0)
                    (set #pi-copy-stringsnip        (askbool        (prompt #copy-stringsnip)
                                                                        (help #stringsnip-help)
                                                                        (default 1)
                                                                        (choices #yes #no)
                                                        )
                        )
                        (set #pi-copy-stringsnip 1)
                )

                (if #pi-copy-stringsnip
                        (
                                (copyfiles      (source "..VNC..:Extras/StringSnip")
                                                (dest (tackon #target "C"))
                                )

                                (startup "StringSnip"
                                        (command "StringSnip >NIL: install")
                                        (prompt #install-stringsnip)
                                        (help #stringsnip-help)
                                )
                        )
                )
        )
)
;==========================================================================
(complete 93)
(if (>= #version 37)
        (
                (if (> @user-level 0)
                    (set #pi-copy-multi                 (askbool        (prompt #copy-multiassigns)
                                                                        (help #multiassigns-help)
                                                                        (default 1)
                                                                        (choices #yes #no)
                                                        )
                        )
                        (set #pi-copy-multi 1)
                )

                (if #pi-copy-multi
                        (
                                (copyfiles      (source "..VNC..:Extras/TrueMultiAssigns")
                                                (dest (tackon #target "C"))
                                )

                                (startup "TrueMultiAssigns"
                                        (command "TrueMultiAssigns")
                                        (prompt #install-multiassigns)
                                        (help #multiassigns-help)
                                )
                        )
                )
        )
)
;==========================================================================
(complete 100)

(TERMINATE)

(exit #exit-text)
