mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-01 17:34:40 +01:00
39 lines
620 B
Bash
Executable file
39 lines
620 B
Bash
Executable file
#!/bin/sh
|
|
|
|
BIN="/usr/sbin/self-diagnostics"
|
|
. /usr/share/libubox/jshn.sh
|
|
|
|
case "$1" in
|
|
list)
|
|
echo '{"list": {}, "generate" : {"modules":"String"}}'
|
|
;;
|
|
call)
|
|
case "$2" in
|
|
generate)
|
|
read -t 1 -r input
|
|
local out
|
|
|
|
json_load "${input}"
|
|
json_get_var modules modules
|
|
if [ -z "${modules}" ]; then
|
|
out="$(${BIN} -j)"
|
|
else
|
|
out="$(${BIN} -j -m "${modules}")"
|
|
fi
|
|
if [ -z "${out}" ]; then
|
|
echo '{}'
|
|
else
|
|
echo "${out}"
|
|
fi
|
|
;;
|
|
list)
|
|
out="$(${BIN} -j -l)"
|
|
if [ -z "${out}" ]; then
|
|
echo '{}'
|
|
else
|
|
echo "${out}"
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|