#!/bin/csh -f
# install -- install irqtune (OBSOLETE)
#
# NOTE: this script is obsolete and has been superceded by sbin/irqtune
#
# arguments:
#   1 - installation type (INSTALL)
#   2 - SBIN directory
#   3 - IRQTUNE_HOME
#

alias msg 'echo \!*'

while ($#argv > 0)
	switch ("$argv[1]")
	case -*:
		shift
		breaksw
	default:
		break
		breaksw
	endsw
end

set cmd="$argv[1]"
shift
setenv SBIN "$argv[1]"
shift
setenv IRQTUNE_HOME "$argv[1]"

set stub="$SBIN/irqtune"

set TARGETLIST=(irqtune_mod.o irqtune_npr.o)

switch ("$cmd")
case "sh":
	msg "install: installing stub as $stub ..."

	cat << EOF > $stub
#!/bin/sh -
IRQTUNE_HOME='$IRQTUNE_HOME'
exec \$IRQTUNE_HOME/sbin/irqtune \$*
EOF
chmod 755 $stub

	foreach name ($TARGETLIST)
		set name="$SBIN/$name"
		if (-e $name) then
			msg "install: removing $name ..."
			rm -f $name
		endif
	end
	breaksw

default:
	msg "install: simple installation ..."
	foreach name ($TARGETLIST)
		msg "install: installing $SBIN/$name ..."
		cp $name $SBIN
	end
	breaksw
endsw
