[PATCH] add default option to config_get and some followup cleanups
|Reported by:||Malte S. Stretz <mss@…>||Owned by:||developers|
|Priority:||normal||Milestone:||Barrier Breaker 14.07|
The command config_get_bool allows a fourth parameter which defines a default value. At many places it would be very useful if the plain three-parameter version of config get supported such a parameter as well, that saves a bunch of [ -z "$foo" ] checks in my scripts.
I'll attach some patches: The first introduces an optional fourth parameter to config_get. That patch could be backported to 8.09 branch.
The next four patches apply this four-parameter version in functions.sh, init.d/boot, init.d/led and init.d/fstab.
Finally there's another patch to /lib/network/config.sh which also includes some refactoring moving around some code and localizes a lot of variables which weren't so before. The changes don't spread over more than two hunks per refactoring.