Last active
May 11, 2021 21:22
-
-
Save ja0nz/49a2a1099048bcceceb13d35195b11bf to your computer and use it in GitHub Desktop.
uberspace; auto update bitwarden_rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Settings: DIR to your bitwarden clone | |
DIR=~/git/bitwarden_rs | |
# Settings end | |
# Just some terminal coloring | |
NC='\033[0m' | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
LATEST_VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/dani-garcia/bw_web_builds/releases/latest | rev | cut -d '/' -f1 | rev) | |
CURRENT_VERSION=$(jq -r .version $DIR/web-vault/version.json) | |
if [ "$LATEST_VERSION" = "$CURRENT_VERSION" ]; then | |
echo -e "${GREEN}>>>Bitwarden is up to date${NC}" | |
else | |
echo -e "${RED}>>>Updating bitwarden to version ${LATEST_VERSION}${NC}" | |
cd $DIR | |
supervisorctl stop bitwarden_rs | |
git pull | |
rsync -a --delete --remove-source-files web-vault/ web-vault-$CURRENT_VERSION.old | |
cd web-vault | |
wget https://github.com/dani-garcia/bw_web_builds/releases/download/$LATEST_VERSION/bw_web_$LATEST_VERSION.tar.gz | |
tar -xvzf bw_web_$LATEST_VERSION.tar.gz | |
cd .. | |
cargo build --release --features sqlite | |
supervisorctl start bitwarden_rs | |
echo -e "${GREEN}>>>Bitwarden is up and running again${NC}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment