;
; Envoy & Ariadne FLOPPY Installation script
;
; Installs a sample Envoy & Liana.device installation
; which should be customized later by the user using
; the Envoy config Editors
;
; Copyright © 1996 Village Tronic Marketing GmbH
;
; V1.0  24-08-96 sticht     first version
;
; Make sure that we are running under 2.04 or better
;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; LANGUAGE SECTION
;
; to support more than only one language, there is a special section for
; each supported language.
;

(if (<> @language "english")
((if (<> @language "deutsch")
 ( set @language "english")
 )
))

;==========================================================================
; English strings

(if (= @language "english")
(
(set default_lang 4)

(set #copy (cat "Copying "))
(set #nohelp (cat "Sorry, no help text available."))

(set #bad-kick
(cat "You must be using Kickstart 2.04 or higher to install and use the Ariadne!"
))

(set #aborted
(cat "Installation aborted by user."
))

(set #ask-floppyinstall
(cat "IMPORTANT !!!\n\n"
     "This Installation procedure must only be used if you BOOTED FROM a copy of a V37 or higher Workbench Floppy!\n\n"
     "This Installation will delete files from the disk you have booted from to make room for Envoy.\n\n"
     "Do NOT continue if you booted from your "
     "original Workbench floppy or a harddisk.\n"
     "Continue installation ?"
))

(set #help-floppyinstall
(cat "This Installation procedure is for installing Envoy to a copy of a Workbench floppy only, "
     "for use on floppy-boot systems.\n\n"
     "Do NOT procede with this installation if you booted from your "
     "original Workbench floppy or a harddisk.\n"
))

(set #nofloppy
(cat "\nSystem not booted from Workbench floppy.\nAborting Floppy Install."
))

(set #ask-installdir
(cat "\nIn which disk (or drawer) should the Envoy "
     "drawer be installed or updated?"
))

(set #ask-update
(cat "\nDo you wish to update your current installation? "
))

(set #help-update
(cat "\nThe Installer has determined that you may already "
     "have Envoy installed on your "
     "system. If this is incorrect or if you want to "
     "completely re-install Envoy, select 'Re-Install.' "
     "Otherwise, select 'Update.'"
))

(set #choice-update
(cat "Update"
))

(set #choice-reinstall
(cat "Re-Install"
))

(set #checking-obsolete
(cat "\n\nChecking for obsolete files ..."
))

(set #delete-old
(cat "\n\nSome files from former versions of the Ariadne software are now obsolete "
     "and must be deleted.\n"
     "Do you wish to be asked permission before deleting each file, or "
     "should they be deleted automatically?"
))

(set #delete-old-1
(cat "Delete Automatically"
))

(set #delete-old-2
(cat "Ask Before Deleting"
))

(set #confirm-delete
(cat "\n\nShould the file \"%s\" be deleted?"
))

(set #confirm-delete-help
(cat "\n\nSome files from former versions of the Ariadne software are now obsolete "
     "and must be deleted.\n"
))

(set #deleting-obsolete
(cat "\n\nDeleting obsolete files ..."
))

(set #copy-configeditors
(cat "Which Envoy Configuration Editors should be installed?"
))

(set #install-envoylibs
(cat "\n\nInstalling Envoy libraries ..."
))

(set #ask-whichservices
(cat "Please select which Envoy services you would like "
     "activated when Services Manager is run. "
))

(set #help-whichservices
(cat "\nPrinter\n"
     "\n"
     "Select this option to enable this machine to export a printer "
     "to other machines on the network. Deselect this option "
     "to disable printer exporting.\n"
     "\n"
     "File System\n"
     "\n"
     "Select this option to enable this machine to export file systems "
     "to other machines on the network. Deselect this option "
     "to disable file exporting.\n"
))

(set #choice-printer
(cat "Printer"
))

(set #choice-filesystem
(cat "File System"
))

(set #ask-assignprinters
(cat "Adding an assign PRINTERS: to your S:User-Startup."
))

(set #help-assignprinters
(cat "\nIn order for network printing to work on AmigaOS 2.04 systems, "
     "an assign must be made for PRINTERS:. "
))

(set #ask-ownername
(cat "Please enter the name of this Amiga's owner:"
))

(set #default-ownername
(cat "Joe User"
))

(set #help-ownername
(cat "\nEnvoy allows you to enter the name of a person "
     "as the machine's Owner. You may leave this set to "
     #default-ownername " if you wish."
))

(set #ask-hostname
(cat "Please enter a name for your Amiga."
))

(set #help-hostname
(cat "\nEach machine on a network must have a unique "
     "name and number. Machine names can have a maximum of "
     "31 characters, and may not contain a colon (:) or a slash (/)!"
))

(set #ask-hostnumber
(cat "Please enter the network address for your Amiga:"
))

(set #help-hostnumber
(cat "\nEach machine on a network must have an unique "
     "network address.\n\n"
     "A network address is composed of four numbers (range 1 to 254) "
     "separated by periods. Example: 239.233.12.15\n\n"
     "If you integrate your Amiga in an existing network, you have "
     "to ask your network administrator for the network address of your Amiga.\n\n"
     "If you build a new network which isn't connected to any other network "
     "you can use the first three parts of the default address "
     "and just give every host in the network an unique number "
     "in the last part of the address.\n\n"
     "You may change the network address later using the Envoy "
     "configuration tool »Network Configuration«."
))

(set #msg-finish
(cat "\nThe installation of Envoy is now complete.\n\n"
     "To enable Envoy, you must reboot your Amiga.\n\n"
))

(set #ask-catalogs
(cat "\nDo you want the german language catalog files "
     "to be installed in LOCALE:catalogs/deutsch?"
))

(set #copy-sanaiidevstat
(cat "In which drawer should the tool SanaIIDevStat be installed?"
))

(set #help-sanaiidevstat
(cat "SanaIIDevStat shows you information about SanaII drivers."
))

(set #copy-useariadnepar
(cat "In which drawer should the tool UseAriadnePar be installed?"
))

(set #help-useariadnepar
(cat "You may need UseAriadnePar to redirect the printer output to the parallel ports of the Ariadne."
))

(set #copy-presets
(cat "In which drawer should the presets for the preferences editor 'Printer' be installed?"
))

(set #help-presets
(cat "You need these presets to redirect the output of the printer.device to the parallel ports of the Ariadne."
))
))

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

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

(set #copy (cat "Kopiere "))
(set #nohelp (cat "Leider ist hierzu kein Hilfe-Text verfügbar."))

(set #bad-kick
(cat "Sie benötigen Kickstart 2.04 zum Installieren und Benutzen der Ariadne."
))

(set #aborted
(cat "Installation vom Benutzer abgebrochen."
))

(set #ask-floppyinstall
(cat " **** W I C H T I G ! ****\n"
     "Diese Installation darf nur benutzt werden, wenn Sie diesen Rechner "
     "von einer Originalkopie der Workbench-Diskette (Version 37 oder höher) gestartet haben!\n\n"
     "Es werden Dateien von dem Datenträger gelöscht, mit dem Sie diesen Amiga "
     "gestartet haben!\n"
     "Machen Sie nicht weiter, wenn Sie Ihren Amiga von einer Originaldiskette oder einer "
     "Festplatte gestartet haben!\n"
     "Soll die Installation durchgeführt werden?"
))

(set #help-floppyinstall
(cat "Dieser Installationvorgang installiert Envoy auf einer Kopie Ihrer "
     "Workbenchdiskette, die Sie bereits angefertigt haben müssen.\n"
     "Sie müssen Ihren Amiga von dieser Diskette gestartet haben, damit "
     "der Installationsvorgang funktioniert.\n"
     "Damit Envoy auf die Diskette kopiert werden kann, müssen "
     "einige Dateien von der Diskette gelöscht werden, um Platz zu schaffen. "
     "Verwenden Sie daher nicht Ihre Workbench-Originaldiskette!\n"
     "Wenn Sie Ihren Amiga von einer Festplatte oder Workbench-Originaldiskette "
     "gestartet haben, dann brechen Sie den Installationsvorganag jetzt ab!\n"
     "Nur wenn Sie Ihren Amiga von einer Kopie der Original-Workbench-Diskette "
     "gestartet haben, können Sie mit der Installation weiter machen!\n"
))

(set #nofloppy
(cat "\nDieses System wurde nicht von einer Workbench-Diskette gestartet.\n"
     "Disketteninstallation wird abgebrochen!"
))

(set #ask-installdir
(cat "\nIn welcher Schublade soll die Envoy-Schublade "
     "installiert oder erneuert werden?"
))

(set #ask-update
(cat "\nWollen Sie Ihre Envoy-Installation erneuern? "
))

(set #help-update
(cat "Der Installer hat festgestellt, daß Envoy "
     "auf diesem System eventuell bereits installiert ist. "
     "Wenn das nicht richtig ist, oder wenn Sie Envoy komplett neu "
     "installieren möchten, dann wählen Sie bitte \"Neu Installieren\". "
     "Ansonsten wählen Sie bitte \"Erneuern\"."
))

(set #choice-update
(cat "Erneuern"
))

(set #choice-reinstall
(cat "Neu Installieren"
))

(set #checking-obsolete
(cat "\n\nSuche nach überflüssigen Dateien ..."
))

(set #delete-old
(cat "\n\nEin paar Dateien von älteren Versionen der Software zur Ariadne "
     "sind nun überflüssig und müssen gelöscht werden.\n"
     "Wollen Sie bei jeder einzelnen überflüssigen Datei gefragt werden oder "
     "sollen sie alle automatisch gelöscht werden?"
))

(set #delete-old-1
(cat "Automatisch löschen"
))

(set #delete-old-2
(cat "Nachfragen"
))


(set #confirm-delete
(cat "\n\nDarf die Datei \"%s\" gelöscht werden?"
))

(set #confirm-delete-help
(cat "\n\nEin paar Dateien von älteren Versionen der Software zur Ariadne "
     "sind nun überflüssig und müssen gelöscht werden.\n"
))

(set #deleting-obsolete
(cat "\n\nLösche überflüssige Dateien ..."
))

(set #copy-configeditors
(cat "Welche Envoy-Konfigurationsprogramme sollen installiert werden?"
))

(set #install-envoylibs
(cat "\n\nInstalliere die Envoy-Libraries ..."
))

(set #ask-whichservices
(cat "Bitte wählen Sie aus, welche Envoy-Services "
     "Sie aktiviert haben wollen:"
))

(set #help-whichservices
(cat "\n"
     "Dateisystem:\n"
     "\n"
     "Wählen Sie mit dieser Option, ob dieser Rechner Verzeichnisse "
     "über das Netzwerk anderen Rechnern zur Verfügung stellen soll.\n"
     "\n"
     "Drucker:\n"
     "\n"
     "Wählen Sie mit dieser Option, ob dieser Rechner seinen Drucker "
     "über das Netzwerk anderen Rechnern zur Verfügung stellen soll.\n"
     "\n"
))

(set #choice-printer
(cat "Drucker"
))

(set #choice-filesystem
(cat "Dateisystem"
))

(set #ask-assignprinters
(cat "Füge den Assign PRINTERS: in Ihre S:User-Startup ein."
))

(set #help-assignprinters
(cat "\nDamit das Drucken über das Netzwerk unter AmigaOS 2.04 "
     "funktioniert, muß der Assign PRINTERS: bestehen."
))

(set #ask-ownername
(cat "Bitte geben Sie den Namen des Besitzers dieses Amigas ein:"
))

(set #default-ownername
(cat "Sabine Muster"
))

(set #help-ownername
(cat "\nEnvoy erlaubt Ihnen, den Namen des Besitzers dieses Amigas anzugeben. "
     "Sie können einen beliebigen Namen eingeben oder auch die Voreinstellung "
     "beibehalten."
))

(set #ask-hostname
(cat "Bitte geben Sie einen im Netz eindeutigen Namen für diesen Amiga ein:"
))

(set #help-hostname
(cat "\nJeder Rechner im Netz muß einen eindeutigen Namen haben. "
     "Der Name darf bis zu 31 Zeichen lang sein. Im Namen darf kein "
     "Doppelpunkt (:) und kein Querstrich (/) vorkommen! "
))

(set #ask-hostnumber
(cat "Bitte geben Sie die Netzwerkadresse für diesen Amiga ein:"
))

(set #help-hostnumber
(cat "\nJeder Rechner im Netz muß einen eindeutige "
     "Netzwerkadresse haben.\n\n"
     "Die Netzwerkadresse besteht aus vier Nummern zwischen 1 und 254, "
     "die jeweils durch einen Punkt getrennt sind. Beispiel: 239.233.12.5\n\n"
     "Wenn Sie diesen Amiga in ein bestehendes Netzwerk "
     "integrieren, so fragen Sie den Netzwerk-Administrator "
     "nach der Netzwerkadresse Ihres Amigas.\n\n"
     "Wenn Sie ein neues Netz aufbauen, welches keine Anbindung "
     "an andere Netze hat, dann benutzen Sie die ersten drei Teile "
     "der vorgegebenen Adresse und geben Sie nur in der letzten "
     "Komponente jedem Rechner eine andere Nummer.\n\n"
     "Die Netzwerkadresse können Sie auch nachträglich mit dem "
     "Envoy-Konfigurationsprogramm »Network Configuration« "
     "ändern."
))

(set #msg-finish
(cat "\nDie Installation von Envoy ist nun abgeschlossen.\n\n"
     "Um Envoy zu starten, müssen Sie Ihren Amiga neu starten.\n\n"
))

(set #ask-catalogs
(cat "\nSollen die deutschen Sprachdateien für die Hilfsprogramme "
     "in LOCALE:catalogs/deutsch installiert werden?"
))

(set #copy-sanaiidevstat
(cat "In welche Schublade soll das Hilfsprogramm SanaIIDevStat installiert werden?"
))

(set #help-sanaiidevstat
(cat "SanaIIDevStat zeigt Ihnen Informationen über SanaII-Devices."
))

(set #copy-useariadnepar
(cat "In welche Schublade soll das Hilfsprogramm UseAriadnePar installiert werden?"
))

(set #help-useariadnepar
(cat "UseAriadnePar benötigen Sie evtl. um Druckerausgaben an die parallele "
     "Schnittstelle der Ariadne umzuleiten."
))

(set #copy-presets
(cat "In welche Schublade sollen die Presets für den Voreinsteller Printer installiert werden?"
))

(set #help-presets
(cat "Diese Presets benötigen Sie, um die Ausgabe des printer.device auf die parallele "
     "Schnittstelle der Ariadne umzuleiten."
))
))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; INSTALLATION SECTION
;

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

(if (= 0 (askbool
                (prompt #ask-floppyinstall)
                (help #help-floppyinstall)
         )
    )
(abort (#aborted))
)

(set sysok 0)
(set wheresys (getdevice "SYS:"))

(if  (= sysok 0)
        (if  (= wheresys "DF0")
                (set sysok 1)
        )
)
(if  (= sysok 0)
        (if  (= wheresys "DF1")
                (set sysok 1)
        )
)
(if  (= sysok 0)
        (if  (= wheresys "DF2")
                (set sysok 1)
        )
)
(if  (= sysok 0)
        (if  (= wheresys "DF3")
                (set sysok 1)
        )
)

(if (= sysok 0)
        (abort (#nofloppy))
)

(set envoy_dest "SYS:Envoy")

(if (NOT (exists envoy_dest))
        (makedir envoy_dest (infos))
)

(if (NOT (exists "env:Envoy"))
        (makedir "env:Envoy")
)

(if (NOT (exists "envarc:Envoy"))
        (makedir "envarc:Envoy")
)

(if (NOT (exists "SYS:L"))
        (makedir "SYS:L")
)

(set is_update 0)
;
;
;  Now that we know where it goes and whether we are overwriting it:
;
(if (NOT @pretend) (set @default-dest envoy_dest))

;
; Figure out what workbench version they are using.
;
(set WBVersion (/ (getversion "SYS:Libs/version.library") 65536))

;
; V37.  We have to delete a whole bunch of stuff to make
; room for everything.
;
(if     (= WBVersion 37)
        (
                (delete "SYS:Libs/translator.library")
                (delete "SYS:Devs/narrator.device")
                (delete "SYS:System/DiskCopy")
                (delete "SYS:System/DiskCopy.info")
                (delete "SYS:System/Format")
                (delete "SYS:System/Format.info")
                (delete "SYS:System/NoFastMem")
                (delete "SYS:System/NoFastMem.info")
                (delete "SYS:System/FixFonts")
                (delete "SYS:System/FixFonts.info")
                (delete "SYS:Utilities/Clock")
                (delete "SYS:Utilities/Clock.info")
                (delete "SYS:Utilities/Display")
                (delete "SYS:Utilities/Display.info")
                (delete "SYS:Utilities/Say")
                (delete "SYS:Utilities/Say.info")
        )
)

; V39.  We have to delete a whole bunch of stuff to make
; room for everything.
;
(if     (>= WBVersion 39)
        (
                (delete "SYS:System/DiskCopy")
                (delete "SYS:System/DiskCopy.info")
                (delete "SYS:System/Format")
                (delete "SYS:System/Format.info")
                (delete "SYS:System/NoFastMem")
                (delete "SYS:System/NoFastMem.info")
                (delete "SYS:System/FixFonts")
                (delete "SYS:System/FixFonts.info")
                (delete "SYS:Utilities/Clock")
                (delete "SYS:Utilities/Clock.info")
                (delete "SYS:Devs/mfm.device")
                (delete "SYS:C/Edit")
                (delete "SYS:C/MagTape")
                (delete "SYS:C/Makelink")
                (delete "SYS:C/Setfont")
                (delete "SYS:C/Sort")
                (delete "SYS:L/CrossDOSFileSystem")
                (delete "SYS:Libs/amigaguide.library")
                (delete "SYS:Libs/bullet.library")
                (delete "SYS:Devs/Dosdrivers/PIPE#?")
        )
)

;=============================================================================
; Delete obsolete files?

(set first TRUE)
(working (#checking-obsolete))

(set n 0)
(while (set thisfile (select n "SYS:Expansion/Ariadne"
                               "SYS:Expansion/Ariadne.info"
                               "devs:theseus.device"
                               "devs:vpio.device"
                               ""
                     )
       )
(
    (set n (+ n 1))

    (if (exists thisfile)
    (
        (if (= first TRUE)
        (
            (set query FALSE)
            (if (>= @user-level 1)
            (
                (set query TRUE)
                (if (askbool (prompt #delete-old)
                             (help #nohelp)
                             (choices #delete-old-1 #delete-old-2)
                             (default 1)
                    )
                (
                    (set query FALSE)
                    (working #deleting-obsolete)
                )
                (
                    (working (#checking-obsolete))
                ))
            ))
            (set first FALSE)
        ))

        (if (= query TRUE)
        (
            (if (askbool (prompt (#confirm-delete thisfile))
                         (help #confirm-delete-help)
                         (default 1)
                )
            (
                (delete thisfile)
            ))
        )
        (
            (delete thisfile)
        ))
    ))
    (working (#checking-obsolete))
))

(working (#install-envoylibs))

;
;  do the main copying.  Because pattern and all are mutually exclusive,
;  I have to copy each directory separately!!!  Copylib is used
;  for each library individually so that no smaller version is overwritten
;  by a higher version.  Last time I checked though, this feature was broken.
;
(copylib (source "AriadneInstall:libs/accounts.library")
         (dest "libs:")
         (prompt #copy "accounts.library ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(copylib (source "AriadneInstall:libs/envoy.library")
         (dest "libs:")
         (prompt #copy "envoy.library ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(copylib (source "AriadneInstall:libs/services.library")
         (dest "libs:")
         (prompt #copy "services.library ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(copylib (source "AriadneInstall:libs/nipc.library")
         (dest "libs:")
         (prompt #copy "nipc.library ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(if (NOT (exists (tackon envoy_dest "Configuration")))
        (makedir (tackon envoy_dest "Configuration") (infos))
)

(set n 0)
(while  (< n 4)
        (
                (copylib (prompt #copy-configeditors)
                         (source (select n       "EnvoyInstall:Configuration/Filesystem Imports"
                                                 "EnvoyInstall:Configuration/Network Printing"
                                                 "EnvoyInstall:Configuration/Network Configuration"
                                                 "EnvoyInstall:Configuration/Envoy V37 PrintStart"
                                                 "EnvoyInstall:Configuration/Printer Import"
                                                 "EnvoyInstall:Configuration/Users"
                                                 "EnvoyInstall:Configuration/Groups"
                                 )
                         )
                         (dest  (tackon envoy_dest "Configuration"))
                         (infos)
                         (help @copylib-help)
                         (confirm)
                         (optional askuser)
                )
                (set n (+ n 1))
        )
)

(copyfiles (source "AriadneInstall:Tools/SanaIIDevStat")
           (dest envoy_dest)
           (infos)
           (prompt #copy-sanaiidevstat)
           (help #help-sanaiidevstat)
           (confirm)
           (optional askuser)
)

(copylib (source "AriadneInstall:c/Mount")
         (dest "C:")
         (prompt #copy "c:Mount ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:c/Protect")
         (dest "C:")
         (prompt #copy "c:Protect ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:c/List")
         (dest "C:")
         (prompt #copy "c:List ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

; needed to get the fix for V37/38/39 dos exall emulation (drops files at
; buffer boundaries).  Can't use the V40 setpatch under pre-V38 WB ...
;
(if (= (/ (getversion "c:SetPatch") 65536) 37)
(
    (copylib (source "AriadneInstall:c/Setpatch.V37")
             (dest "c:")
             (newname "SetPatch")
             (prompt #copy "SetPatch ...")
             (help @copylib-help)
             (confirm)
             (optional askuser)
    )
    (copylib (source "AriadneInstall:c/Setpatch")
             (dest "c:")
             (prompt #copy "SetPatch ...")
             (help @copylib-help)
             (confirm)
             (optional askuser)
    )
))

(copylib (source "AriadneInstall:c/owner")
         (dest "C:")
         (prompt #copy "c:Owner ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:c/group")
         (dest "C:")
         (prompt #copy "c:Group ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:L/EnvoyFileSystem")
         (dest "L:")
         (prompt #copy "l:EnvoyFileSystem ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(if (NOT (exists "env:Envoy"))
        (makedir "env:Envoy")
)

(if (NOT (exists "envarc:Envoy"))
        (makedir "envarc:Envoy")
)

(if (NOT (exists "devs:Networks"))
        (makedir "devs:Networks")
)

(if (NOT (exists (tackon envoy_dest "Services")))
        (makedir (tackon envoy_dest "Services"))
)
(copylib (source "AriadneInstall:Services/filesystem.service")
         (dest (tackon envoy_dest "Services"))
         (infos)
         (prompt #copy "filesystem.service ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(copylib (source "AriadneInstall:Services/printspool.service")
         (dest (tackon envoy_dest "Services"))
         (infos)
         (prompt #copy "printspool.service ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(copylib (source "AriadneInstall:Services/Services Manager")
         (dest (tackon envoy_dest "Services"))
         (infos)
         (prompt #copy "Services Manager ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(tooltype
        (dest (tackon envoy_dest "Services/Services Manager"))
        (settooltype "DONOTWAIT" "TRUE")
)

(if (NOT (exists (tackon envoy_dest "Accounts")))
        (makedir (tackon envoy_dest "Accounts"))
)
(copylib (source "AriadneInstall:Accounts/Accounts Manager")
         (dest (tackon envoy_dest "Accounts"))
         (infos)
         (prompt #copy "Accounts Manager ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)
(tooltype
        (dest (tackon envoy_dest "Accounts/Accounts Manager"))
        (settooltype "UserDB" (tackon envoy_dest "Accounts/UserData"))
        (settooltype "GroupDB" (tackon envoy_dest "Accounts/GroupData"))
        (settooltype "DONOTWAIT" "TRUE")
)

(set svcs   (askoptions
                    (prompt #ask-whichservices)
                    (choices #choice-filesystem #choice-printer)
                    (default 1)
                    (help #help-whichservices)
            )
)
(textfile
        (dest   "T:servicesconfig.txt")
        (append (cat    "SERVICE \"Filesystem\" "
                        (tackon envoy_dest "Services/filesystem.service")
                )
        )
        (if (in svcs 0)
            (append (cat    " Active\n"
                    )
            )
            (append "\n")
        )
        (append (cat    "SERVICE \"Print Spooler\" "
                        (tackon envoy_dest "Services/printspool.service")
                )
        )
        (if (in svcs 1)
            (append (cat    " Active\n"
                    )
            )
            (append "\n")
        )
)
; if either is set copy services and accounts to wbstartup
(if (in svcs 0 1)
 (
        (copyfiles
                (source (tackon envoy_dest "Services/Services Manager"))
                (dest   "SYS:WBStartup")
                (infos)
        )
        (copyfiles
                (source (tackon envoy_dest "Accounts/Accounts Manager"))
                (dest   "SYS:WBStartup")
                (infos)
        )
 )
)
(run "EnvoyInstall:C/BuildSMPrefs t:servicesconfig.txt ENVARC:Envoy/Services.prefs")
(run "EnvoyInstall:C/BuildSMPrefs t:servicesconfig.txt ENV:Envoy/Services.prefs")
(set UserDBPath (tackon envoy_dest "Accounts/UserData"))
(set GroupDBPath (tackon envoy_dest "Accounts/GroupData"))

(copylib (source "AriadneInstall:DEVS/printer.device")
         (dest "DEVS:")
         (prompt #copy "printer.device ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:L/port-handler")
         (dest "L:")
         (prompt #copy "l:port-handler ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copylib (source "AriadneInstall:Prefs/Printer")
         (dest "SYS:Prefs")
         (infos)
         (prompt #copy "Prefs/Printer ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(if (= (/ (getversion) 65536) 37)
        (startup "NetworkPrinting"
                (prompt #ask-assignprinters)
                (command
                        ("ASSIGN PRINTERS: DEVS:Printers")
                )
                (help #help-assignprinters)
        )
)

(if is_update (exit))

(set OwnerName
        (askstring
                (prompt #ask-ownername)
                (default #default-ownername)
                (help #help-ownername)
        )
)
(set HostName
        (askstring
                (prompt #ask-hostname)
                (default "Amiga")
                (help #help-hostname)
        )
)
(set HostNumber
        (askstring
                (prompt #ask-hostnumber)
                (default "233.239.1.1")
                (help #help-hostnumber)
        )
)

(set IPType 2048)
(set ARPType 2054)

(set DeviceName "DEVS:Networks/ariadne.device")
(copylib (source "AriadneInstall:DEVS/Networks/ariadne.device")
         (dest   "DEVS:Networks")
         (prompt #copy "ariadne.device ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(set HostInfo
        (cat    "HOSTINFO "
                HostName
                " OWNER \""
                OwnerName
                "\"\n"
        )
)
(set DevInfo
        (cat    "DEVINFO "
                DeviceName
                " "
                HostNumber
                " "
                ("%ld " IPType)
                ("%ld\n" ARPType)

        )
)

(textfile
        (dest   "T:nipcconfig.txt")
        (append HostInfo)
        (append DevInfo)
)

(run "EnvoyInstall:C/BuildNIPCPrefs t:nipcconfig.txt ENVARC:Envoy/NIPC.prefs")
(run "EnvoyInstall:C/BuildNIPCPrefs t:nipcconfig.txt ENV:Envoy/NIPC.prefs")

(
    (run ("\"%s\" %s %s \"%s\" %s \"%s\" " (tackon envoy_dest "Accounts/Accounts Manager")
                              "InitDB"
                              "UserDB"
                              UserDBPath
                              "GroupDB"
                              GroupDBPath))

)

(copylib (source "AriadneInstall:DEVS/ariadnepar.device")
         (dest "DEVS:")
         (prompt #copy "ariadnepar.device ...")
         (help @copylib-help)
         (confirm)
         (optional askuser)
)

(copyfiles (source "AriadneInstall:Tools/UseAriadnePar")
           (dest "SYS:Tools")
           (infos)
           (prompt #copy-useariadnepar)
           (help #help-useariadnepar)
           (confirm)
           (optional askuser)
)

(copyfiles (source "AriadneInstall:Prefs/Presets")
           (dest ("SYS:Prefs/Presets"))
           (all)
           (infos)
           (prompt #copy-presets)
           (help #help-presets)
           (confirm)
           (optional askuser)
)

;
; is a locale.library >= V37 installed?
;
(if (>= (/ (getversion "locale.library" (resident)) 65536) 37)
    (
        if (askbool
                (prompt #ask-catalogs)
                (help #nohelp)
                (default 1)
            )
        (
            (copyfiles (source "AriadneInstall:Tools/catalogs/deutsch")
                       (dest ("LOCALE:catalogs/deutsch"))
                       (all)
            )
        )
    )
)

(message #msg-finish)
