mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-23 12:51:10 +00:00
Add flag/option to hide the "No Updates availabe" message and only show updateable images (#280)
* Add flag to hide the "No Updates availabe" message and only show updateable images * Add option to hide the "No Updates available" message and only show updateable images * Fix some logic
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#MaxAsync=10 # Set max asynchronous subprocesses, 1 default, 0 to disable.
|
#MaxAsync=10 # Set max asynchronous subprocesses, 1 default, 0 to disable.
|
||||||
#MonoMode=true # Monochrome mode, no printf colour codes and hides progress bar.
|
#MonoMode=true # Monochrome mode, no printf colour codes and hides progress bar.
|
||||||
#Notify=true # Inform - send a preconfigured notification.
|
#Notify=true # Inform - send a preconfigured notification.
|
||||||
|
#OnlyShowUpdateable=true # Hides the "No updates available" message and only shows updateable images
|
||||||
#OnlyLabel=true # Only update if label is set. See readme.
|
#OnlyLabel=true # Only update if label is set. See readme.
|
||||||
#OnlySpecific=true # Only compose up the specific container, not the whole compose. (useful for master-compose structure).
|
#OnlySpecific=true # Only compose up the specific container, not the whole compose. (useful for master-compose structure).
|
||||||
#PrintMarkdownURL=true # Prints custom releasenote urls as markdown
|
#PrintMarkdownURL=true # Prints custom releasenote urls as markdown
|
||||||
|
|||||||
+7
-2
@@ -48,6 +48,7 @@ Help() {
|
|||||||
echo "-m Monochrome mode, no printf colour codes and hides progress bar."
|
echo "-m Monochrome mode, no printf colour codes and hides progress bar."
|
||||||
echo "-M Prints custom releasenote urls as markdown (requires template support)."
|
echo "-M Prints custom releasenote urls as markdown (requires template support)."
|
||||||
echo "-n No updates; only checking availability without interaction."
|
echo "-n No updates; only checking availability without interaction."
|
||||||
|
echo "-o Hides the \"No updates available\" message" and only shows updateable images
|
||||||
echo "-p Auto-prune dangling images after update. Ignored when -b is used."
|
echo "-p Auto-prune dangling images after update. Ignored when -b is used."
|
||||||
echo "-r Allow checking/updating images created by 'docker run', containers need to be recreated manually."
|
echo "-r Allow checking/updating images created by 'docker run', containers need to be recreated manually."
|
||||||
echo "-R Skip container recreation after pulling images."
|
echo "-R Skip container recreation after pulling images."
|
||||||
@@ -86,6 +87,7 @@ CollectorTextFileDirectory=${CollectorTextFileDirectory:-}
|
|||||||
Exclude=${Exclude:-}
|
Exclude=${Exclude:-}
|
||||||
DaysOld=${DaysOld:-}
|
DaysOld=${DaysOld:-}
|
||||||
BackupForDays=${BackupForDays:-}
|
BackupForDays=${BackupForDays:-}
|
||||||
|
OnlyShowUpdateable=${OnlyShowUpdateable:-false}
|
||||||
OnlySpecific=${OnlySpecific:-false}
|
OnlySpecific=${OnlySpecific:-false}
|
||||||
SpecificContainer=${SpecificContainer:-""}
|
SpecificContainer=${SpecificContainer:-""}
|
||||||
SkipRecreate=${SkipRecreate:-false}
|
SkipRecreate=${SkipRecreate:-false}
|
||||||
@@ -110,7 +112,7 @@ c_reset="\033[0m"
|
|||||||
RunTimestamp=$(date +'%Y-%m-%d_%H%M')
|
RunTimestamp=$(date +'%Y-%m-%d_%H%M')
|
||||||
RunEpoch=$(date +'%s')
|
RunEpoch=$(date +'%s')
|
||||||
|
|
||||||
while getopts "ayb:BfFhiIlmMnprsuvc:e:d:t:x:R" options; do
|
while getopts "ayb:BfFhiIlmMnoprsuvc:e:d:t:x:R" options; do
|
||||||
case "${options}" in
|
case "${options}" in
|
||||||
a|y) AutoMode=true ;;
|
a|y) AutoMode=true ;;
|
||||||
b) BackupForDays="${OPTARG}" ;;
|
b) BackupForDays="${OPTARG}" ;;
|
||||||
@@ -126,6 +128,7 @@ while getopts "ayb:BfFhiIlmMnprsuvc:e:d:t:x:R" options; do
|
|||||||
m) MonoMode=true ;;
|
m) MonoMode=true ;;
|
||||||
M) PrintMarkdownURL=true ;;
|
M) PrintMarkdownURL=true ;;
|
||||||
n) DontUpdate=true; AutoMode=true;;
|
n) DontUpdate=true; AutoMode=true;;
|
||||||
|
o) OnlyShowUpdateable=true ;;
|
||||||
p) AutoPrune=true ;;
|
p) AutoPrune=true ;;
|
||||||
R) SkipRecreate=true ;;
|
R) SkipRecreate=true ;;
|
||||||
r) DRunUp=true ;;
|
r) DRunUp=true ;;
|
||||||
@@ -566,7 +569,7 @@ fi
|
|||||||
UpdCount="${#GotUpdates[@]}"
|
UpdCount="${#GotUpdates[@]}"
|
||||||
|
|
||||||
# List what containers got updates or not
|
# List what containers got updates or not
|
||||||
if [[ -n ${NoUpdates[*]:-} ]]; then
|
if [[ -n ${NoUpdates[*]:-} && "$OnlyShowUpdateable" != true ]]; then
|
||||||
printf "\n%bContainers on latest version:%b\n" "$c_green" "$c_reset"
|
printf "\n%bContainers on latest version:%b\n" "$c_green" "$c_reset"
|
||||||
printf "%s\n" "${NoUpdates[@]}"
|
printf "%s\n" "${NoUpdates[@]}"
|
||||||
fi
|
fi
|
||||||
@@ -718,8 +721,10 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
|||||||
printf "\nNo updates installed.\n"
|
printf "\nNo updates installed.\n"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
if [[ "$OnlyShowUpdateable" != true ]]; then
|
||||||
printf "\nNo updates available.\n"
|
printf "\nNo updates available.\n"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Clean up old backup image tags if -b is used otherwise prune if auto-prune is set
|
# Clean up old backup image tags if -b is used otherwise prune if auto-prune is set
|
||||||
if [[ -n "${BackupForDays:-}" ]]; then
|
if [[ -n "${BackupForDays:-}" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user