;;;; Hey Emacs, this script might as well be -*- lisp -*-
;;;;
;;;; Install_AmiTCP - AmiTCP/IP installation script for Installer
;;;;
;;;; Copyright © 1994 AmiTCP/IP Group,
;;;;                  NSDi - Network Solutions Development Inc., Finland
;;;;                  All rights reserved.
;;;;
;;;; $Id: Install_AmiTCP,v 4.25 1995/01/18 05:31:28 ppessi Exp $
;;;;
;;;; This script has been tested with Installer 1.24:
;;;;
;;;;     Installer and Installer project icon
;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
;;;;     Reproduced and distributed under license from Commodore.
;;;;
;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
;;;;     OR RESPONSIBILITY IS ASSUMED.
;;;;
;;;; Use following Icon tooltypes / Command line options:
;;;; APPNAME=AmiTCP/IP
;;;; MINUSER=AVERAGE
;;;;
(welcome "    Welcome to the " @app-name " 4.2 installation.\n")
;;;;
;;;; What we are?
;;;;
(set app-name (cat @app-name " 4.2"))
(set app-dir-name (cat "AmiTCP" "-4.2"))
;;;;
;;;; "Needs"
;;;;
(set need-version 37  ; version of operating system need by AmiTCP/IP
     need-memory (* 512 1024)

     AmiTCP-release-number 4 ; this release
     )
(set 
;;;
;;; Installation disk names
;;;
 install-disk1-name "AmiTCP-42_Install#1:"
 install-disk2-name "AmiTCP-42_Install#2:"
;;;
;;; Used pkt-files, source-dir will remain on the disk from which the 
;;; installer was started!
;;;
 AmiTCP-pkt-file (tackon install-disk1-name "AmiTCP.pkt")
 Docs-pkt-file (tackon install-disk2-name "AmiTCPdocs.pkt")
 GNUEmacs-pkt-file (tackon install-disk2-name "GNUEmacs.pkt")
 NapsaFonts-pkt-file (tackon install-disk2-name "NapsaFonts.pkt")
 SDK-pkt-file (tackon install-disk2-name "AmiTCP-sdk-41.pkt")
;;;
;;; Other sources on installation disks
;;;
 dist-networks-dir (tackon install-disk2-name "Devs/Networks")
 Installer-file (tackon install-disk1-name "bin/Installer")
 UnPkt-file (tackon install-disk1-name "UnPkt")
 LICENSE-file (tackon install-disk1-name "LICENSE")
 README-FIRST-file (tackon install-disk1-name "README.FIRST")
 GNUEmacs-readme-file (tackon install-disk2-name "GNUEmacs.readme")
 SDK-readme-file (tackon install-disk2-name "AmiTCP-sdk-41.readme")

;;;
;;; Destination directories of the AmiTCP/IP
;;;
 atcp-name "AmiTCP"
 atcp-assign (cat atcp-name ":")	; Assign to AmiTCP
 ;; Configuration
 conf-dir (tackon atcp-assign "db")
 ;; User binaries
 bin-dir (tackon atcp-assign "bin")
 ;; documentation
 doc-dir (tackon atcp-assign "doc")
 ;; devices directory
 devs-dir (tackon atcp-assign "devs")
 ;; AmigaGuide documentation
 help-dir (tackon atcp-assign "help")
 ;; DOS handlers
 l-dir (tackon atcp-assign "l")
 ;; libraries
 libs-dir (tackon atcp-assign "libs")
 ;; daemons
 serv-dir (tackon atcp-assign "serv")
 ;; source
 src-dir (tackon atcp-assign "src")
 ;; includes for net applications
 include-dir (tackon atcp-assign "netinclude")
 ;; network link libraries
 lib-dir (tackon atcp-assign "netlib")
 ;;
 ;; The source directory name
 source-dir (if (= 1 (exists @icon))
		    (pathonly (expandpath @icon))
		  (expandpath @icon))
 ;; Mounts
 apipe-mount (cat 
	      "Assign APIPE: Exists > NIL:\n" 
	      "IF Warn\n"
	      "  Mount APIPE: from AmiTCP:devs/APipe-Mountlist\n"
	      "EndIf\n")
 )
 ;; How to get needed information?
(set
 net-setup-help
     "    You can get this information from your network administration.\n")

;;; copy "more" to ram: to be able to use it
(set
; pager-cmd (if (exists "ENV:PAGER" (noreq)) (getenv "PAGER"))
 pager-cmd 
; (if pager-cmd pager-cmd 
 (if (exists "SYS:Utilities/More" (noreq))
     ((copyfiles
       (prompt "Copying sys:utilities/more to ram: for use")
       (source "SYS:Utilities/More")
       (dest   "RAM:")
       (safe)
       (optional "nofail"))
      "RAM:More")
   ("more"))
; )
 )

