$ ! ========================================================================
$ ! This procedure will uncompress the fnews saveset, copy it to
$ ! a destination directory, 
$ ! 
$ ! Your should have the following in the current directory.
$ ! 	fnews.bck_z
$ ! 	zcompress.exe
$ ! 	extract.com 	(this file)
$ ! 
$ ! To install a new version simply don't run INSTALL.COM
$ ! after extracting the new version. 
$ ! 
$ ! ========================================================================
$	gosub find_root
$ 	gosub gethere
$
$ 	compress :== $'here'zcompress -v
$ 	uncompress :== $'here'zcompress -dv
$ 	uncompress_saveset :== $'here'zcompress -dvs
$ 
$ 	set noon
$ 	set proc/priv=all
$ 	set on
$
$ 	Write sys$output "Where would you like to install FNEWS (~15,000 Blocks may be used)"
$ 	Write sys$output "Probably some non system disk would be best"
$ 	inquire dest "<''rootdev'[FNEWS]>"
$ 	if dest.eqs."" then dest = "''rootdev'[FNEWS]"
$	define fnews_top 'dest'
$	destsrc = dest  - "]" + ".src]
$
$ 	curip = f$logical("FNEWS_IPSOFTWARE")
$ 	if curip.eqs."" then curip = "CMUTEK"
$	write sys$Output "Supported IP software,  CMUTEK, MULTINET, TCPWARE, WOLLONGONG, UCX"
$ againxxx:
$ 	inquire ip_software "What IP software do you use? [''CURIP'] "
$ 	if ip_software.eqs."" then ip_software = curip
$
$ 	set noon
$ 	define ftop 'dest'
$	IF F$SEARCH("ftop:fnews.active") .nes. "" 
$ 	then
$		copy ftop:fnews.rc ftop:fnews.rc_save
$		copy ftop:fnews.active ftop:fnews.active_save
$		copy ftop:local.grps ftop:local.grps_save
$ 	endif 
$ 	IF F$SEARCH("fnews.bck_z") .nes."" then -
		IF F$SEARCH("fnews.bck") .nes."" then delete fnews.bck;*
$	call restore fnews.bck 'dest'
$	call restore fnews_src.bck 'destsrc'
$	IF F$SEARCH("ftop:fnews.active_save") .nes. "" 
$ 	then
$		copy ftop:fnews.rc_save ftop:fnews.rc
$		copy ftop:fnews.active_save ftop:fnews.active
$		copy ftop:local.grps_save ftop:local.grps
$ 	endif 
$	
$ 	IF F$SEARCH("''dest'lock.txt;*") .nes."" then delete 'dest'lock.txt;*
$ 	create 'dest'lock.txt;1
$ 
$ 	set default 'dest'
$ 	show default
$ 	write sys$Output "Linking fnews.exe image..."
$ 	if (ip_software.eqs."UCX") 
$	then
$		write sys$Output "Compiling tcp_ucx.c"
$		cc tcp_ucx
$ 	endif
$ 	@l 'ip_software'
$ 
$type sys$input
  Check the diskquota for FNEWS_USER is sufficient on the disk
  you have installed it, and you may need to run SUBMIT_CREATEID
  if your users don't have diskquota on this disk. (see the admin manual)

  Print admin.ps (or admin.txt) for full installation instructions.
  Print userman.ps and title.ps for a user manual.

  @install.com		to be asked various installation questions. 

  If you have an old version of fnews don't do that, just start 
  using it,  if problems develope then you might try 
	@newver.com
  to re-create the indexes from scratch.

$restore: subroutine
$	!if f$search(p1).nes."" then goto already_expanded
$	if f$search("''p1'_z") .NES. "" 
$	then 
$		write sys$Output "Uncompressing saveset, this will take 2-5 minutes..."
$		uncompress_saveset 'p1'
$	else
$		write sys$Output "No compressed saveset found, trying saveset"
$ 	endif
$ already_expanded:
$	IF F$SEARCH(p1) .eqs."" 
$ 	then
$		write sys$Output "Saveset ''p1' not found, skipping" 
$ 	else
$		write sys$Output "Restoring ''p1' to ''p2' this will take 2-4 minutes..."
$		backup 'p1'/save 'p2'  /new
$ 	endif
$ endsubroutine
$
$ 
$ find_root:
$ ! These lines find out where fnews is installed 
$ ! e.g. 	 root = "dua0:[fnews]"   
$	root  = f$logical("fnews_root")
$ 	if (root.eqs."") then root = f$environment("procedure")
$ again:
$ 	rootdev = f$parse(root,,,"device","syntax_only") 
$ 	rootdir = f$parse(root,,,"directory","syntax_only") 
$ 	if (rootdir.eqs."[000000]") 
$ 	then
$		root = f$trnlog(rootdev-":")
$		root = root - "."
$		goto again
$ 	endif
$ loop:
$	next = f$trnlog(rootdev-":")
$ 	if (next.eqs."") then goto gotdev
$	rootdev = next
$ 	goto loop
$ gotdev:
$ 	root = rootdev+rootdir
$ 	rootd = root-"]"
$ 	return
$
$ gethere:
$	here = f$environment("procedure")
$ 	heredev = f$parse(here,,,"device","syntax_only") 
$ 	heredir = f$parse(here,,,"directory","syntax_only") 
$	here = heredev+heredir
$ 	return
