luci-app-bmx7: fix bmx7-info script's "$info" call
This commit fixes a bug in bmx7-info script's "$info" call when no interfaces are being used by BMX7, or when no links have been established. In those cases, the generated JSON output struct contained extra commas, which made it invalid. Closes #430 Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
This commit is contained in:
parent
a7d7f4baa8
commit
3e259f8ec5
1 changed files with 3 additions and 5 deletions
|
@ -82,7 +82,7 @@ print_query() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the query is a file, just printing the file
|
# If the query is a file, just printing the file
|
||||||
[ -f "$BMX7_DIR/$1" ] && cat "$BMX7_DIR/$1";
|
[ -f "$BMX7_DIR/$1" ] && [ -s "$BMX7_DIR/$1" ] && cat "$BMX7_DIR/$1" && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${QUERY##*/}" == "all" ]; then
|
if [ "${QUERY##*/}" == "all" ]; then
|
||||||
|
@ -94,10 +94,8 @@ if [ "$QUERY" == '$info' ]; then
|
||||||
echo '{ "info": [ '
|
echo '{ "info": [ '
|
||||||
print_query status
|
print_query status
|
||||||
echo -n ","
|
echo -n ","
|
||||||
print_query interfaces
|
print_query interfaces && echo -n "," || echo -n '{ "interfaces": "" },'
|
||||||
echo -n ","
|
print_query links && echo -n "," || echo -n '{ "links": "" },'
|
||||||
print_query links
|
|
||||||
echo -n ","
|
|
||||||
print_mem
|
print_mem
|
||||||
echo "] }"
|
echo "] }"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue