From 89dc8d4b510e5f99df4492748e1979d065e9be7a Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 11 Jul 2001 19:08:30 +0000 Subject: move looking for config files into network-functions (#48741) --- sysconfig/network-scripts/ifdown | 3 ++- sysconfig/network-scripts/ifup | 7 +------ sysconfig/network-scripts/network-functions | 10 ++++++++++ 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 1cd03d7c..eec308e4 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -13,7 +13,8 @@ CONFIG=$1 exit 1 } -[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG +need_config + [ -f "$CONFIG" ] || { echo $"usage: ifdown " >&2 exit 1 diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 214f42ea..20c079bd 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -28,12 +28,7 @@ CONFIG=${1} exit 1 } -[ -f "${CONFIG}" ] || \ - CONFIG=../networking/`current_profile`/${1} -[ -f "${CONFIG}" ] || \ - CONFIG=../networking/`current_profile`/"ifcfg-${1}" -[ -f "${CONFIG}" ] || \ - CONFIG="ifcfg-${1}" +need_config [ -f "${CONFIG}" ] || { echo $"$0: configuration for \"${1}\" not found." >&2 diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index fef6259d..b8529800 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -1,6 +1,16 @@ # This is not a shell script; it provides functions to network scripts # that source it. +need_config() +{ + [ -f "${CONFIG}" ] || \ + CONFIG=../networking/`current_profile`/${1} + [ -f "${CONFIG}" ] || \ + CONFIG=../networking/`current_profile`/ifcfg-${1} + [ -f "${CONFIG}" ] || \ + CONFIG="ifcfg-${1}" +} + source_config () { DEVNAME=`basename $CONFIG | sed 's/^ifcfg-//g'` -- cgit v1.2.1