Commit 0544eff was supposed to make anaconda try to write net.ifaces
whenever an interface came up, but because of a quoting error it
*emptied* /tmp/net.ifaces instead. It also didn't handle adding things
to net.ifaces correctly. This patch fixes both problems.
---
dracut/anaconda-lib.sh | 18 ++++++++++++------
dracut/parse-anaconda-options.sh | 2 +-
2 files changed, 13 insertions(+), 7 deletions(-)
# Save the dhclient lease and put the interface name into /tmp/net.ifaces,
# so the 'ifcfg' module will write out a proper ifcfg etc. for NetworkManager.
-# TODO: this should probably be in 40network/net-lib.sh
+# FIXME: this will probably be in 40network/net-lib.sh soon
save_netinfo() {
- local netif="$1"
- echo "$netif" >> /tmp/net.ifaces # XXX is it OK to list a netif twice?
- read IFACES < /tmp/net.ifaces
- for f in /tmp/dhclient.$iface.*; do
- [ -f $f ] && cp -f $f /tmp/net.${f#/tmp/dhclient.}
+ local netif="$1" IFACES="" f="" i=""
+ [ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces
+ # Add $netif to the front of IFACES (if it's not there already).
+ set -- "$netif"
+ for i in $IFACES; do [ "$i" != "$netif" ] && set -- "$@" "$i"; done
+ IFACES="$*"
+ for i in $IFACES; do
+ for f in /tmp/dhclient.$i.*; do
+ [ -f $f ] && cp -f $f /tmp/net.${f#/tmp/dhclient.}
+ done
done
+ echo $IFACES > /tmp/net.ifaces
}
parse_kickstart() {
diff --git a/dracut/parse-anaconda-options.sh b/dracut/parse-anaconda-options.sh
index 10ebebd..da18cae 100755
--- a/dracut/parse-anaconda-options.sh
+++ b/dracut/parse-anaconda-options.sh
@@ -103,7 +103,7 @@ if [ -n "$updates" ]; then
fi
# make sure we get ifcfg for every interface that comes up
-echo "save_netinfo $netif" > $hookdir/initqueue/online/anaconda-ifcfg.sh
+echo 'save_netinfo $netif' > $hookdir/initqueue/online/anaconda-ifcfg.sh
# re-read the commandline args
unset CMDLINE
--
1.7.7.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
On Mon, Mar 26, 2012 at 08:28:57PM -0400, Will Woods wrote:
> Commit 0544eff was supposed to make anaconda try to write net.ifaces
> whenever an interface came up, but because of a quoting error it
> *emptied* /tmp/net.ifaces instead. It also didn't handle adding things
> to net.ifaces correctly. This patch fixes both problems.
Ack
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list