aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-01-20 21:55:53 +0000
committerBill Nottingham <notting@redhat.com>2006-01-20 21:55:53 +0000
commitcbf94e7107655151dc138e3e22e05afe3234d959 (patch)
tree76c7b0389f9e9913982d8cd9d79e116c20cedfb4
parentb7e210969a9f0aedda2a7c1a29ec92618887d116 (diff)
downloadinitscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.gz
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.bz2
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.tar.xz
initscripts-cbf94e7107655151dc138e3e22e05afe3234d959.zip
move hotplug handling here. add udev rules. obsolete hotplug.
-rw-r--r--Makefile3
-rw-r--r--initscripts.spec9
-rwxr-xr-xsysconfig/network-scripts/net.hotplug55
-rw-r--r--udev/rules.d/60-net.rules1
4 files changed, 66 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index eaddff49..b3efdaf1 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ install:
mkdir -p $(ROOT)/etc/X11
install -m755 prefdm $(ROOT)/etc/X11/prefdm
- cp -af rc.d sysconfig ppp $(ROOT)/etc
+ cp -af rc.d sysconfig ppp udev $(ROOT)/etc
mkdir -p $(ROOT)/etc/ppp/peers
chmod 755 $(ROOT)/etc/rc.d/* $(ROOT)/etc/rc.d/init.d/*
chmod 755 $(ROOT)/etc/ppp/peers
@@ -41,6 +41,7 @@ install:
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifup-*
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifdown-*
chmod 755 $(ROOT)/etc/sysconfig/network-scripts/init*
+ chmod 755 $(ROOT)/etc/sysconfig/network-scripts/net.hotplug
mkdir -p $(ROOT)/etc/sysconfig/modules
mkdir -p $(ROOT)/etc/sysconfig/networking/devices
mkdir -p $(ROOT)/etc/sysconfig/networking/profiles/default
diff --git a/initscripts.spec b/initscripts.spec
index ff1e4764..ca590507 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: The inittab file and the /etc/init.d scripts.
Name: initscripts
-Version: 8.20
+Version: 8.21
License: GPL
Group: System Environment/Base
Release: 1
@@ -24,6 +24,7 @@ Conflicts: dhclient < 3.0.3-7
Conflicts: tcsh < 6.13-5
#Conflicts: diskdumputils < 1.1.0
Obsoletes: rhsound sapinit
+Obsoletes: hotplug
Prereq: /sbin/chkconfig, /usr/sbin/groupadd, /bin/sed, mktemp, fileutils, sh-utils
BuildPrereq: glib2-devel popt gettext pkgconfig
@@ -154,10 +155,12 @@ rm -rf $RPM_BUILD_ROOT
%config /etc/sysconfig/network-scripts/ifup-wireless
/etc/sysconfig/network-scripts/ifup-isdn
/etc/sysconfig/network-scripts/ifdown-isdn
+/etc/sysconfig/network-scripts/net.hotplug
%ifarch s390 s390x
%config /etc/sysconfig/network-scripts/ifup-ctc
%config /etc/sysconfig/network-scripts/ifup-iucv
%endif
+/etc/udev/rules.d/*
%config /etc/X11/prefdm
%config(noreplace) /etc/inittab
%dir /etc/rc.d
@@ -205,6 +208,10 @@ rm -rf $RPM_BUILD_ROOT
%ghost %attr(0664,root,utmp) /var/run/utmp
%changelog
+* Fri Jan 20 2005 Bill Nottingham <notting@redhat.com> 8.21-1
+- move handling of network hotplug events here, add appropriate udev
+ rules, obsolete hotplug
+
* Wed Dec 21 2005 Bill Nottingham <notting@redhat.com> 8.20-1
- remove kmodule. udev handles module loading now
- require appropriate udev
diff --git a/sysconfig/network-scripts/net.hotplug b/sysconfig/network-scripts/net.hotplug
new file mode 100755
index 00000000..b59d87e4
--- /dev/null
+++ b/sysconfig/network-scripts/net.hotplug
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+. /etc/sysconfig/network-scripts/network-functions
+
+if [ "$INTERFACE" = "" ]; then
+ exit 1
+fi
+
+case $ACTION in
+add|register)
+ # Don't do anything if the network is stopped
+ if [ ! -f /var/lock/subsys/network ]; then
+ exit 0
+ fi
+
+ case $INTERFACE in
+ # interfaces that are registered after being "up" (?)
+ ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+ exit 0
+ ;;
+ # interfaces that are registered then brought up
+ *)
+ export IN_HOTPLUG=1
+ if [ -x /sbin/ifup ]; then
+ addr=$(get_hwaddr ${INTERFACE})
+ if [ -n "$addr" ]; then
+ nconfig=$(get_config_by_hwaddr ${addr})
+ [ -n "$nconfig" ] && INTERFACE=$nconfig
+ fi
+ exec /sbin/ifup $INTERFACE
+ fi
+ ;;
+ esac
+ ;;
+
+remove|unregister)
+ case $INTERFACE in
+ # interfaces that are unregistered after being "down" (?)
+ ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
+ exit 0
+ ;;
+ *)
+ # RedHat and similar
+ export IN_HOTPLUG=1
+ if [ -x /sbin/ifdown ]; then
+ exec /sbin/ifdown $INTERFACE
+ fi
+ ;;
+ esac
+ ;;
+
+*)
+ exit 1 ;;
+
+esac
diff --git a/udev/rules.d/60-net.rules b/udev/rules.d/60-net.rules
new file mode 100644
index 00000000..ca0b3967
--- /dev/null
+++ b/udev/rules.d/60-net.rules
@@ -0,0 +1 @@
+SUBSYSTEM=="net", RUN+="/etc/sysconfig/network-scripts/net.hotplug"