From 5f255090f55b2611a53563e92abcfe7f4a5cc949 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Thu, 12 Sep 2024 18:53:11 +0530 Subject: [PATCH] self-diagnostics: Fix rpcd scripts --- self-diagnostics/Makefile | 2 +- .../files/usr/libexec/rpcd/self-diagnostics | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/self-diagnostics/Makefile b/self-diagnostics/Makefile index 801ae836e..348ceb2aa 100644 --- a/self-diagnostics/Makefile +++ b/self-diagnostics/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=self-diagnostics -PKG_VERSION:=1.0.8 +PKG_VERSION:=1.0.9 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-only diff --git a/self-diagnostics/files/usr/libexec/rpcd/self-diagnostics b/self-diagnostics/files/usr/libexec/rpcd/self-diagnostics index 7bc92a0f5..1952282b2 100755 --- a/self-diagnostics/files/usr/libexec/rpcd/self-diagnostics +++ b/self-diagnostics/files/usr/libexec/rpcd/self-diagnostics @@ -11,17 +11,28 @@ case "$1" in case "$2" in generate) read -t 1 -r input + local out json_load "${input}" json_get_var modules modules if [ -z "${modules}" ]; then - ${BIN} -j + out="$(${BIN} -j)" else - ${BIN} -j -m "${modules}" + out="$(${BIN} -j -m "${modules}")" + fi + if [ -z "${out}" ]; then + echo '{}' + else + echo "${out}" fi ;; list) - ${BIN} -j -l + out="$(${BIN} -j -l)" + if [ -z "${out}" ]; then + echo '{}' + else + echo "${out}" + fi ;; esac ;;