Skip to contentSkip to conversation

recent hotplug changes are too distro specific

PATCH Olaf Hering 1 participant 1 message Oct 15, 2003

lore
Share & tools
lore
#0 lore raw

Greg,

I have to veto against a few of the CVS changes from this week. They are too distro specific, and I think one of them cant work at all.

I suggest to not check for a distro specifc tool, instead we should check if a generic distro provided script exists and execute it. This would reduce the patch mess.

if [ -x /usr/sbin/distro.usb.agent.sh ] ; then
/usr/sbin/distro.usb.agent.sh
fi

same for net, ieee1394 and so on. Possible with parameter passing, but I think most of it can be grabbed from enviroment.

admin/etc/hotplug/hotplug.functions +4 -1
diff -urN hotplug.prev/admin/etc/hotplug/hotplug.functions hotplug/admin/etc/hotplug/hotplug.functions
@@ -6,7 +6,7 @@
 # on-line at http://linux-hotplug.sourceforge.net or the
 # sources for each hotplug-aware kernel subsystem.
 #
-# $Id: hotplug.functions,v 1.20 2003/06/09 23:06:27 dbrownell Exp $
+# $Id: hotplug.functions,v 1.22 2003/10/07 21:15:38 kroah Exp $
 #
 #
 
@@ -174,6 +177,9 @@
 	if [ $LOADED = false ]; then
 	    mesg "missing kernel or user mode driver $MODULE "
 	fi
+	if echo "$MODULE" | grep -q "usb-storage" > /dev/null 2>&1 ; then
+	    [ -x /usr/sbin/updfstab ] &&  /usr/sbin/updfstab
+	fi
     done
 }
 
admin/etc/hotplug/net.agent +5 -1
diff -urN hotplug.prev/admin/etc/hotplug/net.agent hotplug/admin/etc/hotplug/net.agent
@@ -13,7 +13,7 @@
 # 23-Jan-2001	Log invocation of "ifup" if debugging
 # 04-Jan-2001	Initial version of "new" hotplug agent.
 #
-# $Id: net.agent,v 1.12 2003/06/28 00:16:15 kroah Exp $
+# $Id: net.agent,v 1.15 2003/10/07 19:56:24 kroah Exp $
 #
 
 cd /etc/hotplug
@@ -27,10 +27,14 @@
 
 case $ACTION in
 add|register)
+    # Don't do anything if the network is stopped
+    if [ ! -f /var/lock/subsys/network ]; then
+       exit 0
+    fi
 
 

This looks broken. is /var/lock/subsys/network some LSB or FHS blessed file? I doubt that. Again, this is distro specific.

@@ -41,6 +45,7 @@

 	    # such as whether/how to invoke DHCP, set up bridging, etc.

# RedHat and similar
+ export IN_HOTPLUG=1
if [ -x /sbin/ifup ]; then
debug_mesg invoke ifup $INTERFACE
exec /sbin/ifup $INTERFACE

The ifup calls could go into a distro.net.agent.sh

admin/etc/hotplug/usb.agent +5 -1
diff -urN hotplug.prev/admin/etc/hotplug/usb.agent hotplug/admin/etc/hotplug/usb.agent
@@ -71,7 +71,7 @@
 #		Norbert Preining, Florian Lohoff, David Brownell and
 #		others.  To replace the original /etc/usb/policy. (db)
 #
-# $Id: usb.agent,v 1.32 2003/09/16 19:42:17 kroah Exp $
+# $Id: usb.agent,v 1.33 2003/10/07 20:03:49 kroah Exp $
 #
 
 if [ -f /etc/sysconfig/usb ]; then
@@ -428,6 +428,10 @@
 	$REMOVER
     fi
     rm -f $REMOVER
+
+    if [ -x /usr/sbin/updfstab ]; then
+        /usr/sbin/updfstab
+    fi
     ;;
 
 *)

same here.

I will provide a patch if we agree on a good name for distro.$1.agent. Running stuff from /etc/hotplug-beta.d/$1 could screw up the call order. stuff called from usb.agent as example would require a zzzusb.hotplug. And even that would not work because the default/default.hotplug is called last. One could kill the $PPID but thats not very pretty.

Signature · 14 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel