#!/root/usr/bin/perl -w
#Tag 0x00000f00
#ident "$Revision $"
#
# Custom configuration script for use in the miniroot
#
# Fix up the Perl @INC for use in the miniroot:
# (if you change versions of Perl, change the 3rd 'unshift' appropriately)

BEGIN {
    require 5.003;		# we're shipping at least 5.004
    # this method works on all IRIX/Perl5 releases
    my(@new) = reverse @INC;
    my($dir);
    foreach $dir (@new) {
	unshift(@INC, "/root".$dir);
    }
    unshift(@INC, "/custom"); # chicken-or-egg: $custom not yet defined
}

# NOTE: because the Perl library is in /usr/share, and the system may be
# configured to NFS mount /usr/share, and NFS mounts won't be active in
# the miniroot, it would be wise to not use any standard modules in the
# miniroot, unless you are sure that they will be there...

require "ConfigMR.pl";		# therefore, old-style require

# for testing only:
$debug = @ARGV ? 1 : 0;
$mountdir = shift if @ARGV;
$custom = shift if @ARGV;

print mergeHostFile("$custom/hosts"), " hosts entries merged\n";

# change this to your own host!
configNetworking("urthr", "domain.com", "255.255.255.0", "10.62.51.133");
# if you are happy with the DHCP-ed hostname, then this version works:
#configNetworking("", "domain.com", "", "");
# and if it is also in the merged hosts file (for the domain):
#configNetworking("", "", "", "");
# note that a netmask of 255.255.255.0 (or 0xffffff00) is default.

chkconfig("verbose", "on");	# admin preference

# get the rest of the config files
print installTree(), " tree files copied\n";
print installSep(), " sep files copied\n";

# do this BEFORE adding users...
movedir("/usr/people", "/var/people");
cpPasswd();                     # copy the password file
makeauser("scotth", "01711");
print makeusers(), " user directories created\n";

# I like this on my test machine:
mkNDSslave("verthande.domain.com:0.0", "-slaveright", "-usekeysym", "-wait");

print STDERR "\%INC= ",join("\n", keys %INC), "\n" if $debug;
exit 0;
