diff options
author | Bill Nottingham <notting@redhat.com> | 1999-10-11 22:16:15 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 1999-10-11 22:16:15 +0000 |
commit | bde4005da6187596e024e0f31fefd056c2c50796 (patch) | |
tree | 100c517ce6252e344e927a336c95f5688a263102 /sysconfig | |
parent | beeb08030944b5ec8b9a54a4f427d8b70f930903 (diff) | |
download | initscripts-bde4005da6187596e024e0f31fefd056c2c50796.tar initscripts-bde4005da6187596e024e0f31fefd056c2c50796.tar.gz initscripts-bde4005da6187596e024e0f31fefd056c2c50796.tar.bz2 initscripts-bde4005da6187596e024e0f31fefd056c2c50796.tar.xz initscripts-bde4005da6187596e024e0f31fefd056c2c50796.zip |
add support for linuxconf aliases
Diffstat (limited to 'sysconfig')
-rwxr-xr-x | sysconfig/network-scripts/ifup-aliases | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index 28127d04..48680b2b 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # configures aliases of device $1 @@ -150,7 +150,7 @@ function new_interface () if [ -n "$devseen" ]; then echo "error in $FILE: already seen device $parent_device:$DEVNUM\ in $devseen" >&2; exit 0 fi - + if [ -z "$DEVICE" -o -z "$IPADDR" ]; then echo "error in $FILE: didn't specify device or ipaddr" >&2 ; exit 0 fi @@ -289,12 +289,50 @@ function new_interface () if [ "$BASH_VERSINFO" ]; then shopt -s nullglob; else allow_null_glob_expansion=foo; fi +# This is for linuxconf-style alias files. +aliasnum=0 for FILE in ifcfg-${parent_device}:* ; do ini_env; . $FILE; - new_interface; - + if [ -z "$DEVICE" ]; then + # Eek, it's a linuxconf file. + + for address in $IPADDR; do + if echo $address | grep -q '-' ; then + IPADDR_START=${address%-*} + ipaddr_prefix=${IPADDR_START%.*} + ipaddr_startnum=${IPADDR_START##*.} + IPADDR_END="${ipaddr_prefix}.${address##*-}" + ipaddr_endnum=${IPADDR_END##*.} + + if [ "${IPADDR_START%.*}" != "${IPADDR_END%.*}" ]; then + echo "error in $FILE: IPADDR_START and IPADDR_END don't argree" >&2; exit 0 + fi + + if [ $ipaddr_startnum -gt $ipaddr_endnum ]; then + echo "error in $FILE: IPADDR_START greater than IPADDR_END" >&2; exit 0 + fi + + ipaddr_num=$ipaddr_startnum + + while [ $ipaddr_num -le $ipaddr_endnum ]; do + IPADDR="$ipaddr_prefix.$ipaddr_num" + DEVICE="$parent_device:$aliasnum" + new_interface; + let 'ipaddr_num=ipaddr_num+1' + let 'aliasnum=aliasnum+1' + done + else + DEVICE="${parent_device}:${aliasnum}" + IPADDR=$address + new_interface; + let 'aliasnum=aliasnum+1' + fi + done + else + new_interface; + fi done for FILE in ifcfg-${parent_device}-range* ; do |