#!/bin/bash
TEXTDOMAIN=initscripts

# adds static routes which go through device $1

. /etc/rc.d/init.d/functions

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

if [ ! -f /etc/sysconfig/networking/static-routes ] &&
    [ ! -f /etc/sysconfig/static-routes ]; then
	exit 0
fi

DEVICE=$1

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