[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
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
case " $schema " in
|
already_in_schema()
|
||||||
*" speed "*)
|
{
|
||||||
get_value_for_entry "speed"
|
case " $schema " in
|
||||||
|
*" $1 "*)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
|
already_in_schema "speed" && {
|
||||||
speed="$value"
|
get_value_for_entry "speed"
|
||||||
else
|
|
||||||
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
|
|
||||||
speed=6
|
|
||||||
fi
|
|
||||||
|
|
||||||
already_in_schema()
|
if [ 2>/dev/null $value -gt 0 -a $value -le 20 ]; then
|
||||||
{
|
speed="$value"
|
||||||
case " $schema " in
|
else
|
||||||
*" $1 "*)
|
log "$funcname() Warning: invalid speed-value: '$value' - allowed integers: 1...20, fallback to 6"
|
||||||
return 0
|
speed=6
|
||||||
;;
|
fi
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
for schema_entry in $list_speed_vars; do {
|
for schema_entry in $list_speed_vars; do {
|
||||||
already_in_schema "$schema_entry" || schema="$schema $schema_entry"
|
already_in_schema "$schema_entry" || schema="$schema $schema_entry"
|
||||||
} done
|
} done
|
||||||
;;
|
}
|
||||||
esac
|
|
||||||
|
|
||||||
for schema_entry in $schema; do
|
for schema_entry in $schema; do
|
||||||
if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4
|
if [ -n "$speed" ]; then # like sven-ola freifunk firmware fff-1.7.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user