#! /usr/bin/perl


###############################################################################
#
# Add local info to 'gnats' configuration file
#
$site       = "my-site";						# provided by 'init'
$gnatsdir   = "/usr/lib/gnats";					# provided by 'init'
$gnatsdbdir = "/var/gnats-db";					# provided by 'init'
$gnatssite  = "$gnatsdbdir/$site";				# provided by 'init'
$configfile = "$gnatsdbdir/gnats-adm/config";	# provided by 'init'

if (-f $configfile == 0) {
	print "- The master Gnats database is not mounted on this machine.  Be sure to mount\n";
	print "  it under '$gnatsdbdir' in order for the user tools to work.\n";
	mkdir $gnatsdbdir, 0755;
	chown $gnatsid,0, $gnatsdbdir;
}

print <<END;
- If you prefer not to nfs-mount the Gnats database, it is possible to make a
  distribution that works entirely over e-mail.  For more information, see
  gnats-info and type 'g' (for goto) followed by 'mkdist'.  This package is
  not neccessary for email-only setups.
END

#
# Create a symlink for the category file
#
#symlink("$gnatssite","$gnatsdir/$site") || addconfig_die;

#
# Fix things from previous version
#
if (-d "$gnatsdir/gnats-db") {
	print "- The previous version put the gnats database under $gnatsdir\n";
	if (rename("$gnatsdir/gnats-db","$gnatsdbdir")) {
		print "  It has now been moved to $gnatsdbdir";
	} else {
		print "  You must move it to $gnatsdbdir";
	}
}
