#!/bin/sh

# adds static routes which go through device $1

if [ "$1" = "" ]; then
	echo "usage: $0 <net-device>"
	exit 1
fi

if [ -x /bin/linuxconf ] ; then
	linuxconf --hint routing "$1" | while read args; do
	    /sbin/route $args
	done
else
	if [ ! -f /etc/sysconfig/static-routes ]; then
		exit 0
	fi

	#note the trailing space in the grep gets rid of aliases
	grep "^$1 " /etc/sysconfig/static-routes | while read device args; do
	    /sbin/route add -$args $device
	done
fi