Comment 6 for bug 948217

Revision history for this message
Colin Watson (cjwatson) wrote :

Nitpick: 'grep -qc' could just be 'grep -q'. Also, please fix that regex to enforce whitespace on either side of $i, so that e.g. "eth1" doesn't match "eth10", and to match the sed regexes you're using: for example 'grep -q "^[[:space:]]*iface[[:space:]]\+$i[[:space:]].*dhcp"'.

In the sed regexes above, the \+ after the third [[:space:]] is superfluous, because it's followed by .* anyway.

Otherwise I have little to add to what Steve said. I can add another reason why the ifquery approach is problematic: you have to filter out "metric" variables that were automatically added by ifupdown, but the current ifquery interface doesn't allow you to distinguish between "metric" variables that it added itself and ones that were written explicitly in /etc/network/interfaces. The sed approach would fix that.

It seems unfortunate that this script has a .sh extension, as at this point it would really be more readable in some other language!