; ParNFS Installation :vi:nosi:noai
; $VER: $Id: Install-ParNFS,v 1.3 1993/12/02 22:53:24 Rhialto Exp $

(set @app-name "ParNFS")
(welcome @app-name " Installation")

(if (exists "ParNFS_Stuff:" (noreq))
    (set @default-dest (expandpath "ParNFS_Stuff:/"))
    (set @default-dest "Work:")
)

(set @default-dest
    (askdir
	(prompt "Where do you want to install " @app-name "?")
	(help @askdir-help)
	(default @default-dest)
    )
)

(set @default-dest (tackon @default-dest "ParNFS"))
(makedir @default-dest (infos))
(makeassign "ParNFS_Stuff" @default-dest)

(set AMIGANUM
    (+ 1 (askchoice
	(prompt "Install for which Amiga?")
	(choices "Amiga 1: the primary server"
		 "Amiga 2: the primary client")
	(default 2)             ; invalid ie no choice
	(help @askchoice-help)
    ))
)

(set Mountlist
    (select AMIGANUM "" "Mountlist.Quick.2nd" "Mountlist.Quick.1st")
)

(copyfiles
    (prompt "Copying client and server code")
    (source "")
    (dest @default-dest)
    (choices
	     "QuickSetup"
	     "parnet.device"
	     "NetworkFileServer"
	     "NetworkFileSystem"
	     Mountlist)
    (infos)
    (confirm)
    (help (cat "You always need \"QuickSetup\" and \"parnet.device\".\n"
	      "For a server, you need \"NetworkFileServer\".\n"
	      "For a client, you need the other files.\n\n"
	      @copyfiles-help))
)

;;;;
;
; Only ask experienced user to edit the QuickSetup script

(if (>= @user-level 2) (
    (set Editor "")
    (if (> 0 (exists "ENV:EDITOR")) (
	(set Editor (getenv "EDITOR"))
	(if (= 0 (exists Editor) (set Editor "")))
    ))
    (if (and (= Editor "") (exists "SYS:Tools/MEmacs"))
	(set Editor "SYS:Tools/MEmacs")
    )
    (if (and (= Editor "") (exists "C:Ed"))
	(set Editor "C:Ed")
    )

    (if (not (= Editor ""))
	(run (cat Editor " QuickSetup")
	    (prompt "Do you want to edit the QuickSetup script? "
		    "You may want to do this do automatically create "
		    "references to volumes on the server machine, "
		    "so you'll have some icons for the Workbench.")
	    (confirm)
	    (help @run-help)
	)
    )
))

(set bootopt
    (askoptions
	(prompt "Do you want to start ParNFS automatically every time "
		"your Amiga boots?")
	(choices "Client" "Server")
	(default 3)
	(help @askoptions-help)
    )
)

(set cmd2 "")
(if (in bootopt 0 1) (set cmd2 "run Execute ParNFS_Stuff:QuickSetup"))
(if (in bootopt 0)   (set cmd2 (cat cmd2 " client")))
(if (in bootopt 1)   (set cmd2 (cat cmd2 " server")))
(if (in bootopt 0 1) (set cmd2 (cat cmd2 " " AMIGANUM " Quiet\n")))

(set UserStartup (cat
    "Assign ParNFS_Stuff: \"" @default-dest "\"\n"
    cmd2
))

(startup @app-name
    (prompt (cat
	    "One Assign needs to be added to the \"S:user-startup\" "
	    "so that your system will be properly configured to use "
	    @app-name ".\n\n"
	    "The Network also needs to be started before use.\n\n"
	    "Remember to copy the \"Node.rinfo\" icon to all disks "
	    "that you want to be visible on a networked Workbench."
    ))
    (command UserStartup)
    (help @startup-help)
)
