; NETCONNECT 3 Install Script
; $VER: NetConnect2 Installer v3 (09-Oct-99)
;
; Copyright © 1999 Active Technologies
; http://www.active-net.co.uk
;
; Install script by Ben Preece <beej@bigfoot.com> (v 1.0)
;        and Michael Neuweiler <dolphin@unizh.ch> (v 2.0)
;
; Piracy and unlawful duplication of this package may result in
; criminal prosecution to the full extent of UK and European law.



(set @app-name "NetConnect 3")
(set #error-msg "An unexpected error has occured. Installation aborted.")

(message "\n"
         "Welcome to the " @app-name " installer.\n"
         "\n"
         "\n"
         "© Active Technologies 1999\n"
         "\n"
         "http://www.active-net.co.uk\n"
         "\n"
         "\n"
         "\n"
         "Piracy and unlawful duplication of this package may result in "
         "criminal prosecution to the full extent of UK and European law."
)



; Main component names & def pattern
(set #amitcp-name   "Genesis v1.0.6")
(set #dock-name     "Octopus - Internet Dock")
(set #nc3progs-name "NetConnect 3 programs")
(set #nc3docs-name  "NetConnect 3 documentation")
(set #mui-name      "Magic User Interface v3.8")
(set #NC3-choice 31)

; NetConnect programs & def pattern
(set #md2-name      "MicroDot-II v1.4")
(set #v3-name      "Voyager 3")
(set #mftp-name    "mFTP-II v1.1")
(set #amirc-name    "AmIRC v3")
(set #amchat-name   "AmChat")
(set #amtelnet-name "AmTelnet v2")
(set #netinfo-name  "NetInfo v2.2")
(set #webvision-name   "WebVision v2.2")
(set #metalweb-name     "MetalWeb v4")
(set #cm-name       "Contact Manager v1.6")
(set #mime-name     "MIMEprefs v1.4")
(set #NC3progs-choice 2047)

; main NC3 dirs
(set #source-dir        "NETCD3:")
(set #c-dir             "C")
(set #NC3data-dir       "Data")
(set #NC3docs-dir       "Docs")
(set #env-dir           "ENV")
(set #fonts-dir         "Fonts")
(set #images-dir        "Images")
(set #l-dir             "L")
(set #libs-dir          "Libs")
(set #mime-dir          "MIME")
(set #prefs-dir         "Prefs")
(set #programs-dir      "Programs")
(set #devs-net-dir      "Devs/Networks")
(set #progs-oct-dir     "Programs/Octopus")

; program dirs
(set #md2-dir           "MicroDot-II")
(set #vng-dir           "Voyager")
(set #mftp-dir          "mFTP")
(set #amirc-dir         "AmIRC")
(set #amchat-dir        "AmChat")
(set #amtelnet-dir      "AmTelnet")
(set #netinfo-dir       "NetInfo")
(set #cm-dir            "Manager")
(set #wv-dir            "WebVision")
(set #mw-dir            "MetalWeb")
(set #octopus-dir       "Octopus")

; NetConnect Components
(set #nc-name           "Octopus")
(set #nc-prefs-name     "OctpusPrefs")
(set #nc-config-name    "Octopus.prefs")
(set #mime-prefs-name   "MIME.prefs")
(set #cmanager-path-name "CManager_path")
(set #wbstart-name      "WBStart-Handler")
(set #openhand-name     "OpenURL-Handler")
(set #openurl-name      "OpenURL")

; old MD-II components
(set #oldmd2-dir        (if (getenv "Vapor/MD2_LASTUSEDDIR") (getenv "Vapor/MD2_LASTUSEDDIR") "SYS:"))
(set #md2book-name      "MicroDot.Addressbook")
(set #md2config-name    "MicroDot.prefs")

; old V components
(set #oldv-dir          (if (getenv "Vapor/MD2_LASTUSEDDIR") (getenv "Vapor/Voyager_LASTUSEDDIR") "SYS:"))
(set #vbook-name        "Bookmarks.HTML")

; old AmIRC components
(set #oldamirc-dir      (if (getenv "Vapor/AmIRC_LASTUSEDDIR") (getenv "Vapor/AmIRC_LASTUSEDDIR") "SYS:"))
(set #amircprefs-name   "Default.AmIRCfg")

; name for assign
(set #nc3-dir           "NetConnect3")
(set #nc3-assign        "NetConnect3:")
(set #NC2-dir           "NetConnect2")
(set #NC2-assign        "NetConnect2:")
(set #amitcp-dir        "AmiTCP")
(set #amitcp-assign     "AmiTCP:")
(set #mui-dir           "MUI")
(set #mui-assign        "MUI:")


(welcome)

(onerror
 (if #old-amitcp-dir
     (makeassign #amitcp-dir #old-amitcp-dir))
 (if #old-mui-dir
     (makeassign #mui-dir #old-mui-dir))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure check-system-version

  (transcript "checking system version")
  (if (< (/ (getversion) 65536) 39)
      (exit "\n\n" @app-name " requires Kickstart version 3.0 or above.\n\n\n"
            "Installation aborted.\n\n"
            (quiet)
      )
  )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure check-old-assign

   (transcript "Checking for old version of NetConnect.")
   (set #old-nc2-dir
      (if (exists #nc2-assign (noreq))
         (getassign #nc2-dir)
         "")
   )
   (if #old-nc-dir
   (
      (transcript "Existing NetConnect detected at directory " #old-nc2-dir ".")
      (set #old-md2-dir    "NetConnect2:Programs/MicroDot-II/")
      (set #old-v-dir      "NetConnect2:Programs/Voyager/")
      (set #old-amirc-dir  "NetConnect2:Programs/AmIRC/")
   ))


   (transcript "Checking for already installed AmiTCP.")
   (set #old-amitcp-dir
      (if (exists #amitcp-assign (noreq))
         (getassign #amitcp-dir)
         "")
   )
   (if #old-amitcp-dir
      (transcript "Existing AmiTCP detected at directory " #old-amitcp-dir "."))


   (transcript "Checking for already installed MUI.")
   (set #old-mui-dir
      (if (exists #mui-assign (noreq))
         (getassign #mui-dir)
         "")
   )
   (if #old-mui-dir
      (transcript "Existing MUI detected at directory " #old-mui-dir "."))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure ask-install

   (set #NC3-choice
      (askoptions
         (prompt "Please select which parts of the " @app-name " package you wish to install.")
         (help "There are several parts to the " @app-name " package, some of which you may or may not wish to install. "
               "Many of the parts are unique to this release, so if you have not installed any of these already you should select them all.")
         (choices (cat #amitcp-name " (TCP/IP stack)")
                  (cat #dock-name " (Internet dock bar)")
                  (cat #nc3progs-name " (Voyager, AmIRC, etc.)")
                  (cat #nc3docs-name " (Help and info)")
                  (cat #mui-name " (Graphical interface)")
         )
         (default #NC3-choice)
      )
   )

   (if (= 0 #NC3-choice)
      (exit "\n\n\n\nNo " @app-name " components have been selected.\n"
            "Installation aborted.\n" (quiet))
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure ask-prg-install

   (set #nc3progs-choice
      (askoptions
         (prompt "Please select which " @app-name " component programs you wish to install.")
         (help "There are several programs within the " @app-name " package, some of which you may or may not wish to install. "
               "Many are fully-functional release versions of popular internet programs, and some are exclusive to " @app-name ". "
               "If you have not installed any of these already you should select them all.")
         (choices (cat #md2-name      " (E-mail)")
                  (cat #v3-name      " (Web browser)")
                  (cat #mftp-name    " (FTP client)")
                  (cat #amirc-name    " (IRC client)")
                  (cat #amchat-name   " (Direct chat client)")
                  (cat #amtelnet-name " (Telnet client)")
                  (cat #netinfo-name  " (Internet tools)")
                  (cat #webvision-name   " (WebCam viewer)")
                  (cat #metalweb-name     " (WYSYWYG web editor)")
                  (cat #cm-name       " (System address book)")
                  (cat #mime-name     " (MIME-type preferences)")
         )
         (default #nc3progs-choice)
      )
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure ask-dst-dir

   (if (exists "Internet:" (noreq))
      (set @default-dest "Internet:")
      (if (exists "Work:" (noreq))
         (set @default-dest "Work:")
         (set @default-dest "SYS:")
      )
   )

   (set @default-dest
      (tackon
         (askdir
            (prompt "Please select where you would like " @app-name " installed."
                    "A drawer called '" #nc3-dir "' will be created there.")
            (help "Select where you would like " @app-name " installed."
                  "The installer will then create a drawer called '" #nc3-dir "', "
                  "and copy the programs and documentation into it.")
            (default @default-dest)
            (newpath)
         )
         #nc3-dir
      )
   )

   (if (NOT (exists @default-dest))
      (makedir @default-dest (infos))
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure add-NC3-assign

   (transcript "creating netconnect3: assign")
   (set uus::commands (cat "assign " #nc3-assign " \"" (expandpath @default-dest) "\"\n"))
   (set uus::section "NetConnect3")
   (update-user-startup)

   (makeassign #nc3-dir (expandpath @default-dest))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure check-cpu-type

   (transcript "checking CPU type")
   (set #cpu-type (database "cpu"))
   (if (= #cpu-type "68060")
      (set #cpu-choice 4)
      (if (= #cpu-type "68040")
         (set #cpu-choice 3)
         (if (= #cpu-type "68030")
            (set #cpu-choice 2)
            (if (= #cpu-type "68020")
               (set #cpu-choice 1)
               (set #cpu-choice 0)
            )
         )
      )
   )

   (set #cpu-choice
      (askchoice
         (choices "68000" "68020" "68030" "68040" "68060")
         (prompt "Please select which CPU " @app-name " will be running on.")
         (help "Some parts of the " @app-name " package have been optimised for specific members of the 68000 processor family. "
               "You should select the processor that " @app-name " will be running on so that the most appropriate programs will be used.")
         (default #cpu-choice)
      )
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; arguments:
;;
;; uus::commands - commands to add
;; uus::section  - section name
;;
(procedure update-user-startup

   (set uus::complete (cat ";BEGIN " uus::section "\n"
      uus::commands
      ";END " uus::section "\n"))

   (set startup-changed 1)
   (startup
      uus::section
      (command uus::commands)
      (prompt "Installer will modify your S:User-Startup file. "
              "Following lines will be appended to it:\n\n"
              uus::complete)
      (help "   Installer needs to make indicated modifications to your user startup file.\n"
            "   You should make modifications later by hand if you skip this part.")
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-amitcp

   (transcript "installing amitcp")
   (if (NOT (exists (tackon @default-dest #amitcp-dir)))
      (makedir (tackon @default-dest #amitcp-dir) (infos))
   )

   (copyfiles
      (source #source-dir)
      (dest @default-dest)
      (choices "AmiTCP.info")
      (infos)
   )

   (set #amitcp-source-dir (tackon #source-dir #amitcp-dir))

   (copyfiles
      (source #amitcp-source-dir)
      (dest (tackon @default-dest #amitcp-dir))
      (all)
   )

   (if (NOT (exists "DEVS:Networks"))
      (makedir "DEVS:Networks")
   )
   (copyfiles
      (source #devs-net-dir)
      (dest "DEVS:Networks/")
      (choices "aslip.device")
   )

   (if (= 0 #cpu-choice) (set #appp-name "appp.device"))
   (if (= 1 #cpu-choice) (set #appp-name "appp.device.020"))
   (if (= 2 #cpu-choice) (set #appp-name "appp.device.030"))
   (if (= 3 #cpu-choice) (set #appp-name "appp.device.030"))
   (if (= 4 #cpu-choice) (set #appp-name "appp.device.030"))

   (copyfiles
      (source (tackon #devs-net-dir #appp-name))
      (dest "DEVS:Networks/")
      (newname "appp.device")
   )

   (set uus::commands (cat "Assign " #amitcp-assign " \"" (expandpath (tackon @default-dest #amitcp-dir)) "\"\n"
                           "path " (tackon #amitcp-assign "bin") " add\n"
                           "Assign APIPE: Exists > NIL:\n"
                           "IF Warn\n"
                           "  Mount APIPE: from " (tackon #amitcp-assign "devs/APipe-Mountlist") "\n"
                           "EndIf\n"))
   (set uus::section "AmiTCP/IP")
   (update-user-startup)

   (makeassign #amitcp-dir (expandpath (tackon @default-dest #amitcp-dir)))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-mui

   (transcript "installing mui")
   (set #mui-dest
      (askdir
         (prompt "Please select where you would like " #mui-name " installed."
                 "A drawer called '" #mui-dir "' will be created there.")
         (help "Select where you would like " @mui-name " installed. "
               "The installer will then create a drawer called '" #mui-dir "', "
               "and copy the required programs and documentation into it.")
         (default "SYS:")
         (newpath)
      )
   )

   (copyfiles
      (source #source-dir)
      (dest #mui-dest)
      (choices #mui-dir)
      (infos)
   )

   (set uus::commands (cat "Assign " #mui-assign " \"" (expandpath (tackon #mui-dest #mui-dir)) "\"\n"
                           "Assign LIBS: \"" (tackon #mui-assign "Libs") "\" ADD\n"
                           "Assign LOCALE: \"" (tackon #mui-assign "Locale") "\" ADD\n"))
   (set uus::section "MUI")
   (update-user-startup)

   (makeassign #mui-dir (expandpath (tackon #mui-dest #mui-dir)))
   (set mui-script "t:mui-script")
   (textfile
      (dest mui-script)
      (append "assign LIBS: " (tackon #mui-assign "Libs") " ADD\n"
              "assign LOCALE: " (tackon #mui-assign "Locale") " ADD\n")
      (safe))
   (protect mui-script "+s +e")
   (execute mui-script)
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-mcc

   (transcript "installing mui mcc")
   (if (= 2 (exists "MUI:libs/MUI/" (noreq)))
   (
      (transcript "found existing MUI:libs/MUI dir")
      (set #mcc-source-dir (tackon #source-dir "MCC/"))
      (foreach #mcc-source-dir "#?"
      (
         (copylib
            (prompt "Installing " @each-name)
            (confirm)
            (help @copylib-help)
            (source (tackon #mcc-source-dir @each-name))
            (dest "MUI:libs/mui/")
            (optional "askuser" "force")
         )
      ))
   ))

   ;Copy TO images etc
   (set #imagedest
        (select
                (= 2 (exists "sys:Classes" (noreq)))
                "Libs:Images"
                "Sys:Classes/Images"
        )
)

(if (<> 2 (exists #imagedest (noreq)))
        (makedir #imagedest (confirm)
        (help "Your system doesn't contain a directory for images."))
)

(copylib
        (prompt "Installing hvdragbar.image")
        (confirm)
        (source "NETCD3:sysimages/hvdragbar.image")
        (dest #imagedest)
        (help @copylib-help)

)

(copyfiles
        (prompt "Installing TearOff MUI images")
        (confirm)
        (source #images-dir)
        (dest "MUI:Images")
        (all)
        (help @copyfiles-help)
)
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-nc-dock

   (transcript "installing Octopus Internet dock")
   (copyfiles
      (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #octopus-dir (cat #octopus-dir ".info"))
         (infos)
   )

   (copyfiles
      (source #source-dir)
      (dest @default-dest)
      (choices #NC3data-dir)
      (infos)
   )

   (if (NOT (exists (tackon "envarc:" #nc-config-name)))
   (
      (copyfiles
        (source (tackon #source-dir #env-dir))
        (dest "envarc:")
        (choices #nc-config-name)
      )
      (copyfiles
        (source (tackon #source-dir #env-dir))
        (dest "env:")
        (choices #nc-config-name)
      )
   ))

   (copylib
      (prompt "Installing " #wbstart-name)
      (confirm)
      (help @copylib-help)
      (source (tackon (tackon #source-dir #l-dir) #wbstart-name))
      (dest "L:")
      (optional "askuser" "force")
   )

     (copylib
      (prompt "Installing " #openhand-name)
      (confirm)
      (help @copylib-help)
      (source (tackon (tackon #source-dir #l-dir) #openhand-name))
      (dest "L:")
      (optional "askuser" "force")
   )

   (if (= 1 (askbool
      (prompt "\nIf you would like " #dock-name " to be started every time Workbench is loaded, the " #dock-name " can be copied to your startup drawer.\n\n\n"
              "Would you like the " #dock-name " to be added to your Workbench startup?\n")
      (help "If you would like the " #dock-name " to run automatically when Workbench is loaded, it will be copied into your startup drawer.")
      (default 1)))
   (
      (copyfiles
         (source (tackon #source-dir #progs-oct-dir))
         (dest "SYS:WBStartup")
         (infos)
         (choices #nc-name)
      )
   ))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-misc

   (transcript "installing misc stuff")
   (copyfiles
      (source (tackon #source-dir #fonts-dir))
      (dest "FONTS:")
      (all)
   )

   (if (NOT (exists (tackon @default-dest #mime-dir)))
   (
      (copyfiles
         (source #source-dir)
         (dest @default-dest)
         (choices #mime-dir)
         (infos)
      )
   ))

   (foreach (tackon #source-dir #libs-dir) "#?"
   (
      (copylib
         (prompt "Installing " @each-name)
         (help @copylib-help)
         (source (tackon (tackon #source-dir #libs-dir) @each-name))
         (dest "Libs:")
         (confirm)
      )
   ))

   ; Open URL install
      (copyfiles
         (source #prefs-dir)
         (dest "SYS:Prefs")
         (choices #openurl-name (cat #openurl-name ".info"))
         (infos)
      )
      (copyfiles
         (source #c-dir)
         (dest "C:")
         (choices #openurl-name)
      )

      (copyfiles
         (prompt "Installing the optional ARexx OpenURL script")
         (help "This is a small example script that opens URLs.")
         (source "Rexx/OpenURL.rexx")
         (dest "S:")
         (confirm)
      )

      ; Set environment variable

      (run "Echo SYS:Prefs/OpenURL >ENV:OpenURL_Prefs_Path")
      (run "Echo SYS:Prefs/OpenURL >ENVARC:OpenURL_Prefs_Path")
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-nc-programs

   (transcript "installing nc programs")
   (if (NOT (exists (tackon @default-dest "Programs/")))
      (makedir (tackon @default-dest "Programs/") (infos))
   )

   (ask-prg-install)
    
   ; MD2 install
   (if (IN #NC3progs-choice 00)
   (
      (copyfiles
         (source (tackon #source-dir #programs-dir))
         (dest (tackon @default-dest #programs-dir))
         (choices #md2-dir (cat #md2-dir ".info"))
         (infos)
      )
      (if (NOT (exists (tackon (tackon (tackon @default-dest #programs-dir) #md2-dir) "Data")))
         (makedir (tackon (tackon (tackon @default-dest #programs-dir) #md2-dir) "Data"))
      )

      ;duplicate old MD2
      (if (= 1 (askbool
         (prompt "\nAs this is a new install of " #md2-dir ", its database of messages will be empty.\n"
                 "If you already use " #md2-dir " then you may wish to import your existing e-mail and news database into this new version.\n"
                 "\n\n\nWould you like to duplicate an existing " #md2-dir " database?\n")
         (help "If you have already installed and used " #md2-dir " then you will already have a database made up of your e-mail and news messages."
               "This database is compatible with this new installation of " #md2-dir ", so unless you want to forget your old messages you should allow them to be duplicated for the new version.\n")
         (default 1)))
      (
         (set #oldmd2-choice (askoptions
            (prompt "\nPlease select which " #md2-dir " components you would like duplicated.\n")
            (help "You may wish to duplicate your existing Address Book or message database for the new installation."
                  "All database components should be selected if you would like it to duplicate correctly."
                  "An existing preferences file cannot be copied due to version incompatibilities.\n")
            (choices "Configuration" (cat #md2book-name  " (Address Book)") "Message database")
            (default 7))
         )
         ;copy address book & config
         (if (OR (IN #oldmd2-choice 00) (IN #oldmd2-choice 01))
         (
            (set #oldmd2-dir (askdir
               (prompt "Please select the drawer where your existing " #md2-dir " can be found.")
               (help "Find and enter the drawer of an existing installation of " #md2-dir ". "
                     "You have to enter the directory where the application " #md2-dir "itself is stored in.")
               (default #oldmd2-dir))
            )
            (if (IN #oldmd2-choice 00)
            (
               (if (exists (tackon #oldmd2-dir #md2config-name))
                  (copyfiles
                     (source #oldmd2-dir)
                     (dest (tackon (tackon @default-dest #programs-dir) #md2-dir))
                     (choices #md2config-name)
                  )
               )
            ))
            (if (IN #oldmd2-choice 01)
            (
               (if (exists (tackon #oldmd2-dir #md2book-name))
               (
                  (copyfiles
                     (source #oldmd2-dir)
                     (dest (tackon (tackon @default-dest #programs-dir) #md2-dir))
                     (choices #md2book-name)
                  )
               ))
            ))
         ))
         ; copy database
         (if (IN #oldmd2-choice 02)
         (
            (set #oldmd2db-dir (tackon #oldmd2-dir "Data"))
            (set #oldmd2db-dir (askdir
               (prompt "Please select where your " #md2-dir " data is beeing stored."
               (help   "Enter the drawer where the 'DBX_' directories can be found.")
               (default #oldmd2db-dir)))
            )
            (if (exists #oldmd2db-dir)
               (copyfiles
                  (source #oldmd2db-dir)
                  (dest (tackon (tackon (tackon @default-dest #programs-dir) #md2-dir) "Data"))
                  (all)
               )
            )
         ))
      ))  ; end duplicate old MD2
   ))  ; end MD2 install

   ; V install
   (if (IN #NC3progs-choice 01)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #vng-dir (cat #vng-dir ".info"))
         (infos)
      )

      ;duplicate old V components
      (if (= 1 (askbool
         (prompt "\nAs this is a new install of " #vng-dir ", it will be a generic installation.\n"
                 "If you already use " #vng-dir " then you may wish to import your existing bookmarks file into this new version.\n"
                 "\n\n\nWould you like to duplicate an existing " #vng-dir " bookmarks file?\n")
         (help "If you have already installed and used " #vng-dir " then you will already have a file containing 'bookmarks' to your favourite sites on the web. "
               "This file is compatible with this new installation of " #vng-dir ", so you may want the file copied for this new version.\n")
         (default 1)))
      (
         (set #oldv-dir (askdir
            (prompt "Please select where your existing " #vng-dir " exists."
                    "Enter the drawer where the program file can be found.")
            (help "Find and enter the drawer of an existing installation of " #vng-dir ". "
                  "You should be able to see the main 'Cache' and 'Voyager_home' drawers.")
            (default #oldv-dir)))

         (if (exists (tackon #oldv-dir #vbook-name))
            (copyfiles
               (source #oldv-dir)
               (dest (tackon @default-dest #vng-dir))
               (choices #vbook-name)
            )
         )
      ))
   ))

   ; mFTP install
   (if (IN #NC3progs-choice 02)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #mftp-dir (cat #mftp-dir ".info"))
         (infos)
      )
   ))

   ; AmIRC install
   (if (IN #NC3progs-choice 03)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #amirc-dir (cat #amirc-dir ".info"))
         (infos)
      )

      ;duplicate original AmIRC components
      (if (= 1 (askbool
         (prompt "\nAs this is a new install of " #amirc-dir ", it will be a generic installation.\n"
                 "If you already use " #amirc-dir " then you may wish to import your existing configuration for this new version.\n"
                 "\n\n\nWould you like to duplicate an existing " #amirc-dir " configuration file?\n")
         (help "If you have already installed and used " #amirc-dir " then you will already have a file saving your own preferences. "
               "This file is compatible with this new installation of " #amirc-dir ", so you may want the file copied for this new version.\n")
         (default 1)))
      (
         ; ask for old AmIRC location
         (set #oldamirc-dir (askdir
            (prompt "Please select where your existing " #amirc-dir " exists."
                    "Enter the drawer where the program file can be found.")
            (help "Find and enter the drawer of an existing installation of " #amirc-dir ". "
                  "You should be able to see the main 'Rexx' drawer here.")
            (default #oldamirc-dir)))

         (if (exists #oldamirc-dir)
            (copyfiles
               (source #oldamirc-dir)
               (dest (tackon (tackon @default-dest "Programs/") #amirc-dir))
               (choices #amircprefs-name)
            )
         )
      ))
   ))

   ; AmChat install
   (if (IN #NC3progs-choice 04)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #amchat-dir (cat #amchat-dir ".info"))
         (infos)
      )
   ))

   ; AmTelnet install
   (if (IN #NC3progs-choice 05)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #amtelnet-dir (cat #amtelnet-dir ".info"))
         (infos)
      )
   ))

   ; NetInfo install
   (if (IN #NC3progs-choice 06)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #netinfo-dir (cat #netinfo-dir ".info"))
         (infos)
      )
   ))

   ; WebVision install
   (if (IN #NC3progs-choice 07)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #wv-dir (cat #wv-dir ".info"))
         (infos)
      )
   ))

   ; MetalWeb install
   (if (IN #NC3progs-choice 08)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #mw-dir (cat #mw-dir ".info"))
         (infos)
      )
   ))

   ; Contact Manager install
   (if (IN #NC3progs-choice 09)
   (
      (copyfiles
         (source #programs-dir)
         (dest (tackon @default-dest #programs-dir))
         (choices #cm-dir (cat #cm-dir ".info"))
         (infos)
      )

      (if (NOT (exists "envarc:Vapor"))
         (makedir "envarc:Vapor")
      )
      (if (NOT (exists "env:Vapor"))
         (makedir "env:Vapor")
      )

      (textfile
         (dest (tackon "envarc:Vapor" #cmanager-path-name))
         (append (expandpath (tackon (tackon (tackon @default-dest #programs-dir) #cm-dir) "CManager")))
      )
      (textfile
         (dest (tackon "env:Vapor" #cmanager-path-name))
         (append (expandpath (tackon (tackon (tackon @default-dest #programs-dir) #cm-dir) "CManager")))
      )
   ))

   ; MIMEprefs install
   (if (IN #NC3progs-choice 10)
   (
      (copyfiles
         (source (tackon #source-dir #prefs-dir))
         (dest "SYS:Prefs/")
         (infos)
         (all)
      )
      (copyfiles
         (source (tackon #source-dir #env-dir))
         (dest "envarc:")
         (choices #mime-prefs-name)
      )
      (copyfiles
         (source (tackon #source-dir #env-dir))
         (dest "env:")
         (choices #mime-prefs-name)
      )
   ))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure install-nc-docs

   (transcript "installing nc docs")
   (if (NOT (exists @default-dest))
      (makedir @default-dest (infos))
   )

   (copyfiles
      (source #source-dir)
      (dest @default-dest)
      (choices #NC3docs-dir)
      (infos)
   )
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Installatation sequence
;;;
;;;

(complete 00) (transcript "On making " app-name ".")
(complete 01) (check-system-version)
(complete 02) (check-old-assign)

(complete 05) (ask-install)
(complete 07) (check-cpu-type)
(if (NOT (= #NC3-choice 16))   ; if not only mui is installed
(
   (complete 10) (ask-dst-dir)
   (complete 11) (add-NC3-assign)
   (complete 15)
   (if (OR (OR (IN #NC3-choice 00) (IN #NC3-choice 01)) (IN #NC3-choice 02))
      (install-misc))
))

(complete 20) (if (IN #NC3-choice 00) (install-amitcp))
(complete 30) (if (IN #NC3-choice 01) (install-nc-dock))
(complete 40) (if (IN #NC3-choice 02) (install-nc-programs))
(complete 60) (if (IN #NC3-choice 03) (install-nc-docs))
(complete 80) (if (IN #NC3-choice 04) (install-mui))
(complete 90) (if (NOT (= #NC3-choice 8)) (install-mcc))

(if (IN #NC3-choice 00)
(
   (if (= 1 (askbool
      (prompt "\nWould you like to launch Genesis Wizard to configure the just installed Genesis ?\n")
      (help "The Genesis Wizard will help you to configure Genesis for the first time with"
            "little effort. We advise you to use the Wizard if you are unfamiliar with setting up a network.")
      (default 1)))
   (
      (run "AmiTCP:GenesisWizard")
   ))
))
(if (IN #NC3-choice 01)
(
   (if (exists (tackon "SYS:WBStartup" #nc-name))
      (run (cat "run " (tackon "SYS:WBStartup" #nc-name))))
))

(complete 100)

;; EOF
;;

