Fix ifquery call in dhcp-all-interfaces

Ifquery does not print anything for interfaces which only have a single
iface line. It does, however, return non-zero if the interface is not
configured at all, so we can use that to indicate whether or not there
is a configuration.

Fixes bug #1233579

Change-Id: Ia2fdafbea57e806eba99ae8ddaf395ebdcc306e1
This commit is contained in:
Clint Byrum 2013-10-11 11:01:06 -07:00
parent 5907b2fa43
commit 2129d78124

View File

@ -12,8 +12,9 @@ function get_if_link() {
for interface in $(ls /sys/class/net | grep -v ^lo$) ; do
echo -n "Inspecting interface: $interface..."
HAS_CONFIG=$(ifquery $interface >/dev/null 2>&1)
if [ "$HAS_CONFIG" == "" ]; then
if ifquery $interface >/dev/null 2>&1 ; then
echo "Has config, skipping."
else
ip link set dev $interface up >/dev/null 2>&1
HAS_LINK="$(get_if_link $interface)"