From 4e18f0d46d3d55c64040a4135163d1a005fa5786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 11 Jun 2021 15:41:29 +0200 Subject: [PATCH] Download|rm .deb file for rocketchat if necessary --- github/check.rocketchat-electron.update | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/github/check.rocketchat-electron.update b/github/check.rocketchat-electron.update index bc86bd4..08f550f 100755 --- a/github/check.rocketchat-electron.update +++ b/github/check.rocketchat-electron.update @@ -58,6 +58,8 @@ fi rkt_new_version=$("${script_wd}"/releasetags "${rkt_repo_url}" | head -n1 | sed 's/v//g') rkt_new_version_file="/tmp/.github.rocketchat-electron.upgrade" +rkt_new_pkg_url="https://github.com/RocketChat/Rocket.Chat.Electron/releases/download/${rkt_new_version}/rocketchat_${rkt_new_version}_amd64.deb" +rkt_new_pkg_path="/tmp/rocketchat_${rkt_new_version}_amd64.deb" # }}} # Check if the current version is the last one {{{ @@ -68,9 +70,16 @@ if [ "${rkt_current_version}" != "${rkt_new_version}" ]; then touch -- "${rkt_new_version_file}" printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Rocket.Chat client − Electron (current : ${rkt_current_version}) : ${rkt_new_version}." >> "${rkt_new_version_file}" + ## If it doesn't already exists, download this new package + if [ ! -f "${rkt_new_pkg_path}" ]; then + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Download .deb file from Rocket.Chat.Electron repository on Github to ${rkt_new_pkg_path} ." + wget --quiet "${rkt_new_pkg_url}" --output-document="${rkt_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 -- "${rkt_new_version_file}" + ## Ensure to remove any temp file and useless .deb file + rm -f -- "${rkt_new_version_file}" "${rkt_new_pkg_path}" fi # }}}