From 3abb63eaac93890fa155abc4e3b46c8fcba3be0e Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 13 Dec 2021 09:59:24 +0100 Subject: [PATCH] TT#102912 status: report the name of the invoked binary When invoking `ngcp-config status`, we reported "ngcpcfg": | [sipwise-lab-trunk] sipwise@sp1:~$ sudo ngcpcfg status | 2021-12-09 17:30:08 sp1: Checking state of ngcpcfg: | 2021-12-09 17:30:08 sp1: OK: has been initialised already | [...] While what we should report instead is "ngcpcfg-config", like: | [sipwise-lab-trunk] sipwise@sp1:~$ sudo ngcp-config status | 2021-12-09 17:31:31 sp1: Checking state of ngcp-config: | 2021-12-09 17:31:31 sp1: OK: has been initialised already | [...] Change-Id: If8fc8076fdf1d214baea3c7388ab208947d66a05 --- scripts/status | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/status b/scripts/status index 17d5b73a..917fafe8 100755 --- a/scripts/status +++ b/scripts/status @@ -52,7 +52,14 @@ check_local_state() { log_debug "cd $NGCPCTL_MAIN" cd "$NGCPCTL_MAIN" - log_info "Checking state of ngcpcfg:" + # report either "ngcpcfg" or "ngcp-config", depending on how it was invoked + local invoker + if [ -r "/proc/${PPID:-doesnotexist}/comm" ] ; then + invoker="$( < /proc/$PPID/comm)" + fi + + log_info "Checking state of ${invoker:-ngcpcfg}:" + if ! [ -r "${NGCPCTL_MAIN}/.git/HEAD" ] ; then log_warn "ngcpcfg has not been initialised yet. Execute 'ngcpcfg initialise'." exit 0