From d4d89c305c9c8c2de871db2775919b239851c388 Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 21:39:29 +0100 Subject: [PATCH 01/12] 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;; From 73050abf10fbb880c5f6f184627b74e25e84f2bc Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 22:18:08 +0100 Subject: [PATCH 02/12] rewrote regctl download --- dockcheck.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index 100e466..400f64b 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -196,9 +196,10 @@ binary_downloader() { distro_checker() { if [[ -f /etc/arch-release ]] ; then PkgInstaller="pacman -S" - elif [[ -f /etc/redhat-release ]] ; then PkgInstaller="dnf install" - elif [[ -f /etc/SuSE-release ]] ; then PkgInstaller="zypper install" - elif [[ -f /etc/debian_version ]] ; then PkgInstaller="apt-get install" + elif [[ -f /etc/redhat-release ]] ; then PkgInstaller="sudo dnf install" + elif [[ -f /etc/SuSE-release ]] ; then PkgInstaller="sudo zypper install" + elif [[ -f /etc/debian_version ]] ; then PkgInstaller="sudo apt-get install" + elif [[ $(uname -s) == "Darwin" ]] ; then PkgInstaller="brew install" else PkgInstaller="ERROR" ; printf "\n%bNo distribution could be determined%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi } @@ -213,10 +214,10 @@ else if [[ "$GetJq" =~ [yYsS] ]] ; then [[ "$GetJq" =~ [yY] ]] && distro_checker if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then - (sudo $PkgInstaller jq) ; PkgExitcode="$?" + ($PkgInstaller jq) ; PkgExitcode="$?" [[ "$PkgExitcode" == 0 ]] && jqbin="jq" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi - if [[ "$GetJq" =~ [nN] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then + if [[ "$GetJq" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP" [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" fi @@ -232,8 +233,18 @@ elif [[ -f "$ScriptWorkDir/regctl" ]]; then regbin="$ScriptWorkDir/regctl" ; else read -r -p "Required dependency 'regctl' missing, do you want it downloaded? y/[n] " GetRegctl if [[ "$GetRegctl" =~ [yY] ]] ; then - binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" - [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" + if [[ $(uname -s) == "Darwin" ]]; then + echo "Detected macOS, Installing regclient using Homebrew." + distro_checker + if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then + ($PkgInstaller regclient) ; PkgExitcode="$?" + [[ "$PkgExitcode" == 0 ]] && regbin="regclient" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" + fi + else + GetRegctl="S" + if [[ "$GetRegct" =~ [Ss] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then + binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" + [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi fi From 6cba140522f39a4ea1aa8ffdd4ceda98913d7fad Mon Sep 17 00:00:00 2001 From: mag37 Date: Thu, 13 Feb 2025 22:21:53 +0100 Subject: [PATCH 03/12] too tired.. forgot fi's --- dockcheck.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockcheck.sh b/dockcheck.sh index 400f64b..5b998c9 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -242,9 +242,11 @@ else fi else GetRegctl="S" + fi if [[ "$GetRegct" =~ [Ss] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" + fi else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi fi From 6bc896b1931ab326ed6a4b6a21a42edf4b67efb3 Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 14 Feb 2025 13:01:23 +0100 Subject: [PATCH 04/12] typo --- dockcheck.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index 5b998c9..bd563b6 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -153,7 +153,7 @@ progress_bar() { } # Function to add user-provided urls to releasenotes -releasenotes() { +releasenotes() { for update in ${GotUpdates[@]}; do found=false while read -r container url; do @@ -187,8 +187,8 @@ binary_downloader() { *) printf "\n%bArchitecture not supported, exiting.%b\n" "$c_red" "$c_reset" ; exit 1;; esac GetUrl="${BinaryUrl/TEMP/"$architecture"}" - if [[ $(command -v curl) ]]; then curl -L $GetUrl > "$ScriptWorkDir/$BinaryName" ; - elif [[ $(command -v wget) ]]; then wget $GetUrl -O "$ScriptWorkDir/$BinaryName" ; + if [[ $(command -v curl) ]]; then curl -L $GetUrl > "$ScriptWorkDir/$BinaryName" ; + elif [[ $(command -v wget) ]]; then wget $GetUrl -O "$ScriptWorkDir/$BinaryName" ; else printf "%s\n" "curl/wget not available - get $BinaryName manually from the repo link, exiting."; exit 1; fi [[ -f "$ScriptWorkDir/$BinaryName" ]] && chmod +x "$ScriptWorkDir/$BinaryName" @@ -213,13 +213,13 @@ else GetJq=${GetJq:-no} # set default to no if nothing is given if [[ "$GetJq" =~ [yYsS] ]] ; then [[ "$GetJq" =~ [yY] ]] && distro_checker - if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then + if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then ($PkgInstaller jq) ; PkgExitcode="$?" [[ "$PkgExitcode" == 0 ]] && jqbin="jq" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi if [[ "$GetJq" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP" - [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" + [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" fi else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi @@ -233,19 +233,19 @@ elif [[ -f "$ScriptWorkDir/regctl" ]]; then regbin="$ScriptWorkDir/regctl" ; else read -r -p "Required dependency 'regctl' missing, do you want it downloaded? y/[n] " GetRegctl if [[ "$GetRegctl" =~ [yY] ]] ; then - if [[ $(uname -s) == "Darwin" ]]; then + if [[ $(uname -s) == "Darwin" ]]; then echo "Detected macOS, Installing regclient using Homebrew." distro_checker - if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then + if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then ($PkgInstaller regclient) ; PkgExitcode="$?" [[ "$PkgExitcode" == 0 ]] && regbin="regclient" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi else GetRegctl="S" fi - if [[ "$GetRegct" =~ [Ss] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then + if [[ "$GetRegctl" =~ [Ss] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" - [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" + [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" fi else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; fi From e68adb34d0e177dac7771c1dd7ee9b7ae6fc84e5 Mon Sep 17 00:00:00 2001 From: mag37 Date: Sat, 15 Feb 2025 13:23:42 +0100 Subject: [PATCH 05/12] added info about macos osx --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4360c0..63607aa 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,8 @@ ___ - regctl requires `amd64/arm64` - see [workaround](#roller_coaster-workaround-for-non-amd64--arm64) if other architecture is used. ## :tent: Install Instructions -Download the script to a directory in **PATH**, I'd suggest using `~/.local/bin` as that's usually in **PATH**. +Download the script to a directory in **PATH**, I'd suggest using `~/.local/bin` as that's usually in **PATH**. +For OSX/macOS preferably use `/usr/local/bin`. ```sh # basic example with curl: curl -L https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh -o ~/.local/bin/dockcheck.sh @@ -98,6 +99,9 @@ chmod +x ~/.local/bin/dockcheck.sh # or oneliner with wget: wget -O ~/.local/bin/dockcheck.sh "https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh" && chmod +x ~/.local/bin/dockcheck.sh + +# OSX or macOS version with curl: + curl -L https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh -o /usr/local/bin/dockcheck.sh && chmod +x /usr/local/bin/dockcheck.sh ``` Then call the script anywhere with just `dockcheck.sh`. Add preferred `notify.sh`-template to the same directory - this will not be touched by the scripts self-update function. From 27896c18ba7b8fdb1f1276390afe5746a377de97 Mon Sep 17 00:00:00 2001 From: mag37 Date: Mon, 17 Feb 2025 22:23:10 +0100 Subject: [PATCH 06/12] squashed multiple dependency downloaders to one function --- dockcheck.sh | 81 ++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 47 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index bd563b6..3ef134a 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -204,54 +204,41 @@ distro_checker() { fi } -# Dependency check for jq in PATH or directory -if [[ $(command -v jq) ]]; then jqbin="jq" ; -elif [[ -f "$ScriptWorkDir/jq" ]]; then jqbin="$ScriptWorkDir/jq" ; -else - printf "%s\n" "Required dependency 'jq' missing, do you want to install it?" - read -r -p "y: With packagemanager (sudo). / s: Download static binary. y/s/[n] " GetJq - GetJq=${GetJq:-no} # set default to no if nothing is given - if [[ "$GetJq" =~ [yYsS] ]] ; then - [[ "$GetJq" =~ [yY] ]] && distro_checker - if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then - ($PkgInstaller jq) ; PkgExitcode="$?" - [[ "$PkgExitcode" == 0 ]] && jqbin="jq" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" - fi - if [[ "$GetJq" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then - binary_downloader "jq" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP" - [[ -f "$ScriptWorkDir/jq" ]] && jqbin="$ScriptWorkDir/jq" - fi - else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; - fi -fi -# Final check if binary is correct -$jqbin --version &> /dev/null || { printf "%s\n" "jq is not working - try to remove it and re-download it, exiting."; exit 1; } +# Dependency check + installer function +dependency_check() { + AppName="$1" + AppVar="$2" + AppUrl="$3" + if [[ $(command -v $AppName) ]]; then export $AppVar="$AppName" ; + elif [[ -f "$ScriptWorkDir/$AppName" ]]; then export $AppVar="$ScriptWorkDir/$AppName" ; + else +   printf "%s\n" "Required dependency '$AppName' missing, do you want to install it?" +   read -r -p "y: With packagemanager (sudo). / s: Download static binary. y/s/[n] " GetBin +   GetBin=${GetBin:-no} # set default to no if nothing is given +   if [[ "$GetBin" =~ [yYsS] ]] ; then +     [[ "$GetBin" =~ [yY] ]] && distro_checker +     if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then +       [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName=regclient +       ($PkgInstaller $AppName) ; PkgExitcode="$?" +       if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; }   +   else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" +       fi +     fi +     if [[ "$GetBin" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then +         binary_downloader "$AppName" "$AppUrl" +         [[ -f "$ScriptWorkDir/$AppName" ]] && { export $AppVar="$ScriptWorkDir/$1" && printf "\n%b$AppName downloaded.%b\n" "$c_green" "$c_reset"; } +     fi +   else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; +   fi + fi + # Final check if binary is correct + [[ "$1" == "jq" ]] && VerFlag="--version" + [[ "$1" == "regctl" ]] && VerFlag="version" + ${!AppVar} $VerFlag &> /dev/null  || { printf "%s\n" "$AppName is not working - try to remove it and re-download it, exiting."; exit 1; } +} -# Dependency check for regctl in PATH or directory -if [[ $(command -v regctl) ]]; then regbin="regctl" ; -elif [[ -f "$ScriptWorkDir/regctl" ]]; then regbin="$ScriptWorkDir/regctl" ; -else - read -r -p "Required dependency 'regctl' missing, do you want it downloaded? y/[n] " GetRegctl - if [[ "$GetRegctl" =~ [yY] ]] ; then - if [[ $(uname -s) == "Darwin" ]]; then - echo "Detected macOS, Installing regclient using Homebrew." - distro_checker - if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then - ($PkgInstaller regclient) ; PkgExitcode="$?" - [[ "$PkgExitcode" == 0 ]] && regbin="regclient" || printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" - fi - else - GetRegctl="S" - fi - if [[ "$GetRegctl" =~ [Ss] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then - binary_downloader "regctl" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" - [[ -f "$ScriptWorkDir/regctl" ]] && regbin="$ScriptWorkDir/regctl" - fi - else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; - fi -fi -# Final check if binary is correct -$regbin version &> /dev/null || { printf "%s\n" "regctl is not working - try to remove it and re-download it, exiting."; exit 1; } +dependency_check "regctl" "regbin" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" +dependency_check "jq" "jqbin" "https://github.com/jqlang/jq/releases/latest/download/jq-linux-TEMP" # Check docker compose binary if docker compose version &> /dev/null ; then DockerBin="docker compose" ; From b9188443360b726ee5a29d6dd82f9d2831caaf5d Mon Sep 17 00:00:00 2001 From: mag37 Date: Mon, 17 Feb 2025 22:38:14 +0100 Subject: [PATCH 07/12] reformatting --- dockcheck.sh | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index 3ef134a..0e199cd 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -206,35 +206,35 @@ distro_checker() { # Dependency check + installer function dependency_check() { - AppName="$1" - AppVar="$2" - AppUrl="$3" - if [[ $(command -v $AppName) ]]; then export $AppVar="$AppName" ; - elif [[ -f "$ScriptWorkDir/$AppName" ]]; then export $AppVar="$ScriptWorkDir/$AppName" ; - else -   printf "%s\n" "Required dependency '$AppName' missing, do you want to install it?" -   read -r -p "y: With packagemanager (sudo). / s: Download static binary. y/s/[n] " GetBin -   GetBin=${GetBin:-no} # set default to no if nothing is given -   if [[ "$GetBin" =~ [yYsS] ]] ; then -     [[ "$GetBin" =~ [yY] ]] && distro_checker -     if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then -       [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName=regclient -       ($PkgInstaller $AppName) ; PkgExitcode="$?" -       if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; }   -   else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" -       fi -     fi -     if [[ "$GetBin" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then -         binary_downloader "$AppName" "$AppUrl" -         [[ -f "$ScriptWorkDir/$AppName" ]] && { export $AppVar="$ScriptWorkDir/$1" && printf "\n%b$AppName downloaded.%b\n" "$c_green" "$c_reset"; } -     fi -   else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; -   fi - fi - # Final check if binary is correct - [[ "$1" == "jq" ]] && VerFlag="--version" - [[ "$1" == "regctl" ]] && VerFlag="version" - ${!AppVar} $VerFlag &> /dev/null  || { printf "%s\n" "$AppName is not working - try to remove it and re-download it, exiting."; exit 1; } + AppName="$1" + AppVar="$2" + AppUrl="$3" + if [[ $(command -v $AppName) ]]; then export $AppVar="$AppName" ; + elif [[ -f "$ScriptWorkDir/$AppName" ]]; then export $AppVar="$ScriptWorkDir/$AppName" ; + else + printf "%s\n" "Required dependency '$AppName' missing, do you want to install it?" + read -r -p "y: With packagemanager (sudo). / s: Download static binary. y/s/[n] " GetBin + GetBin=${GetBin:-no} # set default to no if nothing is given + if [[ "$GetBin" =~ [yYsS] ]] ; then + [[ "$GetBin" =~ [yY] ]] && distro_checker + if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then + [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName=regclient + ($PkgInstaller $AppName) ; PkgExitcode="$?" + if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; } + else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" + fi + fi + if [[ "$GetBin" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then + binary_downloader "$AppName" "$AppUrl" + [[ -f "$ScriptWorkDir/$AppName" ]] && { export $AppVar="$ScriptWorkDir/$1" && printf "\n%b$AppName downloaded.%b\n" "$c_green" "$c_reset"; } + fi + else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset" ; exit 1 ; + fi + fi + # Final check if binary is correct + [[ "$1" == "jq" ]] && VerFlag="--version" + [[ "$1" == "regctl" ]] && VerFlag="version" + ${!AppVar} $VerFlag &> /dev/null || { printf "%s\n" "$AppName is not working - try to remove it and re-download it, exiting."; exit 1; } } dependency_check "regctl" "regbin" "https://github.com/regclient/regclient/releases/latest/download/regctl-linux-TEMP" From 41029f628d5fd0e2c6315c613663e3dc9a6878f1 Mon Sep 17 00:00:00 2001 From: mag37 Date: Tue, 18 Feb 2025 07:59:11 +0100 Subject: [PATCH 08/12] Update dockcheck.sh indentation error. --- dockcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockcheck.sh b/dockcheck.sh index 0e199cd..6c4ad35 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -221,7 +221,7 @@ dependency_check() { [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName=regclient ($PkgInstaller $AppName) ; PkgExitcode="$?" if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; } - else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" + else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi fi if [[ "$GetBin" =~ [sS] || "$PkgInstaller" == "ERROR" || "$PkgExitcode" != 0 ]] ; then From 76e6a5c38b49c97479a72b449d41730b0e22a514 Mon Sep 17 00:00:00 2001 From: mag37 Date: Tue, 18 Feb 2025 08:15:52 +0100 Subject: [PATCH 09/12] Update dockcheck.sh typo --- dockcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockcheck.sh b/dockcheck.sh index 6c4ad35..8d7949e 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -218,7 +218,7 @@ dependency_check() { if [[ "$GetBin" =~ [yYsS] ]] ; then [[ "$GetBin" =~ [yY] ]] && distro_checker if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then - [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName=regclient + [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName="regclient" ($PkgInstaller $AppName) ; PkgExitcode="$?" if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; } else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" From 78a7e1137fd569b33c588a5c5e5c52bce6f2ec88 Mon Sep 17 00:00:00 2001 From: mag37 Date: Tue, 18 Feb 2025 10:07:21 +0100 Subject: [PATCH 10/12] OSX appname return --- dockcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockcheck.sh b/dockcheck.sh index 8d7949e..e27f12d 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -219,7 +219,7 @@ dependency_check() { [[ "$GetBin" =~ [yY] ]] && distro_checker if [[ -n "$PkgInstaller" && "$PkgInstaller" != "ERROR" ]] ; then [[ $(uname -s) == "Darwin" && "$AppName" == "regctl" ]] && AppName="regclient" - ($PkgInstaller $AppName) ; PkgExitcode="$?" + ($PkgInstaller $AppName) ; PkgExitcode="$?" && AppName="$1" if [[ "$PkgExitcode" == 0 ]] ; then { export $AppVar="$AppName" && printf "\n%b$AppName installed.%b\n" "$c_green" "$c_reset"; } else printf "\n%bPackagemanager install failed%b, falling back to static binary.\n" "$c_yellow" "$c_reset" fi From 3655f5ae8a002fd6068ebbe655f303e8c54dcd9a Mon Sep 17 00:00:00 2001 From: mag37 Date: Wed, 19 Feb 2025 13:36:30 +0100 Subject: [PATCH 11/12] version bump --- README.md | 8 +------- dockcheck.sh | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 63607aa..9a716f7 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,11 @@ ___ ## :bell: Changelog +- **v0.5.5.0**: osx and bsd compatibility changes + rewrite of dependency installer - **v0.5.4.0**: Added support for a Prometheus+node_exporter metric collection through a file collector. - **v0.5.3.0**: Local image check changed (use imageId instead of name) and Gotify-template fixed (whale icon removed). - **v0.5.2.1**: Rewrite of dependency downloads, jq can be installed with package manager or static binary. - **v0.5.1**: DEPENDENCY WARNING: now requires **jq**. + Upstreaming changes from [sudo-kraken/podcheck](https://github.com/sudo-kraken/podcheck) -- **v0.5.0**: Rewritten notify logic - all templates are adjusted and should be migrated! - - Copy the custom settings from your current template to the new version of the same template. - - Look into, copy and customize the `urls.list` file if that's of interest. - - Other changes: - - Added Discord notify template. - - Verbosity changed of `regctl`. -- **v0.4.9**: Added a function to enrich the notify-message with release note URLs. See [Release notes addon](https://github.com/mag37/dockcheck#date-release-notes-addon-to-notifications) ___ diff --git a/dockcheck.sh b/dockcheck.sh index e27f12d..8f320aa 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="v0.5.4.0" -### ChangeNotes: Added support for a Prometheus+node_exporter metric collection through a file collector. +VERSION="v0.5.5.0" +### ChangeNotes: osx and bsd compatibility changes + rewrite of dependency installer Github="https://github.com/mag37/dockcheck" RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh" From 65e875e8604ab9d46cefbb39620201b63bd5ee5c Mon Sep 17 00:00:00 2001 From: mag37 Date: Wed, 19 Feb 2025 20:26:54 +0100 Subject: [PATCH 12/12] fixed typo --- dockcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockcheck.sh b/dockcheck.sh index 8f320aa..365d7cb 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -316,7 +316,7 @@ unset IFS # Run the prometheus exporter function if [ -n "$CollectorTextFileDirectory" ] ; then - source "$ScriptWorkDir"/addons/prometheus/prometheus_collector.sh && prometheus_exporter ${#NoUpdates[@]} ${#GotUpdates[@]} ${#GotError[@]} + source "$ScriptWorkDir"/addons/prometheus/prometheus_collector.sh && prometheus_exporter ${#NoUpdates[@]} ${#GotUpdates[@]} ${#GotErrors[@]} fi # Define how many updates are available