Disable docker run command if image not available locally

Disable docker run command if image not available locally
This commit is contained in:
OrpheeGT 2023-04-21 17:23:19 +02:00 committed by GitHub
parent 4698b483cb
commit 687814203b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,8 +98,9 @@ synology_dsm_deploy() {
otp_code="$(oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null)" otp_code="$(oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null)"
elif _exists docker; then elif _exists docker; then
if [[ "$(docker images -q toolbelt/oathtool:latest 2> /dev/null)" == "" ]]; then if [[ "$(docker images -q toolbelt/oathtool:latest 2> /dev/null)" == "" ]]; then
read -e -p "docker is available but oathtool docker image must be downloaded, do you want to download it (Y) or abort (N) ? " choice _err "docker is available but oathtool docker image must be downloaded manually"
[[ "$choice" == [Yy]* ]] && docker image pull toolbelt/oathtool:latest && otp_code="$(docker run --rm -it toolbelt/oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null | cut -b 1-6)" || { _err "Abort requested or download failed"; return 1; } _err "Please execute manually 'docker image pull toolbelt/oathtool:latest' and relaunch the deployment"
return 1
else else
otp_code="$(docker run --rm -it toolbelt/oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null | cut -b 1-6)" otp_code="$(docker run --rm -it toolbelt/oathtool --base32 --totp "${SYNO_TOTP_SECRET}" 2>/dev/null | cut -b 1-6)"
fi fi