[packages] olsrd: init: reduce code duplication by reusing already_in_schema()
changed scope/position of this function, and reuse it. Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> git-svn-id: svn://svn.openwrt.org/openwrt/packages@36300 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
54e2dda469
commit
a294dffd0f
@ -270,34 +270,32 @@ config_write_options() {
|
||||
return 0
|
||||
}
|
||||
|
||||
case " $schema " in
|
||||
*" speed "*)
|
||||
get_value_for_entry "speed"
|
||||
already_in_schema()
|
||||
{
|
||||
case " $schema " in
|
||||
*" $1 "*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
|
||||
speed="$value"
|
||||
else
|
||||
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
|
||||
speed=6
|
||||
fi
|
||||
already_in_schema "speed" && {
|
||||
get_value_for_entry "speed"
|
||||
|
||||
already_in_schema()
|
||||
{
|
||||
case " $schema " in
|
||||
*" $1 "*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
|
||||
speed="$value"
|
||||
else
|
||||
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
|
||||
speed=6
|
||||
fi
|
||||
|
||||
for schema_entry in $list_speed_vars; do {
|
||||
already_in_schema "$schema_entry" || schema="$schema $schema_entry"
|
||||
} done
|
||||
;;
|
||||
esac
|
||||
for schema_entry in $list_speed_vars; do {
|
||||
already_in_schema "$schema_entry" || schema="$schema $schema_entry"
|
||||
} done
|
||||
}
|
||||
|
||||
for schema_entry in $schema; do
|
||||
if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user