potential busybox fix

This commit is contained in:
mag37 2024-06-16 07:51:32 +02:00
parent 082b0f4c7c
commit abec27c38a

View file

@ -217,6 +217,17 @@ fi
DocCount=$(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}' | wc -l)
RegCheckQue=0
### Testing and setting timeout binary
t_out=$(type -P "timeout")
if [[ $t_out ]]; then
t_out=$(realpath $t_out 2>/dev/null || readlink -f $t_out)
if [[ $t_out =~ "busybox" ]]; then
t_out="timeout ${Timeout}"
else t_out="timeout --foreground ${Timeout}"
fi
else t_out=""
fi
### Check the image-hash of every running container VS the registry
for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') ; do
((RegCheckQue+=1))
@ -225,8 +236,6 @@ 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}}')
# 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