#! /usr/bin/perl
#
# installkernel v1.1 - todd j. derr <tjd@barefoot.org>
# 
# install this as /sbin/installkernel and it will be called when you
# 'make install' for the kernel.
#
# arguments are (as of kernel 1.3.3) [shift one for perl!]
#
#   $1 - kernel version
#   $2 - kernel image file
#   $3 - kernel map file
#   $4 - default install path (blank if root directory)
#
# since we can't get any more command line flags, we use the environment
# variable $KERNEL_TAG for an extra tag, if necessary.

# configuration section

$KINST="/sbin/kinst";		# path to 'kinst'
$FORCE="-f";			# disable prompting before overwriting files
#$FORCE="";			# uncomment to disable FORCE.

# --- You shouldn't need to change anything below here.

$tag=$ENV{"KERNEL_TAG"};

if ($#ARGV < 2)
{
	print("$0: missing arguments (expected 3, got ",$#ARGV+1,").\n");
	die("$0: installation failed.\n");
}

if ($ARGV[3] ne "")
{
	$inst="-i $ARGV[3]";
}

system("$KINST $FORCE -v $ARGV[0] -z $ARGV[1] -m $ARGV[2] $inst $tag") &&
	die("$0: installation failed.");
