mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-21 02:34:15 +01:00
minor tweaks; curl/wget retries, missing variable fix in root-check
This commit is contained in:
parent
57f7580477
commit
5e7d4f0b8a
2 changed files with 14 additions and 17 deletions
13
README.md
13
README.md
|
|
@ -23,9 +23,10 @@ ___
|
||||||
- **v0.6.5**: Refactored notification logic. See notify_templates/notify_v2.sh for upgrade steps.
|
- **v0.6.5**: Refactored notification logic. See notify_templates/notify_v2.sh for upgrade steps.
|
||||||
- Added helper functions to simplify sourcing files and executing functions if they exist.
|
- Added helper functions to simplify sourcing files and executing functions if they exist.
|
||||||
- Created notify_v2.sh wrapper script.
|
- Created notify_v2.sh wrapper script.
|
||||||
- Simplified and consolidated notification logic within notify_v2.sh.
|
- Simplified and consolidated notification logic within notify_v2.sh.
|
||||||
- Added support for notification management via environment variables.
|
- Added support for notification management via environment variables.
|
||||||
- Moved notification secrets to dockcheck.config.
|
- Moved notification secrets to **dockcheck.config**.
|
||||||
|
- Added retries to wget/curl to not get empty responses when github is slow.
|
||||||
- **v0.6.4**: Restructured the update process - first pulls all updates, then recreates all containers.
|
- **v0.6.4**: Restructured the update process - first pulls all updates, then recreates all containers.
|
||||||
- Added logic to skip update check on non-compose containers (unless `-r` option).
|
- Added logic to skip update check on non-compose containers (unless `-r` option).
|
||||||
- Added option `-F` to revert to `compose up -d <ContainerName>` targeting specific container and not the stack.
|
- Added option `-F` to revert to `compose up -d <ContainerName>` targeting specific container and not the stack.
|
||||||
|
|
@ -40,10 +41,6 @@ ___
|
||||||
- `-u`, Allow auto self update of dockcheck.sh
|
- `-u`, Allow auto self update of dockcheck.sh
|
||||||
- `-I`, Print container release URLs in the CLI "choose update" list. (please contribute to `urls.list`)
|
- `-I`, Print container release URLs in the CLI "choose update" list. (please contribute to `urls.list`)
|
||||||
- Extras: `-m`, Monochrome mode now hides the progress bar.
|
- Extras: `-m`, Monochrome mode now hides the progress bar.
|
||||||
- **v0.6.1**: Hotfixes: (try removing set+shopt+shopt if debugging more errors)
|
|
||||||
- xargs/pipefail, removed `-set -e` bash option for now.
|
|
||||||
- unbound variables fixed (hopefully)
|
|
||||||
- dependency installer from pkgmanager rewritten
|
|
||||||
___
|
___
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,7 +61,7 @@ Options:
|
||||||
-F Only compose up the specific container, not the whole compose stack (useful for master-compose structure).
|
-F Only compose up the specific container, not the whole compose stack (useful for master-compose structure).
|
||||||
-h Print this Help.
|
-h Print this Help.
|
||||||
-i Inform - send a preconfigured notification.
|
-i Inform - send a preconfigured notification.
|
||||||
-I Prints custom releasenote urls alongside each container with updates (requires urls.list).
|
-I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list).
|
||||||
-l Only update if label is set. See readme.
|
-l Only update if label is set. See readme.
|
||||||
-m Monochrome mode, no printf colour codes and hides progress bar.
|
-m Monochrome mode, no printf colour codes and hides progress bar.
|
||||||
-M Prints custom releasenote urls as markdown (requires template support).
|
-M Prints custom releasenote urls as markdown (requires template support).
|
||||||
|
|
|
||||||
18
dockcheck.sh
18
dockcheck.sh
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.6.4"
|
VERSION="v0.6.4"
|
||||||
### ChangeNotes: Refactored notification logic. See README.md for upgrade steps.
|
# ChangeNotes: Refactored notification logic. See README.md for upgrade steps.
|
||||||
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"
|
||||||
|
|
||||||
|
|
@ -14,8 +14,8 @@ ScriptPath="$(readlink -f "$0")"
|
||||||
ScriptWorkDir="$(dirname "$ScriptPath")"
|
ScriptWorkDir="$(dirname "$ScriptPath")"
|
||||||
|
|
||||||
# Check if there's a new release of the script
|
# Check if there's a new release of the script
|
||||||
LatestRelease="$(curl -s -r 0-50 "$RawUrl" | sed -n "/VERSION/s/VERSION=//p" | tr -d '"')"
|
LatestRelease="$(curl --retry 3 --retry-delay 1 --retry-max-time 10 -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 --retry 3 --retry-delay 1 --retry-max-time 10 -s -r 0-200 "$RawUrl" | sed -n "/ChangeNotes/s/# ChangeNotes: //p")"
|
||||||
|
|
||||||
# Source helper functions
|
# Source helper functions
|
||||||
source_if_exists() {
|
source_if_exists() {
|
||||||
|
|
@ -43,7 +43,7 @@ Help() {
|
||||||
echo "-F Only compose up the specific container, not the whole compose stack (useful for master-compose structure)."
|
echo "-F Only compose up the specific container, not the whole compose stack (useful for master-compose structure)."
|
||||||
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 (requires urls.list)."
|
echo "-I Prints custom releasenote urls alongside each container with updates in CLI output (requires urls.list)."
|
||||||
echo "-l Only update if label is set. See readme."
|
echo "-l Only update if label is 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)."
|
||||||
|
|
@ -166,12 +166,12 @@ exec_if_exists_or_fail() {
|
||||||
self_update_curl() {
|
self_update_curl() {
|
||||||
cp "$ScriptPath" "$ScriptPath".bak
|
cp "$ScriptPath" "$ScriptPath".bak
|
||||||
if command -v curl &>/dev/null; then
|
if command -v curl &>/dev/null; then
|
||||||
curl -L $RawUrl > "$ScriptPath"; chmod +x "$ScriptPath"
|
curl --retry 3 --retry-delay 1 --retry-max-time 10 -L $RawUrl > "$ScriptPath"; chmod +x "$ScriptPath"
|
||||||
printf "\n%b---%b starting over with the updated version %b---%b\n" "$c_yellow" "$c_teal" "$c_yellow" "$c_reset"
|
printf "\n%b---%b starting over with the updated version %b---%b\n" "$c_yellow" "$c_teal" "$c_yellow" "$c_reset"
|
||||||
exec "$ScriptPath" "${ScriptArgs[@]}" # run the new script with old arguments
|
exec "$ScriptPath" "${ScriptArgs[@]}" # run the new script with old arguments
|
||||||
exit 1 # Exit the old instance
|
exit 1 # Exit the old instance
|
||||||
elif command -v wget &>/dev/null; then
|
elif command -v wget &>/dev/null; then
|
||||||
wget $RawUrl -O "$ScriptPath"; chmod +x "$ScriptPath"
|
wget --waitretry=1 --timeout=15 -t 10 $RawUrl -O "$ScriptPath"; chmod +x "$ScriptPath"
|
||||||
printf "\n%b---%b starting over with the updated version %b---%b\n" "$c_yellow" "$c_teal" "$c_yellow" "$c_reset"
|
printf "\n%b---%b starting over with the updated version %b---%b\n" "$c_yellow" "$c_teal" "$c_yellow" "$c_reset"
|
||||||
exec "$ScriptPath" "${ScriptArgs[@]}" # run the new script with old arguments
|
exec "$ScriptPath" "${ScriptArgs[@]}" # run the new script with old arguments
|
||||||
exit 0 # exit the old instance
|
exit 0 # exit the old instance
|
||||||
|
|
@ -270,8 +270,8 @@ binary_downloader() {
|
||||||
*) printf "\n%bArchitecture not supported, exiting.%b\n" "$c_red" "$c_reset"; exit 1;;
|
*) printf "\n%bArchitecture not supported, exiting.%b\n" "$c_red" "$c_reset"; exit 1;;
|
||||||
esac
|
esac
|
||||||
GetUrl="${BinaryUrl/TEMP/"$architecture"}"
|
GetUrl="${BinaryUrl/TEMP/"$architecture"}"
|
||||||
if command -v curl &>/dev/null; then curl -L "$GetUrl" > "$ScriptWorkDir/$BinaryName";
|
if command -v curl &>/dev/null; then curl --retry 3 --retry-delay 1 --retry-max-time 10 -L "$GetUrl" > "$ScriptWorkDir/$BinaryName";
|
||||||
elif command -v wget &>/dev/null; then wget "$GetUrl" -O "$ScriptWorkDir/$BinaryName";
|
elif command -v wget &>/dev/null; then wget --waitretry=1 --timeout=15 -t 10 "$GetUrl" -O "$ScriptWorkDir/$BinaryName";
|
||||||
else printf "\n%bcurl/wget not available - get %s manually from the repo link, exiting.%b" "$c_red" "$BinaryName" "$c_reset"; exit 1;
|
else printf "\n%bcurl/wget not available - get %s manually from the repo link, exiting.%b" "$c_red" "$BinaryName" "$c_reset"; exit 1;
|
||||||
fi
|
fi
|
||||||
[[ -f "$ScriptWorkDir/$BinaryName" ]] && chmod +x "$ScriptWorkDir/$BinaryName"
|
[[ -f "$ScriptWorkDir/$BinaryName" ]] && chmod +x "$ScriptWorkDir/$BinaryName"
|
||||||
|
|
@ -285,7 +285,7 @@ distro_checker() {
|
||||||
elif [[ -f /etc/arch-release ]]; then
|
elif [[ -f /etc/arch-release ]]; then
|
||||||
[[ "$isRoot" == true ]] && PkgInstaller="pacman -S" || PkgInstaller="sudo pacman -S"
|
[[ "$isRoot" == true ]] && PkgInstaller="pacman -S" || PkgInstaller="sudo pacman -S"
|
||||||
elif [[ -f /etc/debian_version ]]; then
|
elif [[ -f /etc/debian_version ]]; then
|
||||||
[[ "" == true ]] && PkgInstaller="apt-get install" || PkgInstaller="sudo apt-get install"
|
[[ "$isRoot" == true ]] && PkgInstaller="apt-get install" || PkgInstaller="sudo apt-get install"
|
||||||
elif [[ -f /etc/redhat-release ]]; then
|
elif [[ -f /etc/redhat-release ]]; then
|
||||||
[[ "$isRoot" == true ]] && PkgInstaller="dnf install" || PkgInstaller="sudo dnf install"
|
[[ "$isRoot" == true ]] && PkgInstaller="dnf install" || PkgInstaller="sudo dnf install"
|
||||||
elif [[ -f /etc/SuSE-release ]]; then
|
elif [[ -f /etc/SuSE-release ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue