aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown-post5
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp4
-rwxr-xr-xsysconfig/network-scripts/ifdown-sl4
-rwxr-xr-xsysconfig/network-scripts/ifup4
-rwxr-xr-xsysconfig/network-scripts/ifup-plip4
-rwxr-xr-xsysconfig/network-scripts/ifup-post11
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp12
-rwxr-xr-xsysconfig/network-scripts/ifup-sl14
-rw-r--r--sysconfig/network-scripts/network-functions18
9 files changed, 61 insertions, 15 deletions
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index cb7ce8c1..bf1c0c18 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -4,7 +4,10 @@
cd /etc/sysconfig/network-scripts
-. $1
+# These are currently unused.
+# CONFIG=$1
+# . network-functions
+# source_config
# Notify programs that have requested notification
( cd /var/run/netreport || exit
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index f3226419..299fb8a9 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -3,7 +3,9 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
cd /etc/sysconfig/network-scripts
-. $1
+CONFIG=$1
+. network-functions
+source_config
if [ ! -f /var/run/ppp-$DEVICE.dev ]; then
# ppp isn't running, or we didn't start it
diff --git a/sysconfig/network-scripts/ifdown-sl b/sysconfig/network-scripts/ifdown-sl
index cb3a8f12..ea9bae61 100755
--- a/sysconfig/network-scripts/ifdown-sl
+++ b/sysconfig/network-scripts/ifdown-sl
@@ -3,7 +3,9 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
cd /etc/sysconfig/network-scripts
-. $1
+CONFIG=$1
+. network-functions
+source_config
# signals ifup-sl not to persist
rm -f /var/run/sl-$DEVICE.dev
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index ab1e6f7f..359ef3cb 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -3,6 +3,8 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
cd /etc/sysconfig/network-scripts
+. network-functions
+
CONFIG=$1
[ -z "$CONFIG" ] && {
@@ -24,7 +26,7 @@ if [ $UID != 0 ]; then
exit 1
fi
-. $CONFIG
+source_config
if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
then
diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip
index ea423944..6a341194 100755
--- a/sysconfig/network-scripts/ifup-plip
+++ b/sysconfig/network-scripts/ifup-plip
@@ -1,7 +1,9 @@
#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin
-. $1
+CONFIG=$1
+. network-functions
+source_config
if [ "foo$2" = "fooboot" -a ${ONBOOT} = "no" ]
then
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 7f79930e..dd1f8389 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -2,7 +2,10 @@
cd /etc/sysconfig/network-scripts
-. $1
+CONFIG=$1
+. network-functions
+
+source_config
DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"`
REALDEVICE=`echo $DEVICE | sed 's/:.*//g'`
@@ -15,11 +18,11 @@ fi
/etc/sysconfig/network-scripts/ifup-routes ${DEVICE}
if [ "$ISALIAS" = no ] ; then
+ allow_null_glob_expansion=foo
for alias in /etc/sysconfig/network-scripts/ifcfg-${DEVICE}:* ; do
- if [ -f $alias ] ; then
- /etc/sysconfig/network-scripts/ifup $alias
- fi
+ /etc/sysconfig/network-scripts/ifup $alias
done
+ unset allow_null_glob_expansion
fi
if [ `hostname` = '(none)' -o `hostname` = localhost -a ${DEVICE} != lo ]; then
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
index 7b5cb377..9d09038f 100755
--- a/sysconfig/network-scripts/ifup-ppp
+++ b/sysconfig/network-scripts/ifup-ppp
@@ -1,6 +1,9 @@
#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin
+CONFIG=$1
+. network-functions
+
# ifup-post for PPP is handled through /etc/ppp/ip-up
if [ "$1" != daemon ] ; then
@@ -10,7 +13,7 @@ fi
shift
-. $1
+source_config
if [ -z "$DISCONNECTTIMEOUT" ]; then
DISCONNECTTIMEOUT=2
@@ -67,6 +70,11 @@ if [ -n "${DEBUG}" ] ; then
opts="$opts debug"
fi
+CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$DEVNAME
+[ -f $CHATSCRIPT ] || {
+ CHATSCRIPT=/etc/sysconfig/network-scripts/chat-$PARENTDEVNAME
+}
+
while : ; do
(logger -p daemon.info -t ifup-ppp \
"pppd started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
@@ -75,7 +83,7 @@ while : ; do
/usr/sbin/pppd -detach $opts $MODEMPORT $LINESPEED \
remotename $DEVICE ipparam $DEVICE \
${PPPOPTIONS} \
- connect "/usr/sbin/chat ${DEBUG:+-v} -f /etc/sysconfig/network-scripts/chat-$DEVICE"
+ connect "/usr/sbin/chat ${DEBUG:+-v} -f $CHATSCRIPT"
# exit if we're not supposed to persist or our lock file has disappeared
if [ "$PERSIST" != "yes" -o ! -f /var/run/ppp-$DEVICE.dev ]; then
diff --git a/sysconfig/network-scripts/ifup-sl b/sysconfig/network-scripts/ifup-sl
index aad0b051..c0ad24d5 100755
--- a/sysconfig/network-scripts/ifup-sl
+++ b/sysconfig/network-scripts/ifup-sl
@@ -3,14 +3,16 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
# ifup-post can't be done for slip :-( Solution: use PPP
+# become a daemon in case we have to persist.
if [ "$1" != daemon ] ; then
$0 daemon $*&
exit 0
fi
-
shift
-. $1
+CONFIG=$1
+. network-functions
+source_config
if [ "foo$2" = "fooboot" -a ${ONBOOT} = "no" ]
then
@@ -29,7 +31,11 @@ fi
exit 1
}
-[ -f /etc/sysconfig/network-scripts/dip-$DEVICE ] || {
+DIPSCRIPT=/etc/sysconfig/network-scripts/dip-$DEVNAME
+[ -f $DIPSCRIPT ] || {
+ DIPSCRIPT=/etc/sysconfig/network-scripts/dip-$PARENTDEVNAME
+}
+[ -f $DIPSCRIPT ] || {
echo "/etc/sysconfig/network-scripts/dip-$DEVICE does not exist"
echo "ifup-sl for $DEVICE exiting"
logger -p daemon.info -t ifup-sl \
@@ -41,7 +47,7 @@ while : ; do
echo > /var/run/sl-$DEVICE.dev
(logger -p daemon.info -t ifup-sl \
"dip started for $DEVICE on $MODEMPORT at $LINESPEED" &)&
- doexec /usr/sbin/dip dip-$DEVICE /etc/sysconfig/network-scripts/dip-$DEVICE
+ doexec /usr/sbin/dip dip-$DEVICE $DIPSCRIPT
if [ "$PERSIST" != "yes" -o ! -f /var/run/sl-$DEVICE.dev ] ; then
exit 0
fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
new file mode 100644
index 00000000..f637c7ee
--- /dev/null
+++ b/sysconfig/network-scripts/network-functions
@@ -0,0 +1,18 @@
+# This is not a shell script; it provides functions to network scripts
+# that source it.
+
+source_config ()
+{
+ DEVNAME=`echo $CONFIG | sed 's/^ifcfg-//g'`
+
+ . $CONFIG
+ if echo $CONFIG | grep -q '[^g]-' ; then
+ PARENTCONFIG=`echo $CONFIG | sed 's/-[^-]*$//g'`
+ PARENTDEVNAME=`echo $PARENTCONFIG | sed 's/^ifcfg-//g'`
+ [ -f $PARENTCONFIG ] || {
+ echo "Missing config file $PARENTCONFIG." >&2
+ exit 1
+ }
+ . $PARENTCONFIG
+ fi
+}