From d4d89c305c9c8c2de871db2775919b239851c388 Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 21:39:29 +0100 Subject: [PATCH] osx/bsd compatibility changes --- dockcheck.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index f42febf..100e466 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -131,7 +131,8 @@ choosecontainers() { datecheck() { ImageDate=$($regbin -v error image inspect "$RepoUrl" --format='{{.Created}}' | cut -d" " -f1 ) - ImageAge=$(( ( $(date +%s) - $(date -d "$ImageDate" +%s) )/86400 )) + ImageEpoch=$(date -d "$ImageDate" +%s 2>/dev/null) || ImageEpoch=$(date -f "%Y-%m-%d" -j "$ImageDate" +%s) + ImageAge=$(( ( $(date +%s) - $ImageEpoch )/86400 )) if [ "$ImageAge" -gt "$DaysOld" ] ; then return 0 else @@ -180,7 +181,7 @@ IFS=',' read -r -a Excludes <<< "$Exclude" ; unset IFS binary_downloader() { BinaryName="$1" BinaryUrl="$2" - case "$(uname --machine)" in + case "$(uname -m)" in x86_64|amd64) architecture="amd64" ;; arm64|aarch64) architecture="arm64";; *) printf "\n%bArchitecture not supported, exiting.%b\n" "$c_red" "$c_reset" ; exit 1;;