;; Return old AmiTCP: assign if we are aborting
(onerror
 (if old-atcp-directory
     (makeassign atcp-name old-atcp-directory)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 check-system-version
 ;; is your Exec recent enough?
 (set exec-version (/ (getversion) 65536))
 (transcript "Running on exec version " exec-version ".")
 (if (< exec-version need-version)	; check operating system version
     ((message "The " @app-name " needs at least Exec version " need-version
	       " to run.\n"
               "You have only version " exec-version ".\n"
	       "You can proceed with the installation, but consider "
	       "installing the " @app-name " with proper version of "
	       "the operating system."
	       (help
		"    The " @app-name " uses some system functions "
		"that are not present or functional in earlier system "
		"versions. Consider updating your system.\n"
		"    If you have a later version of operating system "
		"and are only now using older version: be sure to use "
		"only release 2.04 or newer with the " @app-name ". "
		"No damage happens if you run the " @app-name " with an "
		"earlier operating system, however. It just "
		"refuses to start.\n"
		"    If you decide to continue, no changes will be made to "
		"system startup files, so you must edit them yourself. "
		"Refer instructions for manual installation."))
      (transcript "User decided to continue installation while running "
		  "on operating system release earlier than 2.04."))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 check-available-memory
 ;;
 (transcript "Checking available memory.")
 (set avail-mem (+ (database "total-mem")))
 (if (< avail-mem need-memory)
     ((message "Your system has only " (/ avail-mem 1024) " kilobytes of "
	       "free memory, while the " @app-name " needs at least "
	       (/ need-memory 1024) " to be useful.\n"
	       "You can continue the installation but be warned!")
      (transcript "User decided to continue installation while available "
		  "memory was below the recommended minimum."))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 check-user-level
 ;;
 (transcript "Checking user level.")
 (if (< @user-level 1)
     ((transcript "Installation aborted due to too low user level.")
      (abort "AmiTCP/IP installation requires at least the \"average\" "
	     "user level. Restart installation and select appropriate user "
	     "level."))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 check-old-assign
 ;; If there is already the AmiTCP/IP installed, store the assign
 ;; to old-atcp-directory
 (transcript "Checking for already installed AmiTCP.")
 (set old-atcp-directory 
      (if (exists atcp-assign (noreq))
	  (getassign atcp-name)
	""))
 (if old-atcp-directory
     (transcript "Existing AmiTCP detected at directory " 
		 old-atcp-directory ".")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Simple database "emulator" for testing purposes 
(procedure
 database-test "68000")

(procedure
 check-cpu-type
 (set cpu-type (database "cpu"))
; (set cpu-type (database-test))
 (set cpu-is-020-or-better
      (AND (<> cpu-type "68000")
	   (<> cpu-type "68010")))
 )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ask-accept-license ;; Ask if the user accepts license conditions
 (transcript "Asking if the user accepts the license conditions.")
;;
;; use "more" to show the full license text
;;
 (run (cat "run " pager-cmd) LICENSE-file (safe))
 (message "\nAmiTCP/IP is a copyrighted propiertary software of "
	  "the Network Solutions Development Inc.\n"
          "\nPlease read the shown license text carefully.\n"
          "\nBy proceeding the installation of this software you "
	  "indicate that you accept the license conditions.\n\n"
	  "Also note that you should fill in your registration card "
	  "and send the filled card to NSDi using the included "
	  "return-envelope.  The return-envelope is pre-paid "
	  "worldwide, no extra stamps are needed.\n"
	  )
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 select-destination-directory
 ;; Select destination directory for the installation.
 ;; This is the floppy install-version
 ;;
 (transcript "Selecting destination directory for the installation.")
 (set @default-dest
      (askdir
       (prompt "Select directory where to install the " app-name ".")
       (help "    Here you can specify location where to install "
	     "the " app-name ".\n"
	     "    Installation must NOT be made on top of an older "
	     "version of the " @app-name ".\n"
	     "  Installer will create a subdirectory called `"
	     app-name "' to the selected directory and copy the " 
	     @app-name " files to it.")
       (newpath)
       (default 
	 (if (= 2 (exists "Work:" (noreq)))
	     "Work:" 
	   (cat (getdevice "SYS:") ":")))
       ))
 (set dest-temp (tackon @default-dest app-dir-name))
 (set @default-dest dest-temp)
 (makedir dest-temp (safe) (infos))
 (message app-name " will be installed in " dest-temp)

 ;; Make the AmiTCP: assign
 (makeassign atcp-name @default-dest)
 (if (NOT (= 2 (exists (tackon atcp-assign "devs"))))
     (makedir (tackon atcp-assign "devs")))
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is floppy-install version
;;
;; arguments:
;;
;;   unpkt-source      - the source archive
;;   unpkt-destination - the destination directory
;;   unpkt-sdp         - number of directories to strip
;;   unpkt-title-name  - descriptative name of the archive
;;   unpkt-title-not   - installation unit name

(procedure
 run-unpkt 
 ;;
 (if (exists unpkt-source)
     ((transcript "Dearchiving " unpkt-source " files to " unpkt-destination ".")
      (working "Writing files to " unpkt-destination "...")
      (if (run (cat unpkt-cmd " "
		    "\"" unpkt-source "\" "
		    "\"" unpkt-destination "\""
		    " SDP=" unpkt-sdp 
		    " >\"CON:10/10/600/100/UnPkt Output/INACTIVE/AUTO\" "))
	  (abort "    UnPkt could not dearchive the " unpkt-source ". "
		 "This may be due to:\n"
		 "    1) Not enough disk space\n"
		 "    2) Not enough memory\n"
		 "    3) Corrupted archive\n"
		 "    4) Corrupted UnPkt\n"))
      1)
   ((transcript unpkt-source " could not be located, and is NOT installed!")
    (message "\nWARNING\n\n"
	     "Could not locate the " unpkt-title-name " archive.\n"
	     unpkt-title-not " is NOT installed!")
    0))
 )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is floppy-install version
;;
(procedure
 copy-files-to-destination ;;; UnPkt AmiTCP/IP files to the destination
 ;;
 
 (set 
  unpkt-source AmiTCP-pkt-file
  unpkt-destination @default-dest
  unpkt-sdp 1
  unpkt-title-name "AmiTCP/IP program"
  unpkt-title-not "AmiTCP/IP"
  )
 (if (run-unpkt)
     (
      ;;
      ;; Copy the Installer
      ;;
      (copyfiles
       (source Installer-file)
       (dest bin-dir)
       (files)
       (infos))

      ;;
      ;; Create AmiTCP:log if it does not exist already
      ;;
      (if (NOT (= 2 (exists (tackon atcp-assign "log"))))
	  (makedir (tackon atcp-assign "log")))
      ;;
      ;; Create AmiTCP:log/wtmp if it does not exist already
      ;; (This is to avoid unnecessary errors from the ftpd)
      ;;
      (if (NOT (= 1 (exists (tackon atcp-assign "log/wtmp"))))
	  (textfile (dest (tackon atcp-assign "log/wtmp"))))
      ;;
      ;; Add script flags to the scripts, pure flags to pure programs
      ;;
; (protect (tackon bin-dir "ch_nfsctl") "+s +e")
; (protect (tackon bin-dir "netstat") "+s +e")
; (protect (tackon bin-dir "SynClock") "+s +e")
; (protect (tackon bin-dir "stopnet") "+s +e")
; (if (exists src-dir)
;     ((protect (tackon src-dir "compile") "+s +e")
;      (protect (tackon src-dir "compile.lib") "+s +e")))
; (protect (tackon bin-dir "NapsaTerm") "+p +e")
; (protect (tackon serv-dir "in.fingerd") "+p +e")
; (if (exists (tackon bin-dir "rcsrev"))
;     (protect (tackon bin-dir "rcsrev") "+p +e"))

      (ask-use-020-binaries)

      ;; Install the docs...
      (set
       unpkt-source Docs-pkt-file
       unpkt-destination @default-dest
       unpkt-sdp 1
       unpkt-title-name "AmiTCP/IP documentation"
       unpkt-title-not "Documentation"
       )
      (if (run-unpkt)
	  (if (or (or (>= exec-version 39)
		      (exists "SYS:Utilities/multiview"))
		  (> @user-level 1))
	      (if (askbool
		   (prompt
		    "AmigaGuide utility is used to view the included "
		    "AmigaGuide documents in \"AmiTCP:help/\" directory.\n\n"
		    "Would you like to use MultiView instead?")
		   (help
		    "Installer has detected that your operating system should "
		    "include the MultiView utility, which you might want to "
		    "use instead of AmigaGuide utility to show the online "
		    "documentation."))
		  ((set multiview-path
			(if (exists "SYS:Utilities/multiview")
			    "SYS:Utilities/multiview"
			  (askfile
			   (prompt "Please show where the MultiView utility "
				   "can be found:")
			   (help "The MultiView utility could not be located "
				 "from it's normal location "
				 "(\"SYS:Utilities/multiview\"), so you need "
				 "to tell the location of the utility. Give "
				 "an empty name to cancel the operation.\n")
			   (default "SYS:Utilities/")
			   ))
			)
		   (if (= 1 (exists multiview-path))
		       (foreach 
			help-dir "#?.info"
			(tooltype
			 (dest
			  (tackon
			   help-dir 
			   (substr
			    @each-name 0 (- (strlen @each-name) 5))))
			    
			 (setdefaulttool multiview-path)))))
		)))
      ;; AmiTCP/IP program archive installed succesfully
      1)
    0))

(procedure
 ask-use-020-binaries
 (if cpu-is-020-or-better
     (if (askbool
	  (prompt "Your CPU is of type " cpu-type ", thus the '020 "
		  "version of AmiTCP (AmiTCP.020) should be renamed to "
		  "\"AmiTCP\" (The '000 binary will be kept as "
		  "\"AmiTCP.000\").\n\nShall this be done?\n")
	  (help "You have an option to determine which AmiTCP binary "
		"version should be used. The selection is left to you "
		"for you to be able to switch to either of the binaries "
		"if there happens to be problems with the other.")
	  )
	 ;; rename AmiTCP to AmiTCP.000 and AmiTCP.020 to AmiTCP
	 ((rename (tackon atcp-assign "AmiTCP")
		  (tackon atcp-assign "AmiTCP.000"))
	  (rename (tackon atcp-assign "AmiTCP.020")
		  (tackon atcp-assign "AmiTCP"))
	  )
       )
   ;; Delete the '020 binaries, if not '020 or higher
   (if (askbool
	(choices "Delete" "Do not delete")
	(prompt "Your CPU is of type " cpu-type ", thus the '020 "
		"version of AmiTCP could be deleted from your disk. "
		"If you later upgrade your CPU, you should "
		"re-install " @app-name ".\n")
	(help "The '020 binary can be deleted to save your disk space."))
       (delete (tackon atcp-assign "AmiTCP.020")
	       (optional "force")))
   ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 update-devices
 (transcript "Updating Sana-II device drivers.")
 ;;
 ;; Create directory DEVS:Networks if it does not exist already
 ;;
 (if (NOT (= 2 (exists "DEVS:Networks")))
     (makedir "DEVS:Networks"))
 ;;
 ;; Copy each driver in the distribution to the DEVS:Networks if necessary
 ;;
 (working "Checking Sana-II device drivers...")
 (if (= 2 (exists dist-networks-dir))
     (foreach
       dist-networks-dir "#?.device"
       ((set dist-name (tackon dist-networks-dir @each-name)
	     devs-name (tackon "DEVS:Networks" @each-name)
	     dist-version (getversion dist-name)
	     copy-it (NOT (exists devs-name)))
	;;
	;; Check if the driver should be copied over
	;;
	(if (NOT copy-it)
	    (set copy-it
	             ; or if the driver in DEVS:Networks is of older version
		 (< (set devs-version (getversion devs-name)) dist-version)))
	(if (NOT copy-it)
	    (set copy-it
		     ; or if the files are of the same version but different
		 (set sum-differs (if (= dist-version devs-version)
				      (<> (getsum dist-name)
					  (getsum devs-name))
				    0))))
	(if copy-it
	    (copyfiles
	     (prompt "Should this Sana-II driver be installed in Devs:Networks?\n"
		     (if devs-version
			 (cat "A driver with the same name exists already"
			      (if sum-differs
				  (cat ", it has the same version, but the "
				       "files are not the same.")
				(cat ", but the driver in the "
				     "DEVS:Networks is of older version.")))
		       ""))
	     (help
	      "    The Sana-II drivers should be located in "
	      "the DEVS:Networks directory.\n"
	      "    This directory is the official location for the Sana-II "
	      "device drivers.")
	     (source (pathonly dist-name))
	     (choices (fileonly dist-name))
	     (dest "DEVS:Networks")
	     (files)
	     (optional "nofail" "askuser")
	     (confirm "average")))))
   (message "No Sana-II drivers found on the installation disk")
   )
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ask-update-devices
 (if (= 2 (exists dist-networks-dir))
     (if (askbool
	  (prompt "\nDo you want to update your Sana-II network device "
		  "drivers?\n"
		  "Each copy will be confirmed.")
	      (help
	       "    Each new AmiTCP/IP distribution usually contains "
	       "updated versions of some of the provided Sana-II network "
	       "device drivers. If you choose \"Yes\", this installation "
	       "script will check for each device, if this is the case."))
	     (update-devices)
       (transcript "User did not want to update Sana-II drivers."))
   (transcript "Directory " dist-networks-dir " not found.")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; arguments:
;;
;; uus::commands - commands to add
;; uus::section  - section name
;; uus::file     - file name into which to save the changes if needed
;;
(procedure
 update-user-startup
 (set uus::complete (cat ";BEGIN " uus::section "\n"
			 uus::commands
			 ";END " uus::section "\n"))
 (if (askbool
      (prompt "\nDo you want Installer to make the required changes to "
	      "your S:User-Startup script?\n"
	      "\n(There is a problem with Installer making these "
	      "changes if you do not have the original boot volume "
	      "mounted. Installer may crash or corrupt your system "
	      "in that case.)")
      (help "If you do not want Installer make the changes, it will "
	    "create a script file containing commands which you should "
	    "add to the S:User-Startup file."))
     ;; Do the addition
     ((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.")))
   ;; Let user add commands
   ((textfile (dest uus::file)
	      (append uus::complete))
    (message "Installer created file " uus::file
	     ", which you should add to your startup file by hand. "
	     "The file includes following changes:\n\n"
	     uus::complete))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ask-copy-old-configuration
 ;;
 ;; Copy old configuration files
 ;; Returns TRUE if AmiTCP does not need to be configured.
 ;; The reconfiguration is forced if old AmiTCP version is not 4 or higher,
 ;; since the bin/startnet must be modified.
 ;;
 (set
  edit-change-fingerd "t:edit-change-fingerd"
  old-conf-dir (tackon old-atcp-directory "db")
  old-resolv.conf (tackon old-conf-dir "resolv.conf")
  old-startnet (tackon old-atcp-directory "bin/startnet")
  old-motd (tackon old-conf-dir "motd"))
 ;;
 ;; return version of the old AmiTCP detected
 ;;
 (procedure 
  get-old-atcp-version
  (if (exists (tackon old-atcp-directory "AmiTCP") (noreq))
      (/ (getversion (tackon old-atcp-directory "AmiTCP")) 65536)
    0))
 ;;
 (set old-atcp-version (get-old-atcp-version))
 ;;
 ;; following is called only if old version is high enough
 ;;
 (procedure 
  copy-old-startnet 
  (if (exists old-startnet)
      (message "Your old \"startnet\" file cannot be used by the new "
	       @app-name " because the structure of it "
	       "has changed.  This means that you will need "
	       "to provide most of the configuration information after the "
	       "installation.")
;      ((if (>= @user-level 2)
;	   (message "\nCopying file\n\n"
;		    old-startnet "   \n"
;		    "\nto directory \"" @default-dest "\"."))
;       (copyfiles
;	(source old-startnet)
;	(dest bin-dir)
;	(files))
;       1				; succeeded
;       )
    )
  0) ; need to configure
 ;;
 (procedure 
  copy-rest-config
  (copyfiles
   (prompt
    "Select configuration files you want to copy from old configuration")
   (help
    "    You may copy your old configuration files or use untouched files "
    "came with the new distribution.")
   (source old-conf-dir) 
   (dest conf-dir)
   (files)
   (confirm)
   (if (AND (exists (tackon old-conf-dir "networks"))
	    (AND (exists (tackon old-conf-dir "ftpdir"))
		 (exists (tackon old-conf-dir "ftpusers"))))
       (choices				; release 4.0 or later
	"AmiTCP.config"
	"ch_nfstab"
	"ftpdir"
	"ftpusers"
	"group"
	"inet.access"
	"inetd.conf"
;	"interfaces"
	"hosts"
	"networks"
	"resolv.conf"
	"services"
	"protocols"
	"passwd"
	"rpc")
     (if (exists (tackon old-conf-dir "inet.access"))
	 (choices			; release 3.0 beta 2 or later
	  "AmiTCP.config"
	  "ch_nfstab"
	  "group"
	  "inet.access"
	  "inetd.conf"
	  "hosts"
	  "services"
	  "protocols"
	  "passwd"
	  "rpc")
       (if (exists (tackon old-conf-dir "interfaces"))
	   (choices			; release 3.0 beta 1 or later
	    "AmiTCP.config"
	    "group"
	    "inetd.conf"
	    "hosts"
	    "services"
	    "protocols"
	    "passwd"
	    "rpc")
	 (if (exists (tackon old-conf-dir "passwd"))
	     (choices			; release 2.2 or later
	      "AmiTCP.config"
	      "group"
	      "inetd.conf"
	      "hosts"
	      "services"
	      "protocols"
	      "passwd")
	   (choices			; an old release
	    "AmiTCP.config"
	    "inetd.conf"
	    "hosts"
	    "services"
	    "protocols")))))
   (optional "nofail" "force" "askuser")))
 ;;
 (procedure 
  copy-motd
  (if (exists old-motd)
      ((if (>= @user-level 2)
	   (message "\nCopying file\n\n"
		    old-motd "\n"
		    "(Message Of The Day)\n"
		    "\nto directory \"" conf-dir "\"."))
       (copyfiles
	(source old-motd)
	(dest conf-dir)
	(files)))))
 ;;
 ;; Following is currently not needed, since if old version is too old, we
 ;; force user to reconfigure AmiTCP anyway
 ;;
 (procedure 
  update-startnet
  (set startnet-file (tackon bin-dir "startnet"))
  (if (run (cat "search search \"Mount TCP:\" quiet from " startnet-file)
	   (safe))
      ((textfile (dest startnet-file)
		 (include startnet-file)
		(append tcp-mount "\n")
		(prompt 
		 "\nDo you want to mount TCP: device at network startup?")
		(help 
		 "    The " @app-name " includes a DOS handler for TCP "
		 "communications. This DOS handler will usually be mounted "
		 "at the network startup.")
		(confirm))
       (protect (tackon bin-dir "startnet") "+s +e"))))
 (procedure
  update-services
  (set service-file (tackon conf-dir "services"))
  (if (run (cat "search search \"amiganetfs\" quiet from " service-file)
	   (safe))
      (;; Not found, add it 
       (textfile (dest service-file)
		 (include service-file)
		 (append ";\n; Amiga specific services\n;\n"
			 "amiganetfs      2500/tcp\n")
		 (prompt 
		  "Do you want to add AmigaNetFS service to your "
		  "service database?")
		 (help 
		  "    The " @app-name " includes NetFS, network file system "
		  "between Amigas, by Timo Rossi. It is a TCP based protocol "
		  "which requires both ends of connection have same service "
		  "(TCP port) entries. If you already had NetFS installed "
		  "you probably do not want to update your service "
		  "database.")
		 (confirm)))))
 (procedure
  update-hosts
  (set hosts-file (tackon conf-dir "hosts"))
  (if (run (cat "search search \"localhost\" quiet from " hosts-file)
	   (safe))
      (;; Not found, add it
       (transcript "Adding 'localhost' entry to the db/hosts.")
       (textfile (dest hosts-file)
		 (include hosts-file)
		 (append ";\n; Entry for the localhost\n;\n"
			 "127.0.0.1 localhost\n")
		 ))))
 (procedure
  update-inetd-conf
  ;; Change fingerd to serv/in.fingerd
  (set inetd-conf (tackon atcp-assign "db/inetd.conf"))
  (if (run (cat "search search \"serv/in.fingerd\" quiet from " inetd-conf)
	   (safe))
      ((textfile 
	(dest edit-change-fingerd)
	(append
	 "f b/finger    stream/\n"
	 "e -amitcp:bin/fingerd-amitcp:serv/in.fingerd-\n"
	 "m+"
	 "i"
	 "# NetFS, a networking support between Amigas"
	 "# Remove # from the next line to enable NetFS"
	 "#amiganetfs stream    tcp nowait root amitcp:serv/netfs-server"
	 "Z"
	 "w\n")
	(safe))
       (run (cat "c:edit from " inetd-conf " with "
		 edit-change-fingerd " >t:what-changed")
	    (confirm)
	    (prompt "\nUpdate \"inetd.conf\" to use the " @app-name " services?")
	    (help "    The fingerd service daemon is moved to directory "
		  "\"AmiTCP:serv\", and \"inetd.conf\" must be updated to use "
		  "it. Also the NetFS must be added to old configuration")))))
 ;;
 (procedure 
  update-napsaprefs
  (set old-napsaprefs
       (if (exists (tackon old-atcp-directory "db/NapsaPrefs") (noreq))
	   (tackon old-atcp-directory "db/NapsaPrefs")
	 (if (exists "s:NapsaPrefs")
	     "s:NapsaPrefs")
	 ""))
  (if old-napsaprefs
      (;;
       (copyfiles 
	(source old-napsaprefs)
	(dest conf-dir)
	(files)
	(confirm)
	(prompt "\nUse your old Napsaterm preferences?")
	(help  "    Installer have found an existing NapsaPrefs file "
	       old-napsaprefs ". You can copy it to new configuration "
	       "directory.")))))
 (procedure 
  copy-extra-binaries
  "")
 (transcript "Ready to copy old configuration.")
 (if (askbool
      (default 1)
      (prompt
       "\nDo you want to use settings from an earlier installation?")
      (help
       "    Installer have detected existing configuration "
       "directory \"" old-conf-dir "\" which "
       "can be used to configure the " app-name ". You can keep most "
       "of your previous configuration. This is important if you have "
       "installed extra applications.\n"
       (if (< old-atcp-version 4)
	   (cat "    However, since the configuration practice of the "
		@app-name " has changed since your old version, you must "
		"reconfigure the " @app-name " itself. Sorry for the "
		"incovenience.\n")
	 (cat "    Installer will copy your \"" old-startnet "\" script and "
	      "\"" old-resolv.conf "\" configuration.\n"))
       "    Other configuration files will be then "
       (if (> @user-level 1) 
	   "optionally")
       " copied.\n"))
     ((set no-reconfig (if (>= old-atcp-version 4)
			   (copy-old-startnet)))
      (copy-rest-config)
      (copy-motd)
      (update-inetd-conf)
      (update-hosts)
      (update-services)
;;      (update-startnet)
      (update-napsaprefs)
      (copy-extra-binaries)
      no-reconfig) ;; FALSE if AmiTCP needs to be reconfigured
   0))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 install-emacstcp
 ;; is GNU Emacs installed?
 (if (exists "GNUEmacs:" (noreq)) ; check if GNUEmacs is installed

     ((set 
       unpkt-source GNUEmacs-pkt-file
       unpkt-destination "GNUEmacs:"
       unpkt-sdp 1
       unpkt-title-name "GNU Emacs support"
       unpkt-title-not "GNU Emacs support"
       )
      (if (run-unpkt)
	  ;; Tell user what to do with .emacs
	  (run (cat "run " pager-cmd)
	       GNUEmacs-readme-file
	       (safe))
	)
      )
   (message "GNU Emacs must be installed before....")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 install-napsaterm
 ;;
 ;; Install Napsaterm fonts
 ;;
 ;; Ask for directory to install fonts.
 (procedure
  ask-napsa-font-dir
  (askdir
   (prompt "Select directory where to install Napsaterm fonts.\n")
   (help "    Here you can specify location where to install "
	 "the Napsaterm font called `napsa'. "
	 "This directory should be in your font path "
	 "(i.e. some directory in the assign fonts:).")
   (newpath)
   (default "fonts:")))

 (set 
  unpkt-source NapsaFonts-pkt-file
  unpkt-destination (ask-napsa-font-dir)
  unpkt-sdp 1
  unpkt-title-name "NapsaTerm fonts"
  unpkt-title-not "NapsaTerm special fonts"
  )
 (run-unpkt)
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ;;
 ;; Check if user exists in the user database
 ;;
 ;; takes the user name in ::user-name
 ;;
 does-user-exist
 (if (run (cat "search " (tackon conf-dir "passwd") " \"" ::user-name "|\" NONUM ")
	  (safe))
     0
   1)
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure 
 ;;
 ;; Add a new user into AmiTCP:db/passwd
 ;;
 add-new-user
 (if (= anu::setdefaults 0)
     (set   
      anu::passwd (tackon conf-dir "passwd")
      anu::passwd-new (cat anu::passwd ".new")
      anu::passwd-old (cat anu::passwd ".old")
      anu::tempfile "t:run-the-password"
      anu::helptext (cat "    You must give an login name, user ID, group ID "
			 "real name and home directory for each user.\n")
      anu::setdefaults 1
      anu::username (cat default-user-name)
      anu::UID 100
      anu::GID 100
      anu::realname ""
      anu::homedir "HOME:"
      anu::shell "shell"))
 (while
     ((set anu::username
	   (askstring
	    (default anu::username)
	    (prompt "Enter the login name of the new user:\n")
	    (help anu::helptext
		  "    The login name consists of lowercase letters a-z "
		  "and numbers.  Its recommended maximum length is 8 "
		  "characters.\n"
		  "    Examples of acceptable login names are `ppessi' "
		  "and `an345'.")))
      (set ::user-name anu::username)
      (if (does-user-exist)
	  ((message "User " anu::username " already exists.")
	   1))))
 (set anu::UID
      (asknumber
       (default anu::UID)
       (prompt (cat "Enter the user ID of the user " anu::username ":\n"))
       (help anu::helptext
	     "    The user ID is a numeric unique identifier for each "
	     "user. "
	     "It is a number between 100 - 32767 for ordinary users.\n")))
 (set anu::GID
      (asknumber
       (default anu::GID)
       (prompt (cat "Enter the primary group ID of the user " 
		    anu::username ":\n"))
       (help anu::helptext
	     "    The group ID is a numeric identifier of groups. "
	     "Each user has a primary group, which is usually 100, "
	     "group \"users\".\n")))
 (set anu::realname
      (askstring
       (default anu::realname)
       (prompt (cat "Enter the real name of the user " anu::username ":\n"))
       (help anu::helptext
	     "    The real name can contain any characters except "
	     "comma (`,'), colon (`:') or bar (`|').")))
 (set anu::homedir
      (askdir
       (default anu::homedir)
       (prompt (cat "Give the home directory of the user " anu::username ":\n"))
       (help anu::helptext
	     "    When user logs in, the current directory is changed to"
	     "her home directory.  Also, the finger information (.plan"
	     "and .project) is retrieved from home directory.")
       (newpath)))
 (set anu::shell
      (askstring
       (default anu::shell)
       (prompt (cat "Enter the name of command interpreter for the user "
		    anu::username ":\n"))
       (help anu::helptext
	     "    The command interpreter value can be either "
	     "`shell' or `cli'.")))
 (set anu::passwd-entry 
      (cat anu::username "||" anu::UID "|" anu::GID "|" 
	   anu::realname "|" anu::homedir "|" anu::shell "\n"))
 (if (askbool 
      (prompt (cat "Are you sure you want to add following user:\n\n"
		   "Login name: " anu::username "\n"
		   "User ID: " anu::UID "\n"
		   "Group ID: " anu::GID "\n"
		   "Real name: " anu::realname "\n"
		   "Home directory: " anu::homedir "\n"
		   "Shell: " anu::shell "\n"))
      (choices (cat "Add " anu::username) (cat "Skip " anu::username))
      (help "You can still skip creating the new user."))
     ((textfile (dest anu::passwd-new)
		(include anu::passwd)
		(append anu::passwd-entry))
      (copyfiles (source anu::passwd)
		 (dest conf-dir)
		 (newname "passwd.old")
		 (optional "askuser"))
      (copyfiles (source anu::passwd-new)
		 (dest conf-dir)
		 (newname "passwd")
		 (optional "askuser"))
      (textfile (dest anu::tempfile)
		(append (cat 
			 "failat 5000\n"
			 "avail flush >nil:\n"
			 (tackon bin-dir "login") " " anu::username "\n"
			 (tackon bin-dir "passwd") " " anu::username "\n"
			 "endshell\n"))
		(safe))
      (run (cat "newshell from " anu::tempfile))
      (set anu::username ""
	   anu::UID (+ anu::UID 1)
	   anu::realname "")
      1))
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ;;
 ;; Add a new users into AmiTCP:db/passwd
 ;;
 add-new-users
 (while
     (askbool (prompt "\nDo you want to create a new user account?\n"
		      "\nYou will be logged in with the new account "
		      "immediately to set the password.")
	      (choices "Proceed" "Cancel")
	      (help "    You are about to add a new users into user database. "
		    "Remember that the user id of each user must be unique! "
		    "You will be logged in with the new user account to "
		    "set the password for the new user.\n"))
   (add-new-user))
 )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure 
 ;;
 ;; Ask for the default user
 ;;
 ask-default-user
 (if (= adu::setdefaults 0)
     (set   
      adu::setdefaults 1
      default-user-name ""))
 (while (= default-user-name "")
   (while
       ((set default-user-name
	     (askstring
	      (default default-user-name)
	      (prompt "Enter the default user name\n")
	      (help "    The AmiTCP/IP can handle currently only one user "
		    "at a time.  The default user is selected with `login' "
		    "command by system startup script. ")))
	(set ::user-name default-user-name)
	(if (NOT (does-user-exist))
	  (NOT (add-new-user))))))
 )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 ;;
 ;; Install passwd and group databases
 ;;
 install-user-databases
 (transcript "Installing user databases")
 (procedure get-mufs-version
	    (set mufs-vernum (getversion "multiuser.library" (resident)))
	    (set mufs-ver (/ mufs-vernum 65536))
	    (set mufs-rev (- mufs-vernum (* ver 65536))))
 (procedure passwd-create
	    (copyfiles
	     (prompt "Copying " passwd-source " to AmiTCP:db/passwd.")
	     (source passwd-source)
	     (dest conf-dir)
	     (newname "passwd")
	     (optional "nofail")))
 (procedure group-create
	    (copyfiles
	     (prompt "Copying " group-source " to AmiTCP:db/group.")
	     (source group-source)
	     (dest conf-dir)
	     (newname "group")
	     (optional "nofail")))
       
 (set passwd-source (tackon conf-dir "passwd-example"))
 (set group-source (tackon conf-dir "group-example"))
 (if (>= @user-level 2)
     (message 
      "\n"
      "Copying user database from file"
      "\n\n\"" passwd-source "\"\n\n"
      "and group database from file"
      "\n\n\"" group-source "\"\n\n"))
 (passwd-create)
 (group-create)
 )

(procedure 
 set-must-reboot
 (if (<> (getversion "netinfo.device" (resident)) 0)
     ((set netinfo-temp-file "t:netinfo-expunge-script")
      (textfile (dest netinfo-temp-file)
		(append (cat 
			 "failat 5000\n"
			 "avail flush >nil:\n"
			 "avail flush >nil:\n"))
		(safe))
      (execute netinfo-temp-file)))
 (if (<> (getversion "netinfo.device" (resident)) 0)
     ((set must-reboot-after-install 1)
      (message "You seem to have some parts of an old " @app-name 
	       " installation running.  Because of this the user "
	       "database updating will have no effect before you reboot "
	       "your Amiga.\n\n"
	       "For this reason you _must_ reboot after the installation "
	       "and before the \"Config_AmiTCP\" is run."))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Ask which parts to install
;;;
;;; on return following variables will have boolean values:
;;;
;;;  do-install-amitcp
;;;  do-install-drivers
;;;  do-install-emacstcp
;;;  do-install-napsafonts
;;;
(procedure
 ask-install-options
 (set 
  install-options-bitmap
  (askoptions
   (prompt "Select parts to install:\n\n"
	   "See the help for explanation on each item.")
   (choices "AmiTCP/IP"
	    "Updated Sana-II network drivers"
	    "GNU Emacs support"
	    "NapsaTerm fonts"
	    "AmiTCP/IP Software Development Kit"
	    )
   (default (if (exists "GNUEmacs:" (noreq))
		%00111
	      %00011))
   (help "    AmiTCP/IP: "
	 "The AmiTCP/IP itself. This includes binaries, help files and "
	 "example configuration files.\n"
	 "    Updated Sana-II network drivers: "
	 "If this option is checked, the Sana-II drivers in Devs:Networks "
	 "will be updated. You will be asked for confirmation for each driver.\n"
	 "    GNU Emacs support: "
	 "AmiTCP/IP provides an Emacs extension, which makes "
	 "it possible to run networking programs with it. To enable "
	 "this feature some files need to be installed "
	 "in to directories under \"GNUEmacs:\". "
	 "NOTE: This option has effect only if GNU Emacs is currently installed.\n"
	 "    NapsaTerm fonts: "
	 "NapsaTerm has special fonts, that are sized 6×11 pixels and contain "
	 "some special VT102 characters. They are suitable for interlaced "
	 "screens. If you have normal NTSC or PAL screen, it might be better "
	 "to not install these fonts but use Topaz/8 instead.\n"
	 "    AmiTCP/IP Software Development Kit (SDK): "
	 "AmiTCP/IP programmer's include files and libraries. This is offered "
	 "as a free bonus in this release. The SDK currently supports only "
	 "SAS/C, but many if it's files can be used with other compilers as "
	 "well.\n"
	 ))
  do-install-amitcp (in install-options-bitmap 0)
  do-install-drivers (in install-options-bitmap 1)
  do-install-emacstcp (in install-options-bitmap 2)
  do-install-napsafonts (in install-options-bitmap 3)
  do-install-sdk (in install-options-bitmap 4)
  ))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Install AmiTCP/IP
;;;
(procedure 
 install-amitcp
 (select-destination-directory)
 (if (copy-files-to-destination) ; copy AmiTCP/IP files
     (
      ;; update user-startup
      (set uus::commands (cat "assign " atcp-assign " " @default-dest "\n"
			      "path " bin-dir " add\n"
			      apipe-mount)
	   uus::section @app-name
	   uus::file (tackon atcp-assign "addition-to-user-startup"))
      (update-user-startup))
   ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(procedure
 install-sdk
 (set sdk-dest-dir
      (askdir
       (prompt "Select the directory in which the SDK should be placed:")
       (help "    The SDK subdirectories will be placed on the directory you "
	     "select.\n")	     
       (newpath)
       (default @default-dest)))
 (if (NOT (= 2 (exists (sdk-dest-dir))))
     (makedir sdk-dest-dir (infos)))
 
 ((set 
   unpkt-source SDK-pkt-file
   unpkt-destination sdk-dest-dir
   unpkt-sdp 1
   unpkt-title-name "Software Development Kit"
   unpkt-title-not "The SDK"
   )
  (if (run-unpkt)
      (
       ;; add assigns to user-startup
       (set uus::commands
	    (cat "assign netinclude: " (tackon sdk-dest-dir "netinclude") "\n"
		 "assign netlib: " (tackon sdk-dest-dir "netlib") "\n"
		 (if (<> (expandpath atcp-assign)
			 (expandpath sdk-dest-dir))
		     (cat "path " (tackon sdk-dest-dir "bin") " add\n")
		   ""))
	    uus::section (cat @app-name " SDK")
	    uus::file (tackon atcp-assign "addition-to-user-startup-SDK"))
       (update-user-startup)
       ;; Show the SDK readme file
       (run (cat "run " pager-cmd) SDK-readme-file (safe)))
    )))

;;; copy "UnPkt" to RAM: if available
;;
;; If UnPkt is not found, then we are not started from the installation disk
;;
;;;
(procedure
 set-unpkt-cmd
 (set unpkt-cmd
      (if (exists UnPkt-file)
	  ((copyfiles
	    (prompt "Copying packet dearchiver to RAM:")
	    (source UnPkt-file)
	    (dest   "RAM:")
	    (safe)
	    (optional "nofail"))
	   "RAM:UnPkt")
	"")))

;;;;;
;
; Launch Config_AmiTCP
;
(procedure
  run-config-amitcp
  (set start-config-script "t:start-config-script")
  (textfile 
   (dest start-config-script)
   (append
    ".key foo\n.bra {\n.ket }\n\n"
    "cd " atcp-assign "\n"
    "Stack 20000 ; Installer needs this\n"
    (tackon bin-dir "Installer")
    " SCRIPT Config_AmiTCP APPNAME AmiTCP/IP MINUSER AVERAGE\n"
    )
   (safe))
  (protect start-config-script "+s +e")
  (if (askbool
       (prompt "\nStart \"Config_AmiTCP\" to configure the just "
	       "installed " @app-name "?")
       (help @app-name " should be configured after the installation. "
	     "If you do not want to do the configuration now, you must "
	     "do it later by starting the \"Config_AmiTCP\" from the "
	     "WorkBench icon.\n"))
      (execute start-config-script)))

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

;
; Initialize "global" variables to default values (not complete)
;
(set
 startup-changed 0
 must-reboot-after-install 0
 )

(complete 00) (transcript "On making " app-name ".")
(complete 01) (check-user-level)
(complete 02) (check-system-version)
(complete 03) (check-available-memory)
(complete 04) (check-old-assign)
(complete 05) (check-cpu-type)

; askdisk for the install-disk1-name?? maybe later...

; show the README-FIRST file if it exists
(if (exists README-FIRST-file)
    ((run (cat "run " pager-cmd) README-FIRST-file (safe))
     (message "    Please read the shown \"README.FIRST\" file carefully "
	      "before continuing the installation.")))

;
; Check if started from the installation disk
;
;(if (= (expandpath source-dir) install-disk1-name)
;    (
     (set-unpkt-cmd)
     (if (= unpkt-cmd "")
	 (abort "    UnPkt command not present on the installation disk!"))

     (complete 08) (ask-accept-license)	     ; ask if user accepts the license
     (complete 10) (ask-install-options)
     (complete 15) (if do-install-amitcp (install-amitcp))
     (complete 30) (if do-install-sdk (install-sdk))
     (complete 25) (if do-install-emacstcp (install-emacstcp))
     (complete 30) (if do-install-napsafonts (install-napsaterm))
     (complete 35) (if do-install-drivers (update-devices))
     (if do-install-amitcp	; Ask if old configuration should be copied
	 (
	  (set-must-reboot)
	  (set old-conf-used 
	       (if old-atcp-directory
		   (if (exists (tackon old-atcp-directory "bin/startnet") 
			       (noreq))
		       ((complete 40)
			(ask-copy-old-configuration)))))
	  ;;
	  ;; Install user databases if not copied from an old configuration
	  ;;
	  (if (exists (tackon conf-dir "passwd"))
	      (transcript "There is already a user database.")
	    ((complete 70)
	     (install-user-databases))) ; install passwd/group
	  ;;
	  ;; Configure AmiTCP/IP is necessary
	  ;;
	  (complete 90)
	  (if (AND (NOT must-reboot-after-install) (NOT old-conf-used))
	      ;;
	      ;; Spawn the installer on the Config_AmiTCP with 
	      ;; correct options
	      (run-config-amitcp)
	      ;(configure-amitcp)
	    )
	  ))
     ;; show something
     (foreach atcp-assign "#?.readme"
	      (run (cat "run " pager-cmd) (tackon atcp-assign @each-name)
		   (safe)))
;     )
;  (	;; Not started from the installation directory
;   ;; Started from an unknown directory
;   (abort "    The installation was started from an invalid directory.\n"
;	  "    If you want to re-install some parts of the " @app-name
;	  " installation, "
;	  "please start the \"Install_AmiTCP\" from the installation disk.")
;   )
;  )

;;; All done!
(complete 100)
(exit (if startup-changed 
	  (cat "You should reboot your Amiga to enable the changes made "
	       "to system startup files.")
	(cat "You must add the contents of the file(s) \"" 
	     "addition-to-user-startup#?\" to your S:User-Startup and "
	     "reboot before you can use " @app-name ".\n"))
      (if must-reboot-after-install
	  (cat "\nYou MUST reboot before configuring " @app-name ". Start "
	       "\"Config_AmiTCP\" from WorkBench after the reboot "
	       "to configure your new " @app-name " installation.\n")))

; EOF
