Download|rm .deb file if necessary

This commit is contained in:
Jeremy Gardais 2021-06-09 16:50:43 +02:00
parent 8f2df93b83
commit 56499ee242
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 10 additions and 1 deletions

View File

@ -55,6 +55,8 @@ zoom_new_version_major=$(echo "${zoom_new_version}" | sed -e 's/\([^\.]\+\.[^\.]
zoom_new_version_minor=$(echo "${zoom_new_version}" | sed -e 's/[^\(]\+(\(.*\)).*/\1/')
zoom_new_version_file="/tmp/.zoom.upgrade"
zoom_new_pkg_path="/tmp/zoom_${zoom_new_version_major}.${zoom_new_version_minor}_amd64.deb"
# }}}
# Check if the current version is the last one {{{
@ -65,9 +67,16 @@ if [ "${zoom_current_version}" != "${zoom_new_version_major}.${zoom_new_version_
touch -- "${zoom_new_version_file}"
printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Zoom client (current: ${zoom_current_version}): ${zoom_new_version}." >> "${zoom_new_version_file}"
## If it doesn't already exists, download this new package
if [ ! -f "${zoom_new_pkg_path}" ]; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Download .deb file from zoom.us to ${zoom_new_pkg_path} ."
wget --quiet https://zoom.us/client/latest/zoom_amd64.deb --output-document="${zoom_new_pkg_path}"
fi
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — The current version is up-to-date."
rm -f -- "${zoom_new_version_file}"
## Ensure to remove any temp file and useless .deb file
rm --force -- "${zoom_new_version_file}" "${zoom_new_pkg_path}"
fi
# }}}