From fa307a21529acb1fa80d78a20801a02708cfe71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 30 Apr 2021 18:49:09 +0200 Subject: [PATCH] Bitwarden_rs was renamed to Vaultwarden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since v1.21.0, see : https://github.com/dani-garcia/vaultwarden/releases/tag/1.21.0 --- github/check.bitwarden_rs.update | 79 -------------------------------- github/check.vaultwarden.update | 79 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 79 deletions(-) delete mode 100755 github/check.bitwarden_rs.update create mode 100755 github/check.vaultwarden.update diff --git a/github/check.bitwarden_rs.update b/github/check.bitwarden_rs.update deleted file mode 100755 index 9115418..0000000 --- a/github/check.bitwarden_rs.update +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# Purpose {{{ -## Create a temp file (to monitor) if an upgrade is available for Bitwarden_rs -## project on Github. -## It based on /opt/bitwarden_rs/bitwarden_rs binary available or the one give -## as first argument. -## How-to use {{{ -### 1. Needs releasetags script, in the same directory -### cf. https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/github/releasetags -# wget https://git.ipr.univ-rennes1.fr/cellinfo/scripts/raw/master/github/releasetags -### 2. Create a cron job, eg. -#00 20 * * * root /opt/repos/ipr.scripts/github/check_bitwarden_rs_update -### 2-1 Create a cron job with a specific path for bitwarden_rs bin, eg. -#00 20 * * * root /opt/repos/ipr.scripts/github/check_bitwarden_rs_update /srv/bin/bitwarden_rs -### 3. Monitor the temp file : /tmp/.github.bitwarden_rs.upgrade -# Or enable MAILTO in cronjob and edit the script to print a message. -# Or send a mail. -# … -## }}} -# }}} - -# Expect max 1 argument {{{ -if [ $# -gt 1 ] -then - cat << HELP - -check.bitwarden_rs.update -- -Compare current version of an installed Bitwarden_rs and the last available. - -EXAMPLE : - - Compare the current version of Bitwarden_rs with bin available in - /opt/bitwarden_rs/bitwarden_rs - check.bitwarden_rs.update - - - Compare the current version of Bitwarden_rs at a specific place - check.bitwarden_rs.update /srv/bin/bitwarden_rs - -HELP - - exit 1 - -fi -# }}} - -# Vars {{{ -DEBUG=1 - -script_wd=$(dirname "${0}") - -if [ $# -eq 1 ] ## If an argument was gave -then - bitwarden_rs_bin_path="${1}" -else - bitwarden_rs_bin_path="/opt/bitwarden_rs/bitwarden_rs" - fi - -bitwarden_rs_current_version=$("${bitwarden_rs_bin_path}" --version | sed 's/bitwarden_rs \(\([0-9]\{1,3\}\.\)\{2\}\([0-9]\{1,3\}\)\).*/\1/') - -bitwarden_rs_repo_url="https://github.com/dani-garcia/bitwarden_rs" -bitwarden_rs_new_version=$("${script_wd}"/releasetags "${bitwarden_rs_repo_url}" | grep -vE -- '(dev|rc)' | head -n1) - -bitwarden_rs_new_version_file="/tmp/.github.bitwarden_rs.upgrade" -# }}} - -# Check if the current version is the last one {{{ -if [ "${bitwarden_rs_current_version}" != "${bitwarden_rs_new_version}" ]; then - [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test version — Current version (${bitwarden_rs_current_version}) and new one (${bitwarden_rs_new_version}) seems to be different." - - ## Create a temp file to monitor - touch -- "${bitwarden_rs_new_version_file}" - printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Bitwarden_rs (current : ${bitwarden_rs_current_version}) : ${bitwarden_rs_new_version}." >> "${bitwarden_rs_new_version_file}" - -else - [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test version — The current version is up-to-date." - rm -f -- "${bitwarden_rs_new_version_file}" -fi -# }}} - -exit 0 diff --git a/github/check.vaultwarden.update b/github/check.vaultwarden.update new file mode 100755 index 0000000..19facf4 --- /dev/null +++ b/github/check.vaultwarden.update @@ -0,0 +1,79 @@ +#!/bin/sh +# Purpose {{{ +## Create a temp file (to monitor) if an upgrade is available for Vaultwarden +## (previously Bitwarden_rs) project on Github. +## It based on /opt/vaultwarden/vaultwarden binary available or the one give +## as first argument. +## How-to use {{{ +### 1. Needs releasetags script, in the same directory +### cf. https://git.ipr.univ-rennes1.fr/cellinfo/scripts/src/master/github/releasetags +# wget https://git.ipr.univ-rennes1.fr/cellinfo/scripts/raw/master/github/releasetags +### 2. Create a cron job, eg. +#00 20 * * * root /opt/repos/ipr.scripts/github/check_vaultwarden_update +### 2-1 Create a cron job with a specific path for vaultwarden bin, eg. +#00 20 * * * root /opt/repos/ipr.scripts/github/check_vaultwarden_update /srv/bin/vaultwarden +### 3. Monitor the temp file : /tmp/.github.vaultwarden.upgrade +# Or enable MAILTO in cronjob and edit the script to print a message. +# Or send a mail. +# … +## }}} +# }}} + +# Expect max 1 argument {{{ +if [ $# -gt 1 ] +then + cat << HELP + +check.vaultwarden.update -- +Compare current version of an installed Vaultwarden and the last available. + +EXAMPLE : + - Compare the current version of Vaultwarden with bin available in + /opt/vaultwarden/vaultwarden + check.vaultwarden.update + + - Compare the current version of Vaultwarden at a specific place + check.vaultwarden.update /srv/bin/vaultwarden + +HELP + + exit 1 + +fi +# }}} + +# Vars {{{ +DEBUG=1 + +script_wd=$(dirname "${0}") + +if [ $# -eq 1 ] ## If an argument was gave +then + vaultwarden_bin_path="${1}" +else + vaultwarden_bin_path="/opt/vaultwarden/vaultwarden" + fi + +vaultwarden_current_version=$("${vaultwarden_bin_path}" --version | sed 's/vaultwarden \(\([0-9]\{1,3\}\.\)\{2\}\([0-9]\{1,3\}\)\).*/\1/') + +vaultwarden_repo_url="https://github.com/dani-garcia/vaultwarden" +vaultwarden_new_version=$("${script_wd}"/releasetags "${vaultwarden_repo_url}" | grep -vE -- '(dev|rc)' | head -n1) + +vaultwarden_new_version_file="/tmp/.github.vaultwarden.upgrade" +# }}} + +# Check if the current version is the last one {{{ +if [ "${vaultwarden_current_version}" != "${vaultwarden_new_version}" ]; then + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test version — Current version (${vaultwarden_current_version}) and new one (${vaultwarden_new_version}) seems to be different." + + ## Create a temp file to monitor + touch -- "${vaultwarden_new_version_file}" + printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Vaultwarden (current : ${vaultwarden_current_version}) : ${vaultwarden_new_version}." >> "${vaultwarden_new_version_file}" + +else + [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Test version — The current version is up-to-date." + rm -f -- "${vaultwarden_new_version_file}" +fi +# }}} + +exit 0