summaryrefslogtreecommitdiffstats
path: root/dracut/anaconda-lib.sh
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2012-03-26 20:11:47 -0400
committerWill Woods <wwoods@redhat.com>2012-03-26 20:26:11 -0400
commit1a3dda93c9061ad1091ff7f72d5e4e129d8c675e (patch)
tree67f9090b6857abee672d5db058343df52c6718dd /dracut/anaconda-lib.sh
parent22c0e94db1cc6d8a71638a7e538cbd44560f8450 (diff)
downloadanaconda-1a3dda93c9061ad1091ff7f72d5e4e129d8c675e.tar.gz
anaconda-1a3dda93c9061ad1091ff7f72d5e4e129d8c675e.tar.xz
anaconda-1a3dda93c9061ad1091ff7f72d5e4e129d8c675e.zip
Fix nfs/nfsiso (NM handover problems / empty net.ifaces)
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.
Diffstat (limited to 'dracut/anaconda-lib.sh')
-rwxr-xr-xdracut/anaconda-lib.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 9793e8217..e03e0fb24 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -97,14 +97,20 @@ set_neednet() {
# 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() {