From 61761ebb4dfc23e7f7d042a806906bb8c6eb31e9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 15 Mar 2007 20:38:46 +0100 Subject: [PATCH] support persistent interface names across reboots --- debian/changelog | 9 +++++++++ sbin/netcardconfig | 23 +++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1d15c9f..5fa9602 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +grml-network (0.1-9) unstable; urgency=low + + * Support generation of udev rules for persistent interface names + across reboots (using an autogenerated script named + /etc/udev/scripts/netcardconfig). Thanks for the nice idea, + Michael Hanscho! [Closes: issue153] + + -- Michael Prokop Thu, 15 Mar 2007 20:37:05 +0100 + grml-network (0.1-8) unstable; urgency=low * grml-vpnc-tugraz: add (deactivated by default) template diff --git a/sbin/netcardconfig b/sbin/netcardconfig index 0107ab1..75225f0 100755 --- a/sbin/netcardconfig +++ b/sbin/netcardconfig @@ -4,7 +4,7 @@ # Authors: Michael Prokop , Marcel Wichern 2006, Klaus Knopper 2002, Niall Walsh + Stefan Lippers-Hollmann 2004-2007 # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Jän 27 19:28:54 CET 2007 [mika] +# Latest change: Don Mär 15 20:36:48 CET 2007 [mika] ################################################################################ # Changes have been merged from Kanotix's and Sidux's netcardconfig: # http://kanotix.com/files/debian/pool/main/n/netcardconfig-kanotix/ @@ -82,6 +82,19 @@ writeiwline() { #echo "DEBUG: for interfaces $IWOURLINE" } +generate_udev_entry() { + interface='' + echo "# Auto generated script from netcardconfig on $(date) +# Executing this script generates an entry in /etc/udev/rules.d/z25_persistent-net.rules +# for you, please check z25_persistent-net.rules for existing entries before +# running this script (once more)." > /etc/udev/scripts/netcardconfig + for interface in `ifconfig | awk '/^[a-z]/ &&!/^lo/{ print $1} '` ; do + echo -n "INTERFACE=$interface /lib/udev/write_net_rules " >> /etc/udev/scripts/netcardconfig && \ + udevinfo -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig + done + chmod +x /etc/udev/scripts/netcardconfig && /etc/udev/scripts/netcardconfig 1>/dev/null +} + device2props() { PARTCOUNT=0 isauto=0 @@ -540,7 +553,13 @@ while (true); do if ! ifup $DV; then $DIALOG --yesno "$MESSAGE14" 15 50 || IFACEDONE="DONE" else - $DIALOG --yesno "$MESSAGE15" 15 50 && addauto || remauto + if $DIALOG --yesno "$MESSAGE15" 12 50 ; then + addauto + # get persistent interface names across reboots + generate_udev_entry + else + remauto + fi IFACEDONE="DONE" fi done -- 2.1.4