diff --git a/.includes/bottle.sh b/.includes/bottle.sh index 50747bd..3dff049 100644 --- a/.includes/bottle.sh +++ b/.includes/bottle.sh @@ -78,6 +78,7 @@ install_winespeak() { local cscriptPath="${WINEPREFIX}/drive_c/windows/syswow64/cscript.exe" local verifyScriptPath="${WINEPREFIX}/drive_c/windows/temp/verify_winespeak.vbs" local actualSha256 + local verificationAttempt local registryOutput local voiceOutput local defaultToken='HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\Espeak-ng US English' @@ -87,13 +88,19 @@ install_winespeak() { return 1 fi - download "$wineSpeakInstaller" - actualSha256="$(sha256sum "$installerPath" | awk '{print $1}')" - if [[ "$actualSha256" != "$installerSha256" ]]; then - echo "WineSpeak installer failed its SHA-256 check." + for ((verificationAttempt = 1; verificationAttempt <= 3; verificationAttempt++)); do + download "$wineSpeakInstaller" + actualSha256="$(sha256sum "$installerPath" | awk '{print $1}')" + if [[ "$actualSha256" == "$installerSha256" ]]; then + break + fi + echo "WineSpeak installer failed its SHA-256 check (attempt ${verificationAttempt} of 3)." rm -f "$installerPath" - return 1 - fi + if ((verificationAttempt == 3)); then + return 1 + fi + echo "Downloading WineSpeak again." + done if ! wine "$installerPath" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-; then echo "WineSpeak installer failed."