mirror of
https://github.com/mag37/dockcheck.git
synced 2026-03-12 20:02:46 +01:00
commit
8b40dce2cd
6 changed files with 34 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,5 @@
|
||||||
# ignore users custom notify.sh
|
# ignore users custom notify.sh
|
||||||
/notify.sh
|
/notify.sh
|
||||||
|
/urls.list
|
||||||
# ignore the auto-installed regctl
|
# ignore the auto-installed regctl
|
||||||
regctl
|
regctl
|
||||||
|
|
|
||||||
14
README.md
14
README.md
|
|
@ -17,6 +17,7 @@
|
||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
|
||||||
|
- **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)
|
||||||
- **v0.4.8**: Rewrote prune logic to not prompt with options `-a|-y` or `-n`. Auto prune with `-p`.
|
- **v0.4.8**: Rewrote prune logic to not prompt with options `-a|-y` or `-n`. Auto prune with `-p`.
|
||||||
- **v0.4.7**: Notification Template changes to gotify(new!), DSM(improved), SMTP(deprecation alternative).
|
- **v0.4.7**: Notification Template changes to gotify(new!), DSM(improved), SMTP(deprecation alternative).
|
||||||
- **v0.4.6**: Compatibility changes to timeout, due to busybox.
|
- **v0.4.6**: Compatibility changes to timeout, due to busybox.
|
||||||
|
|
@ -114,6 +115,19 @@ Use a `notify_X.sh` template file from the **notify_templates** directory, copy
|
||||||
Further additions are welcome - suggestions or PR!
|
Further additions are welcome - suggestions or PR!
|
||||||
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>
|
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>
|
||||||
|
|
||||||
|
### :date: Release notes addon to Notifications
|
||||||
|
There's a function to use a lookup-file to add release note URL's to the notification message.
|
||||||
|
Copy the notify_templates/`urls.list` file to the script directory and modify it as necessary, it will be used automatically if it's there.
|
||||||
|
The output of the notification will look something like this:
|
||||||
|
```
|
||||||
|
Containers on hostname with updates available:
|
||||||
|
apprise-api -> https://github.com/linuxserver/docker-apprise-api/releases
|
||||||
|
homer -> https://github.com/bastienwirtz/homer/releases
|
||||||
|
nginx -> https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||||
|
...
|
||||||
|
```
|
||||||
|
The `urls.list` file is just an example and I'd gladly see that people contribute back when they add their preferred URLs to their lists.
|
||||||
|
|
||||||
## :bookmark: Labels
|
## :bookmark: Labels
|
||||||
Optionally add labels to compose-files. Currently these are the usable labels:
|
Optionally add labels to compose-files. Currently these are the usable labels:
|
||||||
```
|
```
|
||||||
|
|
|
||||||
17
dockcheck.sh
17
dockcheck.sh
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.4.8"
|
VERSION="v0.4.9"
|
||||||
### ChangeNotes: Rewrote prune to not prompt (default no) if -a|-y or -n flags are used. -p will still autoprune.
|
### ChangeNotes: Added a function to enrich the notify-message with release note URLs. See README.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
|
|
@ -13,7 +13,6 @@ ScriptWorkDir="$(dirname "$ScriptPath")"
|
||||||
LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
|
LatestRelease="$(curl -s -r 0-50 $RawUrl | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
|
||||||
LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")"
|
LatestChanges="$(curl -s -r 0-200 $RawUrl | sed -n "/ChangeNotes/s/### ChangeNotes: //p")"
|
||||||
|
|
||||||
|
|
||||||
### Help Function:
|
### Help Function:
|
||||||
Help() {
|
Help() {
|
||||||
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
||||||
|
|
@ -148,6 +147,17 @@ progress_bar() {
|
||||||
[[ "$QueTotal" == "$QueCurrent" ]] && printf "\r[%b%s%b] %s/%s \n" "$c_teal" "$BarComplete" "$c_reset" "$QueCurrent" "$QueTotal"
|
[[ "$QueTotal" == "$QueCurrent" ]] && printf "\r[%b%s%b] %s/%s \n" "$c_teal" "$BarComplete" "$c_reset" "$QueCurrent" "$QueTotal"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Function to add user-provided urls to releasenotes
|
||||||
|
releasenotes() {
|
||||||
|
for update in ${Updates[@]}; do
|
||||||
|
found=false
|
||||||
|
while read -r container url; do
|
||||||
|
[[ $update == $container ]] && printf "%s -> %s\n" "$update" "$url" && found=true
|
||||||
|
done < "$ScriptWorkDir"/urls.list
|
||||||
|
[[ $found == false ]] && printf "%s -> url missing\n" "$update" || continue
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
### Version check & initiate self update
|
### Version check & initiate self update
|
||||||
if [[ "$VERSION" != "$LatestRelease" ]] ; then
|
if [[ "$VERSION" != "$LatestRelease" ]] ; then
|
||||||
printf "New version available! %b%s%b ⇒ %b%s%b \n Change Notes: %s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges"
|
printf "New version available! %b%s%b ⇒ %b%s%b \n Change Notes: %s \n" "$c_yellow" "$VERSION" "$c_reset" "$c_green" "$LatestRelease" "$c_reset" "$LatestChanges"
|
||||||
|
|
@ -261,7 +271,6 @@ NoUpdates=($(sort <<<"${NoUpdates[*]}"))
|
||||||
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
GotUpdates=($(sort <<<"${GotUpdates[*]}"))
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
|
|
||||||
### Define how many updates are available
|
### Define how many updates are available
|
||||||
UpdCount="${#GotUpdates[@]}"
|
UpdCount="${#GotUpdates[@]}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
send_notification() {
|
send_notification() {
|
||||||
Updates=("$@")
|
Updates=("$@")
|
||||||
UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
[ -s "$ScriptWorkDir"/urls.list ] && UpdToString=$( releasenotes ) || UpdToString=$( printf "%s\n" "${Updates[@]}" )
|
||||||
FromHost=$(hostname)
|
FromHost=$(hostname)
|
||||||
|
|
||||||
# platform specific notification code would go here
|
# platform specific notification code would go here
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
### Snippet to use together with notify.sh
|
|
||||||
#
|
|
||||||
# Requires a space-separated list-file of container-name and release-note-url, modify the example file "urls.list"
|
|
||||||
# Copy urls.list and releasenotes.sh to the same directory as dockcheck.sh.
|
|
||||||
#
|
|
||||||
# Add the next line (uncommented) to any notification script you're using, after the "UpdToString"-variable setup
|
|
||||||
# [ -s "$ScriptWorkDir"/releasenotes.sh ] && { source "$ScriptWorkDir"/releasenotes.sh ; UpdToString=$( releasenotes ) ; }
|
|
||||||
|
|
||||||
releasenotes() {
|
|
||||||
for update in ${Updates[@]}; do
|
|
||||||
found=false
|
|
||||||
while read -r container url; do
|
|
||||||
[[ $update == $container ]] && printf "%s -> %s\n" "$update" "$url" && found=true
|
|
||||||
done < "$ScriptWorkDir"/urls.list
|
|
||||||
[[ $found == false ]] && printf "%s\n" "$update"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
# This is a list of container names and releasenote urls, separated by space.
|
||||||
|
# Modify, add and (if necessary) remove to fit your needs.
|
||||||
|
# Additions are welcome! Append your list to the git-repo, use generic names and sensible urls.
|
||||||
|
|
||||||
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
||||||
homer https://github.com/bastienwirtz/homer/releases
|
homer https://github.com/bastienwirtz/homer/releases
|
||||||
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||||
|
vaultwarden-server https://github.com/dani-garcia/vaultwarden/releases
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue