;=============================================================================
; $VER: Install_Roadshow 1.25 (30.9.2023)
;=============================================================================

; Install Roadshow for real
(procedure P_Install
(
	(complete 0)

	; Ask if the '020 versions should be installed. This question will pop up
	; if the machine this script runs on has no MC68000/MC68010 CPU installed, or
	; the script runs in expert mode. In the latter case, the user gets to make
	; the decision.
	(set #special-version 0)

	; Is there an '020 version available in the first place?
	; The demo version does not ship with one...
	(if (= (exists "Workbench/Libs/020/bsdsocket.library" (noreq)) 1)
	(
		; Check if the local CPU can be used with the '020-optimized library.
		(set #local-cpu-type (database "cpu"))
		(set #local-cpu-ok (not (or (= #local-cpu-type "68000") (= #local-cpu-type "68010"))))

		; Note: The following only works on Installer versions 43 and up. Older
		; versions use the SAS/C built-in astcsma() function which cannot handle
		; the '|' switch.
		; (set #local-cpu-ok (not (patmatch "68000|68010" (database "cpu"))))

		(if (or #local-cpu-ok (= @user-level 2))
		(
			; Add a stern warning in case the choice is not obvious.
			(if #local-cpu-ok
			(
				(set #special-warning "")
			)
			(
				(set #special-warning (cat
					"\n\n"
					"NOTE: These special versions will not work on the Amiga you "
					"are currently trying to install the software on. Installation is "
					"therefore discouraged unless you really know what you are doing!"
				))
			))

			(set #special-version (askbool
				(prompt (cat
					"Would you like to install special versions of the Roadshow "
					"'bsdsocket.library' and the PPP/PPPoE drivers, optimized for your Amiga system?"
					#special-warning
				))
				(default #local-cpu-ok)
				(help (cat
					"Special versions of 'bsdsocket.library' and the PPP/PPPoE drivers are provided which were "
					"created for use on Amigas equipped with an MC68020 CPU "
					"or a more recent model. These versions can perform "
					"faster than the generic versions and are also a bit smaller.\n\n"
					"Note that these special versions will not work on Amigas with "
					"plain MC68000 or MC68010 CPUs installed."
				))
			))
		))
	))

	; Is the 'Documentation' drawer actually around? If you use a
	; stripped-down installation archive, to be copied to an 880K
	; floppy disk, you might want to omit the documentation
	; altogether.
	(if (= (exists "Documentation" (noreq)) 2)
	(
		; In "expert" mode, ask if the Roadshow documentation should
		; be installed. In "average" mode the documentation is always
		; installed without prompting.
		(set #install-documentation 1)

		(if (= @user-level 2)
		(
			(set #install-documentation (askbool
				(prompt (cat
					"Would you like to install the Roadshow documentation as "
					"well as the TCP/IP stack software?"
				))
				(default 1)
				(help (cat
					"You may choose to omit installing the Roadshow documentation if all "
					"you require is the TCP/IP stack software and its utilities. The "
					"documentation is always available from the installation archive or CD-ROM, "
					"so you are not missing out on anything."
				))
			))
		))
	)
	(
		; No documentation available for installation
		(set #install-documentation 0)
	))

	; Same thing as with the documentation: it is possible to omit the
	; PPP/PPPoE drivers from the installation disk, and if they are not
	; available for installation, then no such attempt should be made.
	(if (= (exists "Workbench/Devs/Networks" (noreq)) 2)
	(
		; In "expert" mode, ask if the PPP/PPPoE drivers should
		; be installed. In "average" mode the drivers are
		; always installed without prompting.
		(set #install-ppp 1)

		(if (= @user-level 2)
		(
			(set #install-ppp (askbool
				(prompt (cat
					"Would you like to install the PPP and PPPoE drivers as "
					"well as the TCP/IP stack software?"
				))
				(default 1)
				(help (cat
					"You may choose to omit installing the PPP and PPPoE drivers and their "
					"example configuration files if you do not need them.\n\n"
					"The PPP driver is useful for connecting your Amiga through a modem or ISDN adaptor. "
					"The PPPoE driver is used for connecting your Amiga through an ADSL modem.\n\n"
					"You may not need either driver if you only intend to connect your Amiga through an "
					"Ethernet card, for example.\n\n"
					"Note that if you omit the PPP/PPPoE drivers and find that you need them later, you "
					"will have to copy them manually to your system partition."
				))
			))
		))
	)
	(
		; No PPP/PPPoE drivers available for installation
		(set #install-ppp 0)
	))

	; If the documentation is to be installed, create a drawer
	; to store it in.
	(if #install-documentation
	(
		(set #dir-created 0)

		(while (not #dir-created)
		(
			; Ask for the installation directory
			(set #default-dest (askdir
				(prompt (cat
					"Please select where the documentation for Roadshow should be installed. "
					"A drawer 'Roadshow' will be created there."
				))
				(help @askdir-help)
				(default @default-dest)
			))

			(set #doc-dir-name (tackon #default-dest "Roadshow"))

			(set #makedir-success 0)

			(trap 4
				(set #makedir-success
					(makedir #doc-dir-name (infos)
				))
			)

			(if #makedir-success
			(
				(set @default-dest #doc-dir-name)
				(set #dir-created 1)
			)
			(
				(message (cat
					"The drawer '" #doc-dir-name "' could not be created. Please try "
					"again and select a new drawer."
				))
			))
		))
	))

	(complete 5)

	; Begin by copying the bsdsocket.library, which the uninstallation
	; skript keys off when deciding whether Roadshow may be installed
	; or not. Before the library is copied, make sure that we pick
	; the right type.
	(if (and #special-version (= (exists "Workbench/Libs/020/bsdsocket.library" (noreq)) 1))
	(
		(set #lib-path "Workbench/Libs/020/bsdsocket.library")
	)
	(
		(set #lib-path "Workbench/Libs/bsdsocket.library")
	))

	(complete 5)

	; Copy the documentation, if desired.
	(if #install-documentation
	(
		(copyfiles
			(source "Documentation")
			(dest @default-dest)
			(infos)
			(all)
		)
	)
	(
		; So the final report on where the software was installed
		; will not be entirely misleading.
		(set @default-dest "SYS:")
	))

	(complete 20)

	; Copy the shell commands
	(copyfiles
		(source "Workbench/C")
		(dest "C:")
		(files)
		(all)
	)

	; Oops, remove the shell commands relevant for the PPP/PPPoE
	; drivers again (that's easier than just copying the files
	; one at a time).
	(if (not #install-ppp)
	(
		(delete "C:ppp_connector")
		(delete "C:ppp_dialer")
		(delete "C:ppp_sample")
	))

	; Copy the Internet configuration files
	(makedir "DEVS:Internet" (infos))
	(copyfiles
		(source "Workbench/Devs/Internet")
		(dest "DEVS:Internet")
		(files)
		(infos)
		(all)
	)

	(complete 30)

	; Add an empty network interfaces drawer
	; in "DEVS:".
	(makedir "DEVS:NetInterfaces" (infos))

	; Make sure that the "SYS:Storage" drawer exists,
	; which may not be the case for Workbench 2.x.
	(makedir "SYS:Storage" (infos))

	; Make sure that the "SYS:Devs" drawer icon exists,
	; which may not be the case for Workbench 2.x. We
	; expect that the drawer "SYS:Devs" exists and
	; the "makedir" command will add a drawer icon
	; for it if there is no icon yet.
	(makedir "SYS:Devs" (infos))

	; Copy the network interface example files.
	(makedir "SYS:Storage/NetInterfaces" (infos))
	(copyfiles
		(source "Workbench/Storage/NetInterfaces")
		(dest "SYS:Storage/NetInterfaces")
		(files)
		(infos)
		(all)
	)

	; Remove the PPP/PPPoE configuration files, if necessary
	(if (not #install-ppp)
	(
		(delete "SYS:Storage/NetInterfaces/PPP")
		(delete "SYS:Storage/NetInterfaces/PPP.info")
		(delete "SYS:Storage/NetInterfaces/PPPoE")
		(delete "SYS:Storage/NetInterfaces/PPPoE.info")
	))

	(complete 40)

	; Copy the bsdsocket and usergroup libraries
	(copyfiles
		(source #lib-path)
		(dest "LIBS:")
	)
	(copyfiles
		(source "Workbench/Libs/usergroup.library")
		(dest "LIBS:")
	)

	; Copy the PPP/PPPoE drivers
	(if (and #install-ppp (= (exists "Workbench/Devs/Networks" (noreq)) 2))
	(
		(if (and #special-version (= (exists "Workbench/Devs/Networks/020" (noreq)) 2))
		(
			(set #dev-path "Workbench/Devs/Networks/020")
		)
		(
			(set #dev-path "Workbench/Devs/Networks")
		))
		(makedir "DEVS:Networks")
		(copyfiles
			(source (tackon #dev-path "ppp-serial.device"))
			(dest "DEVS:Networks")
		)
		(copyfiles
			(source (tackon #dev-path "ppp-ethernet.device"))
			(dest "DEVS:Networks")
		)
	))

	(complete 50)

	; Copy the locale catalog files, if possible
	(if (= 2 (exists "LOCALE:Catalogs" (noreq)))
	(
		(copyfiles
			(source "Workbench/Locale/Catalogs")
			(dest "LOCALE:Catalogs")
			(all)
		)
	))

	(complete 60)

	; Copy the firewall example configurations
	(copyfiles
		(source "Workbench/S/IPF")
		(dest "S:IPF")
		(all)
	)

	(complete 70)

	; Copy the firewall scripts
	(copyfiles
		(source "Workbench/S/Check-Firewall-Rules")
		(dest "S:")
	)
	(copyfiles
		(source "Workbench/S/Start-Firewall")
		(dest "S:")
	)
	(copyfiles
		(source "Workbench/S/Stop-Firewall")
		(dest "S:")
	)

	(complete 80)

	; Copy the PPP/PPPoE example configurations
	(if (and #install-ppp (= (exists "Workbench/S/PPP-Configurations" (noreq)) 2))
	(
		(copyfiles
			(source "Workbench/S/PPP-Configurations")
			(dest "S:PPP-Configurations")
			(all)
		)
	))

	; Copy the network startup script
	(copyfiles
		(source "Workbench/S/Network-Startup")
		(dest "S:")
	)

	(complete 90)

	; Fix a typo in the S:User-Startup script, which would cause the network
	; startup not to be invoked.
	(if (= (exists "Install-Extras/SearchReplace" (noreq)) 1)
	(
		(run	(cat
				"Install-Extras/SearchReplace from S:User-Startup inplace "
				"search \"If EXIST S:Network-Startup\" "
				"replace \"If EXISTS S:Network-Startup\""
			)
			(help (cat
				"If you previously gave the original demonstration version "
				"of Roadshow a test, your S:User-Startup file may contain a "
				"typo which has the effect of not making the network start "
				"properly. This problem can be fixed here, automatically."
			))
		)
	))

	; Modify the "S:User-Startup" script to invoke the network
	; startup script
	(startup "Roadshow"
		(command (cat
			"If EXISTS S:Network-Startup\n"
			"  Execute S:Network-Startup\n"
			"EndIf"
		))
		(prompt (cat
			"In order to start the network before the Workbench opens, a script "
			"must be run. Instructions to run this script should be added "
			"to your 'S:User-Startup' file."
			"\n\n"
			"If you skip this part, then you will need to execute the script "
			"file 'S:Network-Startup' manually each time you want to start the network."
		))
		(help @startup-help)
	)

	; Make sure that the information about the documentation makes sense:
	; don't say anything about the documentation unless it was actually
	; installed.
	(if #install-documentation
	(
		(set #documentation-notes (cat
			"Please see the documentation in '" (tackon @default-dest "installation.guide" ) "' for a quick "
			"introduction to configuring Roadshow. "
			"More detailed documentation on Roadshow can be found in the same drawer.\n\n"
		))
	)
	(
		(set #documentation-notes (cat
			"Please refer to the 'installation.guide' documentation for a quick introduction "
			"to configuring Roadshow.\n\n"
		))
	))

	(complete 100)

	(message (cat
		"Your Roadshow TCP/IP stack installation is complete.\n\n"
		"Note that no network interfaces are configured yet, which means that "
		"you cannot access the local network or the Internet yet.\n\n"
		#documentation-notes
		"Please reboot your Amiga to start Roadshow."
	))
))

;=============================================================================
; Start of installation script
;=============================================================================
(complete 0)

(if (< (/ @installer-version 65536) 43)
(
	(abort (cat
		"This installation script requires the Installer tool V43"
	))
))

(if (< (getversion) (* 37 65536))
	(abort (cat
		"Roadshow requires operating system "
		"version 2.04 or higher to work."
	))
)

(set @default-dest "SYS:")

; Could this be AmigaOS4? Then it doesn't need Roadshow 68k
; to be installed.
(if (>= (getversion) (* 50 65536))
(
	(if (not (askbool
		(prompt (cat
			"WARNING:\n\n"
			"Your Amiga appears to be running Amiga operating system version 4 or higher.\n\n"
			"This operating system already ships with the Roadshow TCP/IP stack installed, and "
			"attempting to install this version on top of it will damage your system configuration.\n\n"
			"Do you really want to proceed?"
		))
		(default 0)
		(help (cat
			"Your system appears to have the Roadshow TCP/IP stack preinstalled, and unless you are "
			"really, really sure of what you are doing, you should not attempt to overwrite or uninstall it.\n\n"
			"If in doubt, choose 'No' to stop this installation script."
		))
	))
	(
		(exit (quiet))
	))
))

;=============================================================================
; So what do we do now?
;=============================================================================

(welcome "Install the Roadshow TCP/IP stack")

; Is this the commercial installation archive? Then we'll check
; if the user has the demo version installed and ask if it should
; be replaced by the commercial versions of bsdsocket.library and
; the PPP network device drivers.
(set #demo-version-installed 0)
(set #commercial-version-installed 0)
(set #update-in-place 0)
(set #current-version-installed 0)
(set #unknown-version-installed 0)

; If it exists, examine the checksum of the bsdsocket.library
; currently installed.
(if (exists "LIBS:bsdsocket.library")
(
	(set _sum (getsum "LIBS:bsdsocket.library"))

	; Let'see what we can find.
	(set #unknown-version-installed 1)

	; Is this one of the "bsdsocket.library" demo versions?
	; This covers Roadshow version 1.9, 1.11, 1.12, 1.13, 1.14 and 1.15.
	(if (or (= _sum -1136820917) (= _sum 1660721257) (= _sum -344913617)
	        (= _sum 1262331423) (= _sum -1407601279) (= _sum -1470733713)
	        (= _sum -159986756))
	(
		(set #demo-version-installed 1)
		(set #unknown-version-installed 0)
	))

	; Is the current version 1.15 installed?
	(if (or (= _sum -1394732848) (= _sum -647674018))
	(
		(set #current-version-installed 1)
		(set #unknown-version-installed 0)
	))

	; Only the commercial version ships with the special 68020+ version...
	(if (= (exists "Workbench/Libs/020/bsdsocket.library" (noreq)) 1)
	(
		; Is this one of the "bsdsocket.library" commercial versions?
		; This covers Roadshow version 1.9, 1.11, 1.12, 1.13, 1.14 and 1.15
		; in the 68020+ variants.
		(if (or (= _sum -412569076) (= _sum -1869214175) (= _sum 1804496634)
		        (= _sum -1919813397) (= _sum 1732981776)  (= _sum -647674018))
		(
			(set #commercial-version-installed 1)
			(set #unknown-version-installed 0)
		))
	))

	; Is this one of the "bsdsocket.library" commercial versions?
	; This covers Roadshow version 1.9, 1.11, 1.12, 1.13, 1.14 and 1.15
	; in the 68000 variants.
	(if (or (= _sum 1547189808) (= _sum -1051931198) (= _sum 470267128)
	        (= _sum 1037210753) (= _sum 128897932) (= _sum -1394732848))
	(
		(set #commercial-version-installed 1)
		(set #unknown-version-installed 0)
	))
))

; Did we find a bsdsocket.library which cannot be identified as
; being suitable for updating an existing Roadshow installation?
(if #unknown-version-installed
(
	(message (cat
		"It seems that there are already parts of the Roadshow TCP/IP stack "
		"installed, perhaps from an aborted prior installation attempt."
		"\n\n"
		"This partial installation cannot be safely updated. You should "
		"uninstall it first, using the \"Uninstall_Roadshow\" script, "
		"then restart the installation."
	))
	
	(exit (quiet))
))

; Is there no apparent need to update anything?
(if #current-version-installed
(
	(complete 100)

	(message (cat
		"Your Roadshow TCP/IP stack installation appears to be the current version 1.15.\n\n"
		"There seems to be no need to change or update anything."
	))
	
	(exit (quiet))
))

; If the demo version is installed, ask the user if the libraries and network
; device drivers should replace the respective demo versions. This makes for
; a much shorter installation procedure than uninstalling the demo version
; first and then reinstalling the commercial version.
(if #demo-version-installed
(
	(if (askbool
		(prompt (cat
			"It appears that the Roadshow demo version is currently installed on your system. "
			"Would you like to upgrade it to the commercial version?\n\n"
			"This will replace the demo versions of the Roadshow libraries and network device drivers "
			"as well as the shell commands and catalog files."
		))
		(help @askbool-help)
	)
	(
		(set #update-in-place 1)
	))
))

(if #commercial-version-installed
(
	(if (askbool
		(prompt (cat
			"It appears that an older Roadshow version is currently installed on your system. "
			"Would you like to upgrade it to Roadshow 1.15?\n\n"
			"This will replace the Roadshow libraries and network device drivers "
			"and also update the shell commands and catalog files."
		))
		(help @askbool-help)
	)
	(
		(set #update-in-place 1)
	))
))

(if #update-in-place
(
	; Ask if the '020 version should be installed. This question will pop up
	; if the machine this script runs on has no MC68000/MC68010 CPU installed, or
	; the script runs in expert mode. In the latter case, the user gets to make
	; the decision.
	(set #special-version 0)

	; Check if the local CPU can be used with the '020-optimized library.
	(set #local-cpu-type (database "cpu"))
	(set #local-cpu-ok (not (or (= #local-cpu-type "68000") (= #local-cpu-type "68010"))))

	; Note: The following only works on Installer versions 43 and up. Older
	; versions use the SAS/C built-in astcsma() function which cannot handle
	; the '|' switch.
	; (set #local-cpu-ok (not (patmatch "68000|68010" (database "cpu"))))

	(if (or #local-cpu-ok (= @user-level 2))
	(
		; Add a stern warning in case the choice is not obvious.
		(if #local-cpu-ok
		(
			(set #special-warning "")
		)
		(
			(set #special-warning (cat
				"\n\n"
				"NOTE: These special versions will not work on the Amiga you "
				"are currently trying to install the software on. Installation is "
				"therefore discouraged unless you really know what you are doing!"
			))
		))

		(set #special-version (askbool
			(prompt (cat
				"Would you like to install special versions of the Roadshow "
				"'bsdsocket.library' and the PPP/PPPoE drivers, optimized for your Amiga system?"
				#special-warning
			))
			(default #local-cpu-ok)
			(help (cat
				"Special versions of 'bsdsocket.library' and the PPP/PPPoE drivers are provided which were "
				"created for use on Amigas equipped with an MC68020 CPU "
				"or a more recent model. These versions can perform "
				"faster than the generic versions and are also a bit smaller.\n\n"
				"Note that these special versions will not work on Amigas with "
				"plain MC68000 or MC68010 CPUs installed."
			))
		))
	))

	; Before the library is copied, make sure that we pick
	; the right type.
	(if (and #special-version (= (exists "Workbench/Libs/020/bsdsocket.library" (noreq)) 1))
	(
		(set #lib-path "Workbench/Libs/020/bsdsocket.library")
	)
	(
		(set #lib-path "Workbench/Libs/bsdsocket.library")
	))

	; Copy the bsdsocket.library
	(copyfiles
		(source #lib-path)
		(dest "LIBS:")
	)

	(complete 50)

	; Copy the PPP/PPPoE drivers, if older versions are installed.
	(if (= (exists "Workbench/Devs/Networks" (noreq)) 2)
	(
		(if (and #special-version (= (exists "Workbench/Devs/Networks/020" (noreq)) 2))
		(
			(set #dev-path "Workbench/Devs/Networks/020")
		)
		(
			(set #dev-path "Workbench/Devs/Networks")
		))

		(makedir "DEVS:Networks")

		(if (= (exists "DEVS:Networks/ppp-serial.device" (noreq)) 1)
		(
			(set _sum (getsum "DEVS:Networks/ppp-serial.device"))

			; Is this one of the "ppp-serial.device" demo versions?
			; This covers Roadshow version 1.9, 1.12 and 1.14.
			(if (or (= _sum 321699330) (= _sum -1703997465) (= _sum 577227033))
			(
				(copyfiles
					(source (tackon #dev-path "ppp-serial.device"))
					(dest "DEVS:Networks")
				)
			))
		))

		(complete 75)

		(if (= (exists "DEVS:Networks/ppp-ethernet.device" (noreq)) 1)
		(
			(set _sum (getsum "DEVS:Networks/ppp-ethernet.device"))

			; Is this one of the "ppp-ethernet.device" demo versions?
			; This covers Roadshow version 1.9, 1.12 and 1.14.
			(if (or (= _sum 1381469193) (= _sum -1268499719) (= _sum 1144848635))
			(
				(copyfiles
					(source (tackon #dev-path "ppp-ethernet.device"))
					(dest "DEVS:Networks")
				)
			))
		))
	))

	; Copy the locale catalog files, if possible. They may have been
	; updated in Roadshow 1.15.
	(if (= (exists "LOCALE:Catalogs" (noreq)) 2)
	(
		(if (= (exists "LOCALE:Catalogs/deutsch" (noreq)) 2)
		(
			(copylib
				(source "Workbench/Locale/catalogs/deutsch/bsdsocket.catalog")
				(dest "LOCALE:Catalogs/deutsch")
			)

			(copylib
				(source "Workbench/Locale/catalogs/deutsch/roadshow.catalog")
				(dest "LOCALE:Catalogs/deutsch")
			)
		))

		(complete 80)

		(if (= (exists "LOCALE:Catalogs/polski" (noreq)) 2)
		(
			(copylib
				(source "Workbench/Locale/catalogs/polski/bsdsocket.catalog")
				(dest "LOCALE:Catalogs/polski")
			)

			(copylib
				(source "Workbench/Locale/catalogs/polski/roadshow.catalog")
				(dest "LOCALE:Catalogs/polski")
			)
		))
	))

	; Copy the shell commands. We begin with the commands which are
	; new to Roadshow 1.15. These are either updated (which may involve
	; skipping the respective copy operation if they are already
	; installed) or copying them if they do not exist yet.
	(copylib
		(source "Workbench/C/CheckRoadshowConfig")
		(dest "C:")
	)

	(copylib
		(source "Workbench/C/ManageNetInterfaces")
		(dest "C:")
	)

	(complete 85)

	; Now for the commands updated in Roadshow 1.15. These will
	; be updated only if they are already installed.
	(if (= (exists "C:AddNetInterface" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/AddNetInterface")
			(dest "C:")
		)
	))

	(complete 86)

	(if (= (exists "C:arp" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/arp")
			(dest "C:")
		)
	))

	(if (= (exists "C:ConfigureNetInterface" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ConfigureNetInterface")
			(dest "C:")
		)
	))

	(if (= (exists "C:NetLogViewer" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/NetLogViewer")
			(dest "C:")
		)
	))

	(complete 87)

	(if (= (exists "C:ping" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ping")
			(dest "C:")
		)
	))

	(if (= (exists "C:rsh" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/rsh")
			(dest "C:")
		)
	))

	(if (= (exists "C:RoadshowControl" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/RoadshowControl")
			(dest "C:")
		)
	))

	(complete 88)

	(if (= (exists "C:SampleNetSpeed" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/SampleNetSpeed")
			(dest "C:")
		)
	))

	(if (= (exists "C:traceroute" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/traceroute")
			(dest "C:")
		)
	))

	(if (= (exists "C:ftp" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ftp")
			(dest "C:")
		)
	))

	(if (= (exists "C:tcpdump" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/tcpdump")
			(dest "C:")
		)
	))

	(if (= (exists "C:wget" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/wget")
			(dest "C:")
		)
	))

	(complete 91)

	(if (= (exists "C:ppp_connector" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ppp_connector")
			(dest "C:")
		)
	))

	(if (= (exists "C:ppp_dialer" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ppp_dialer")
			(dest "C:")
		)
	))

	(if (= (exists "C:ppp_sample" (noreq)) 1)
	(
		(copylib
			(source "Workbench/C/ppp_sample")
			(dest "C:")
		)
	))

	(complete 93)

	; Copy usergroup.library, too. It may have been updated in Roadshow 1.15.
	(copyfiles
		(source "Workbench/Libs/usergroup.library")
		(dest "LIBS:")
	)

	(complete 100)

	(message (cat
		"Your Roadshow TCP/IP stack installation has been updated.\n\n"
		"Please reboot your Amiga now."
	))

	(exit (quiet))
))

; Check if Roadshow is already installed. We key off the presence
; of bsdsocket.library in LIBS: because it is the first file which
; the installation script will put there.
(if (exists "LIBS:bsdsocket.library")
(
	(message (cat
		"The Roadshow TCP/IP stack already seems to be installed on your system, "
		"or at least a 'bsdsocket.library' can be found in the LIBS: "
		"directory.\n\n"
		"You may want to verify if there are still parts of Roadshow installed on "
		"your system if you are certain that you previously installed it, or aborted "
		"an installation in progress. In that case, you may want to uninstall "
		"Roadshow first and then try to reinstall it."
	))

	(exit (quiet))
))

(P_Install)
