source: projects/initscripts/tags/initscripts-8.91.0/sysconfig/network-scripts/ifdown-routes @ 1108

Revision 1108, 651 bytes checked in by daisuke, 14 years ago (diff)

import initscripts-8.90.6 from internal cvs repository

Line 
1#! /bin/bash
2#
3# Drops static routes which go through device $1
4if [ -z "$1" ]; then
5    echo $"usage: ifup-routes <net-device> [<nickname>]"
6    exit 1
7fi
8
9# The routes are actually dropped just by setting the link down, so nothing
10# needs to be done
11
12MATCH='^[[:space:]]*(\#.*)?$'
13
14# Routing rules
15FILES="/etc/sysconfig/network-scripts/rule-$1"
16if [ -n "$2" -a "$2" != "$1" ]; then
17    FILES="$FILES /etc/sysconfig/network-scripts/rule-$2"
18fi
19
20for file in $FILES; do
21   if [ -f "$file" ]; then
22       { cat "$file" ; echo ; } | while read line; do
23           if [[ ! "$line" =~ $MATCH ]]; then
24               /sbin/ip rule del $line
25           fi
26       done
27   fi
28done
Note: See TracBrowser for help on using the repository browser.