From 6404bee97b659df3dba6fe37c09097a44b9c23e7 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Wed, 24 Jan 2024 14:09:03 +0100 Subject: [PATCH] show rootless or not --- check_docker_info | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/check_docker_info b/check_docker_info index cb192ac..a7c5550 100755 --- a/check_docker_info +++ b/check_docker_info @@ -14,7 +14,7 @@ # 2024-01-18 v1.0 <axel.hahn@unibe.ch> init # 2024-01-22 v1.1 <axel.hahn@unibe.ch> detect DOCKER; use sudo; add debug # 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path -# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info +# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not # ====================================================================== @@ -118,7 +118,6 @@ iImages=$( _getString "$data" ".Images" ) sVersion=$( _getString "$data" ".ServerVersion") sLicense=$( _getString "$data" ".ProductLicense" ) -test "$sLicense" = "null" && sLicense="no license info" # --- generate result @@ -151,7 +150,15 @@ ph.perfadd "images" "$iImages" # --- output -ph.status "Docker $sVersion ($sLicense) .. containers: $iCTotal running: $iCRunning paused: $iCPaused stopped: $iCStopped .. images: $iImages" +sStatus="Docker $sVersion (" +test -n "$sLicense" && sStatus+="$sLicense, " +test "$_is_docker_rootless" -eq "0" && sStatus+="as root" +test "$_is_docker_rootless" -eq "1" && sStatus+="rootless" +sStatus+=") .. " +sStatus+="containers: $iCTotal running: $iCRunning paused: $iCPaused stopped: $iCStopped .. " +sStatus+="images: $iImages" + +ph.status "$sStatus" echo "$out" if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then @@ -176,7 +183,7 @@ if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then fi # if -d was given then show debug infos too -test $bOptDebug -eq 1 && ( echo; echo "DEBUG: full docker system infos as json"; echo "$data" | jq ) +test $bOptDebug -eq 1 && ( echo; echo "DEBUG: full docker system infos as json"; echo "$data" | jq ; _debugInfos) ph.exit -- GitLab