Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

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