From 0aac94f27c8942f239058587ec1cf3110ad18dc5 Mon Sep 17 00:00:00 2001 From: mag37 Date: Mon, 10 Jun 2024 21:09:04 +0200 Subject: [PATCH] bugfix non coreutils --- dockcheck.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index a117f49..6513e2c 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="v0.4.4" -### ChangeNotes: Bugfix for non amd64/arm64 arch with new timeout function. +VERSION="v0.4.5" +### ChangeNotes: Bugfix for non coreutils architectures that dont have timeout Github="https://github.com/mag37/dockcheck" RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh" @@ -225,8 +225,10 @@ for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}') LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}') - ### Checking for errors while setting the variable: - if RegHash=$(timeout --foreground ${Timeout} $regbin image digest --list "$RepoUrl" 2>&1) ; then + # Setting timeout-binary if existing + if [[ $(builtin type -P "timeout") ]]; then t_out="timeout --foreground ${Timeout}"; else t_out=""; fi + # Checking for errors while setting the variable: + if RegHash=$(${t_out} $regbin image digest --list "$RepoUrl" 2>&1) ; then if [[ "$LocalHash" = *"$RegHash"* ]] ; then NoUpdates+=("$i") else