From 2734a87537d24756c60c4f39ff91df694a78352a Mon Sep 17 00:00:00 2001 From: Philippe Seewer Date: Tue, 16 Jun 2009 11:26:29 +0200 Subject: [PATCH] netroot: Use root.info instead of netroot.info Having two files which are used more or less at the same time isn't that easy to handle and read. Instead, move the contents of netroot.info to root.info and only use root.info. This is cleaner and makes debugging easier. --- modules.d/40network/dhcp-fallback.sh | 4 ---- modules.d/40network/ifup | 4 +++- modules.d/40network/netroot | 6 ++++-- modules.d/99base/init | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules.d/40network/dhcp-fallback.sh b/modules.d/40network/dhcp-fallback.sh index 484a1214..6bc823fa 100755 --- a/modules.d/40network/dhcp-fallback.sh +++ b/modules.d/40network/dhcp-fallback.sh @@ -14,7 +14,3 @@ fi if [ "$netroot" = "$root" ]; then unset root fi - -if [ "${netroot+set}" = "set" ]; then - eval "echo netroot='$netroot'" > /tmp/netroot.info -fi diff --git a/modules.d/40network/ifup b/modules.d/40network/ifup index d2413323..4009bdcb 100755 --- a/modules.d/40network/ifup +++ b/modules.d/40network/ifup @@ -15,7 +15,9 @@ netif=$1 # bail immediately if the interface is already up # or we don't need the network [ -f "/tmp/net.$netif.up" ] && exit 0 -[ ! -f /tmp/netroot.info ] && exit 0 +[ -f "/tmp/root.info" ] || exit 0 +. /tmp/root.info +[ -z "$netroot" ] && exit 0 # loopback is always handled the same way [ "$netif" = "lo" ] && { diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot index a2ef22fd..53be6cf6 100755 --- a/modules.d/40network/netroot +++ b/modules.d/40network/netroot @@ -29,15 +29,17 @@ netif=$1 # then no point in looking further # [ -e /tmp/netroot.done ] && exit 0 -[ -s /tmp/netroot.info -a -s /tmp/root.info ] || exit 0 +[ -f /tmp/root.info ] || exit 1 # Pick up our config from the command line; we may already know the # handler to run # . /tmp/root.info -. /tmp/netroot.info [ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts +# Don't continue if netroot isn't needed +[ -z "$netroot" ] && exit 0 + # Now, let the installed network root handlers figure this out # source_all netroot diff --git a/modules.d/99base/init b/modules.d/99base/init index 644b62af..e417993d 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -59,6 +59,7 @@ fi echo "root='$root'" echo "rflags='$rflags'" echo "fstype='$fstype'" + echo "netroot='$netroot'" echo "NEWROOT='$NEWROOT'" } > /tmp/root.info