Bitwarden_rs was renamed to Vaultwarden

Since v1.21.0, see :
https://github.com/dani-garcia/vaultwarden/releases/tag/1.21.0
This commit is contained in:
Jeremy Gardais 2021-04-30 18:49:09 +02:00
parent fdda156c25
commit fa307a2152
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 79 additions and 79 deletions

View File

@ -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

79
github/check.vaultwarden.update Executable file
View File

@ -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