added new variables, options and setup

This commit is contained in:
mag37 2025-11-13 16:30:46 +01:00
parent c33c9f4387
commit 6fefcbc3dd

View file

@ -42,6 +42,7 @@ Help() {
echo "-h Print this Help." echo "-h Print this Help."
echo "-i Inform - send a preconfigured notification." echo "-i Inform - send a preconfigured notification."
echo "-I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list)." echo "-I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list)."
echo "-k N Number of days to store image backups before pruning - this also enables the backup function."
echo "-l Only include containers with label set. See readme." echo "-l Only include containers with label set. See readme."
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)."
@ -77,6 +78,7 @@ Stopped=${Stopped:-""}
CollectorTextFileDirectory=${CollectorTextFileDirectory:-} CollectorTextFileDirectory=${CollectorTextFileDirectory:-}
Exclude=${Exclude:-} Exclude=${Exclude:-}
DaysOld=${DaysOld:-} DaysOld=${DaysOld:-}
DaysKept=${DaysKept:-}
OnlySpecific=${OnlySpecific:-false} OnlySpecific=${OnlySpecific:-false}
SpecificContainer=${SpecificContainer:-""} SpecificContainer=${SpecificContainer:-""}
SkipRecreate=${SkipRecreate:-false} SkipRecreate=${SkipRecreate:-false}
@ -97,7 +99,7 @@ c_blue="\033[0;34m"
c_teal="\033[0;36m" c_teal="\033[0;36m"
c_reset="\033[0m" c_reset="\033[0m"
while getopts "ayfFhiIlmMnprsuvc:e:d:t:x:R" options; do while getopts "ayfFhiIlmMnprsuvc:e:d:k:t:x:R" options; do
case "${options}" in case "${options}" in
a|y) AutoMode=true ;; a|y) AutoMode=true ;;
c) CollectorTextFileDirectory="${OPTARG}" ;; c) CollectorTextFileDirectory="${OPTARG}" ;;
@ -107,6 +109,7 @@ while getopts "ayfFhiIlmMnprsuvc:e:d:t:x:R" options; do
F) OnlySpecific=true ;; F) OnlySpecific=true ;;
i) Notify=true ;; i) Notify=true ;;
I) PrintReleaseURL=true ;; I) PrintReleaseURL=true ;;
k) DaysKept="${OPTARG}" ;;
l) OnlyLabel=true ;; l) OnlyLabel=true ;;
m) MonoMode=true ;; m) MonoMode=true ;;
M) PrintMarkdownURL=true ;; M) PrintMarkdownURL=true ;;
@ -156,6 +159,12 @@ if [[ -n "$DaysOld" ]]; then
exit 2 exit 2
fi fi
fi fi
if [[ -n "$DaysKept" ]]; then
if ! [[ $DaysKept =~ ^[0-9]+$ ]]; then
printf "-k argument given (%s) is not a number.\n" "$DaysKept"
exit 2
fi
fi
if [[ -n "$CollectorTextFileDirectory" ]]; then if [[ -n "$CollectorTextFileDirectory" ]]; then
if ! [[ -d $CollectorTextFileDirectory ]]; then if ! [[ -d $CollectorTextFileDirectory ]]; then
printf "The directory (%s) does not exist.\n" "$CollectorTextFileDirectory" printf "The directory (%s) does not exist.\n" "$CollectorTextFileDirectory"