From 77f024bb81a741fbc74638ab3e267b17ea8c5e72 Mon Sep 17 00:00:00 2001
From: vorezal <37914382+vorezal@users.noreply.github.com>
Date: Fri, 27 Jun 2025 03:10:31 -0400
Subject: [PATCH 01/37] Fix unbound variable, potential collision, and config
variable. (#209)
* Fix unbound variable, potential collision, and config variable.
* Return 0 when notification functions finish successfully
---------
Co-authored-by: Matthew Oleksowicz
---
notify_templates/notify_v2.sh | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/notify_templates/notify_v2.sh b/notify_templates/notify_v2.sh
index a34acfa..3329512 100644
--- a/notify_templates/notify_v2.sh
+++ b/notify_templates/notify_v2.sh
@@ -139,6 +139,8 @@ send_notification() {
fi
[[ -n "${snooze}" ]] && cleanup_snooze "${Updates[@]}"
+
+ return 0
}
### Set DISABLE_DOCKCHECK_NOTIFICATION=false in dockcheck.config
@@ -187,14 +189,17 @@ dockcheck_notification() {
fi
fi
fi
+
+ return 0
}
-### Set DISABLE_NOTIFY_UPDATE_NOTIFICATION=false in dockcheck.config
+### Set DISABLE_NOTIFY_NOTIFICATION=false in dockcheck.config
### to not send notifications when notify scripts themselves have updates.
notify_update_notification() {
- if [[ ! "${DISABLE_NOTIFY_UPDATE_NOTIFICATION:-}" == "true" ]]; then
+ if [[ ! "${DISABLE_NOTIFY_NOTIFICATION:-}" == "true" ]]; then
NotifyUpdateNotify=false
NotifyError=false
+ NotifyUpdates=()
UpdateChannels=( "${enabled_notify_channels[@]}" "v2" )
@@ -207,14 +212,14 @@ notify_update_notification() {
LatestNotifyRelease="$(echo "$LatestNotifySnippet" | sed -n "/${VersionVar}/s/${VersionVar}=//p" | tr -d '"')"
if [[ ! "${LatestNotifyRelease}" == "undefined" ]]; then
if [[ "${!VersionVar}" != "${LatestNotifyRelease}" ]] ; then
- Updates+=("${NotifyScript}.sh ${!VersionVar} -> ${LatestNotifyRelease}")
+ NotifyUpdates+=("${NotifyScript}.sh ${!VersionVar} -> ${LatestNotifyRelease}")
fi
fi
fi
done
if [[ -n "${snooze}" ]] && [[ -f "${SnoozeFile}" ]]; then
- for update in "${Updates[@]}"; do
+ for update in "${NotifyUpdates[@]}"; do
read -a NotifyScript <<< "${update}"
found=$(grep -w "${NotifyScript}" "${SnoozeFile}" || printf "")
if [[ -n "${found}" ]]; then
@@ -232,8 +237,8 @@ notify_update_notification() {
fi
if [[ "${NotifyUpdateNotify}" == "true" ]]; then
- if [[ "${#Updates[@]}" -gt 0 ]]; then
- UpdToString=$( printf '%s\\n' "${Updates[@]}" )
+ if [[ "${#NotifyUpdates[@]}" -gt 0 ]]; then
+ UpdToString=$( printf '%s\\n' "${NotifyUpdates[@]}" )
UpdToString=${UpdToString%\\n}
NotifyError=false
@@ -247,12 +252,14 @@ notify_update_notification() {
printf "Attempted to send notification to channel ${channel}, but the function was not found. Make sure notify_${channel}.sh is available in the ${ScriptWorkDir} directory or notify_templates subdirectory.\n"
done
- [[ -n "${snooze}" ]] && [[ "${NotifyError}" == "false" ]] && update_snooze "${Updates[@]}"
+ [[ -n "${snooze}" ]] && [[ "${NotifyError}" == "false" ]] && update_snooze "${NotifyUpdates[@]}"
fi
fi
- UpdatesPlusDockcheck=("${Updates[@]}")
+ UpdatesPlusDockcheck=("${NotifyUpdates[@]}")
UpdatesPlusDockcheck+=("dockcheck.sh")
[[ -n "${snooze}" ]] && cleanup_snooze "${UpdatesPlusDockcheck[@]}"
fi
+
+ return 0
}
From d37e1a102434b17ac9f0e5bcaee607839ecf2262 Mon Sep 17 00:00:00 2001
From: mag37
Date: Fri, 27 Jun 2025 09:22:10 +0200
Subject: [PATCH 02/37] Bugfixes for unbound variable, potential collision and
config variable mismatch
Version bump to alert users of the latest bugfixes for unbound variable, potential collision and config variable mismatch.
---
notify_templates/notify_v2.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/notify_templates/notify_v2.sh b/notify_templates/notify_v2.sh
index 3329512..c2d8538 100644
--- a/notify_templates/notify_v2.sh
+++ b/notify_templates/notify_v2.sh
@@ -1,4 +1,4 @@
-NOTIFY_V2_VERSION="v0.3"
+NOTIFY_V2_VERSION="v0.4"
#
# If migrating from an older notify template, remove your existing notify.sh file.
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
From 69c06de1bddf6ac9a691b476c80434ad6cad360a Mon Sep 17 00:00:00 2001
From: op4lat <155382511+op4lat@users.noreply.github.com>
Date: Tue, 1 Jul 2025 16:19:15 -0400
Subject: [PATCH 03/37] Add DisplaySourcedFiles variable (#207)
* Add DisplaySourcedFiles variable to be used in source_if_exists and source_if_exists_or_fail functions
* Added return 0 as to not throw wrong exit code.
* Delete source_if_exists. source_if_exists_or_fail returns success or failure. Failure doesn't stop the script
---------
Co-authored-by: Elephant Quater
Co-authored-by: mag37
---
default.config | 1 +
dockcheck.sh | 14 ++++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/default.config b/default.config
index 2831591..27bb52c 100644
--- a/default.config
+++ b/default.config
@@ -26,6 +26,7 @@
#CurlRetryDelay=1 # Time between curl retries
#CurlRetryCount=3 # Max number of curl retries
#CurlConnectTimeout=5 # Time to wait for curl to establish a connection before failing
+#DisplaySourcedFiles=false # Display what files are being sourced/used
### Notify settings
## All commented values are examples only. Modify as needed.
diff --git a/dockcheck.sh b/dockcheck.sh
index d341ce9..183027c 100755
--- a/dockcheck.sh
+++ b/dockcheck.sh
@@ -14,16 +14,18 @@ ScriptPath="$(readlink -f "$0")"
ScriptWorkDir="$(dirname "$ScriptPath")"
# Source helper functions
-source_if_exists() {
- if [[ -s "$1" ]]; then source "$1"; fi
-}
-
source_if_exists_or_fail() {
- [[ -s "$1" ]] && source "$1"
+ if [[ -s "$1" ]]; then
+ source "$1"
+ [[ "${DisplaySourcedFiles:-false}" == true ]] && echo " * sourced config: ${1}"
+ return 0
+ else
+ return 1
+ fi
}
# User customizable defaults
-source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists "${ScriptWorkDir}/dockcheck.config"
+source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists_or_fail "${ScriptWorkDir}/dockcheck.config"
# Help Function
Help() {
From a1e7446753d582aac1e41ddec23c960c08812bd0 Mon Sep 17 00:00:00 2001
From: mag37
Date: Tue, 1 Jul 2025 22:27:54 +0200
Subject: [PATCH 04/37] version bump + readme
---
README.md | 5 ++++-
dockcheck.sh | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 751e7b2..be80a36 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,9 @@
___
## :bell: Changelog
+- **v0.6.8**:
+ - Bugfix: Unbound variable in notify_v2.sh
+ - New option: "DisplaySourcedFiles" *config* added to list what files get sourced
- **v0.6.7**: Snooze feature, curl, and consolidation
- Added snooze feature to delay notifications
- Added configurable default curl arguments
@@ -168,7 +171,7 @@ copy it to `notify.sh` alongside the script, modify it to your needs! (notify.sh
#### Snooze feature:
**Use case:** You wish to be notified of available updates in a timely manner, but do not require reminders after the initial notification with the same frequency.
e.g. *Dockcheck is scheduled to run every hour. You will receive an update notification within an hour of availability.*
-**Snooze enabled:** you will not receive another notification about updates for this container for a configurable period of time.
+**Snooze enabled:** you will not receive another notification about updates for this container for a configurable period of time.
**Snooze disabled:** you will receive additional notifications every hour.
To enable snooze, uncomment the `SNOOZE_SECONDS` variable in your `dockcheck.config` file and set it to the number of seconds you wish to prevent duplicate alerts.
diff --git a/dockcheck.sh b/dockcheck.sh
index 183027c..dafa2ce 100755
--- a/dockcheck.sh
+++ b/dockcheck.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-VERSION="v0.6.7"
-# ChangeNotes: snooze feature (see readme), curl arguments, cleanup.
+VERSION="v0.6.8"
+# ChangeNotes: bugfix unbound variable in notify_v2, new option "DisplaySourcedFiles" added to config
Github="https://github.com/mag37/dockcheck"
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
From 98e996caa3cca8e2d048b672aa22f2d33ed90dbc Mon Sep 17 00:00:00 2001
From: mag37
Date: Mon, 7 Jul 2025 10:49:32 +0200
Subject: [PATCH 05/37] added paypay sponsor
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index be80a36..dfac061 100644
--- a/README.md
+++ b/README.md
@@ -5,9 +5,11 @@
+
+
CLI tool to automate docker image updates or notifying when updates are available.
From e2dbd69c5e428b94b1b7966b257f304a890e87e1 Mon Sep 17 00:00:00 2001
From: Rasmus Lundsgaard
Date: Mon, 14 Jul 2025 13:59:07 +0200
Subject: [PATCH 06/37] first version of notification to Home Assistant (#213)
* first working version of notification to Home Assistant
* add documentation links
* update readme for notify_HA
---
README.md | 2 ++
default.config | 7 ++++++-
notify_templates/notify_HA.sh | 31 +++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100755 notify_templates/notify_HA.sh
diff --git a/README.md b/README.md
index dfac061..6fec3fc 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,7 @@ Make certain your project directory is laid out as below. You only need the noti
│ ├── notify_discord.sh
│ ├── notify_generic.sh
│ ├── notify_gotify.sh
+│ ├── notify_HA.sh
│ ├── notify_matrix.sh
│ ├── notify_ntfy.sh
│ ├── notify_pushbullet.sh
@@ -190,6 +191,7 @@ If an update becomes available for an item that is not snoozed, notifications wi
- Read the [QuickStart](extras/apprise_quickstart.md)
- [ntfy](https://ntfy.sh/) - HTTP-based pub-sub notifications.
- [Gotify](https://gotify.net/) - a simple server for sending and receiving messages.
+- [Home Assistant](https://www.home-assistant.io/integrations/notify/) - Connection to the notify [integrations](https://www.home-assistant.io/integrations/#notifications).
- [Pushbullet](https://www.pushbullet.com/) - connecting different devices with cross-platform features.
- [Telegram](https://telegram.org/) - Telegram chat API.
- [Matrix-Synapse](https://github.com/element-hq/synapse) - [Matrix](https://matrix.org/), open, secure, decentralised communication.
diff --git a/default.config b/default.config
index 27bb52c..49457f0 100644
--- a/default.config
+++ b/default.config
@@ -32,7 +32,7 @@
## All commented values are examples only. Modify as needed.
##
## Uncomment the line below and specify the notification channels you wish to enable in a space separated string
-# NOTIFY_CHANNELS="apprise discord DSM generic gotify matrix ntfy pushbullet pushover slack smtp telegram"
+# NOTIFY_CHANNELS="apprise discord DSM generic HA gotify matrix ntfy pushbullet pushover slack smtp telegram"
#
## Uncomment the line below and specify the number of seconds to delay notifications to enable snooze
# SNOOZE_SECONDS=86400
@@ -57,6 +57,10 @@
# GOTIFY_DOMAIN="https://gotify.domain.tld"
# GOTIFY_TOKEN="token-value"
#
+# HA_ENTITY="entity"
+# HA_TOKEN="token"
+# HA_URL="https://your.homeassistant.url"
+#
# MATRIX_ACCESS_TOKEN="token-value"
# MATRIX_ROOM_ID="myroom"
# MATRIX_SERVER_URL="https://matrix.yourdomain.tld"
@@ -82,3 +86,4 @@
# TELEGRAM_CHAT_ID="mychatid"
# TELEGRAM_TOKEN="token-value"
# TELEGRAM_TOPIC_ID="0"
+
diff --git a/notify_templates/notify_HA.sh b/notify_templates/notify_HA.sh
new file mode 100755
index 0000000..dda74be
--- /dev/null
+++ b/notify_templates/notify_HA.sh
@@ -0,0 +1,31 @@
+### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
+NOTIFY_HA_VERSION="v0.1"
+#
+# This is an integration that makes it possible to send notifications via Home Assistant (https://www.home-assistant.io/integrations/notify/)
+# You need to generate a long-lived access token in Home Sssistant to be used here (https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token)
+# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
+# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
+# Do not modify this file directly within the "notify_templates" subdirectory. Set HA_ENTITY, HA_URL and HA_TOKEN in your dockcheck.config file.
+
+if [[ -z "${HA_ENTITY:-}" ]] || [[ -z "${HA_URL:-}" ]] || [[ -z "${HA_TOKEN:-}" ]]; then
+ printf "Home Assistant notification channel enabled, but required configuration variables are missing. Home assistant notifications will not be sent.\n"
+
+ remove_channel HA
+fi
+
+trigger_HA_notification() {
+ AccessToken="${HA_TOKEN}"
+ Url="${HA_URL}/api/services/notify/${HA_ENTITY}"
+ JsonData=$( "$jqbin" -n \
+ --arg body "$MessageBody" \
+ '{"title": "dockcheck update", "message": $body}' )
+
+ curl -S -o /dev/null ${CurlArgs} \
+ -H "Authorization: Bearer $AccessToken" \
+ -H "Content-Type: application/json" \
+ -d "$JsonData" -X POST $Url
+
+ if [[ $? -gt 0 ]]; then
+ NotifyError=true
+ fi
+}
From cfa74adc3db524e4e89b5dcfb562f8d0d666d4fa Mon Sep 17 00:00:00 2001
From: mag37
Date: Sat, 19 Jul 2025 00:40:50 +0200
Subject: [PATCH 07/37] added new logo
---
extras/dockcheck_colour.png | Bin 0 -> 147760 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 extras/dockcheck_colour.png
diff --git a/extras/dockcheck_colour.png b/extras/dockcheck_colour.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ae6f8f14c0ce2c007c4756d896e0d0c72a59f8d
GIT binary patch
literal 147760
zcmeFZXH=9~(>99ZC^H5SL6GdgC;|c^NND0HK|w)4K*@p%l0%b2<1i{2QGy~3DmGC-
zBxjK*AUR2fCP=2qxliq8p6B~cSnK>b|IXWMG4wR|z3;tiS6y}0Rl5zirKWuR2+I*F
zDyrkxuPJC!QBnVfettU)pPYXg`4oQrZh!5r6BQNvGxT#HY@GA}K4iu!-oa|wJ;b`+
zb9_MM>gp=^$kxiq?4JDtK|4qDH}ldgR8(iEt}Fa?+bwo>VAH98-FtG=mD57hx90c>
zs^15HrPcVLpc3^!-(|EfeDwMQzL!6~%{FD~=jP^;zwR8`HnzS=`26PeeV3E9#6MkJ
zysm$KfM>W)I``L!KM$N(A1IY;d6#~N`p_>MZ@0JIZfDh5R*Y$#O-pSR@|GPkNY^US
zIRJnD@{IYn1HO&P<7wOP8Oc`DG`=48Z$YZ{B
zgB^Z7e?Z-QtU4fbHq2nK^F4fEO^YJmI^l{irvUzYtLCFnO;zETdRkmWeYJ({Ga6~TTiyItSw$rrX$|meWpOfhJoiqFe!%!<=bc!?
z(D5go$=X(ZyZH?~7PkD=*+Y^iy|*!1NoWqj$oG5h-yAp1S