2022-07-17 16:34:23 -04:00
|
|
|
#!/usr/bin/env bash
|
2022-11-16 11:19:16 -05:00
|
|
|
set -e
|
2022-10-29 21:04:45 -04:00
|
|
|
VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest |
|
|
|
|
grep "tag_name" |
|
|
|
|
awk '{print substr($2, 2, length($2)-3) }')
|
2022-02-28 05:56:20 -05:00
|
|
|
|
2022-10-29 21:04:45 -04:00
|
|
|
RD=$(echo "\033[01;31m")
|
|
|
|
BL=$(echo "\033[36m")
|
2022-02-28 05:56:20 -05:00
|
|
|
CM='\xE2\x9C\x94\033'
|
2022-10-29 21:04:45 -04:00
|
|
|
GN=$(echo "\033[1;92m")
|
|
|
|
CL=$(echo "\033[m")
|
2022-02-28 05:56:20 -05:00
|
|
|
function update_info {
|
2022-10-29 21:04:45 -04:00
|
|
|
echo -e "${BL}
|
2022-02-28 05:56:20 -05:00
|
|
|
__ __ _ _ _
|
|
|
|
\ \ / / | | | | |
|
|
|
|
\ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __
|
|
|
|
\ \/ / _ | | | | | __\ \ /\ / / _ | __/ _ |/ _ \ _ \
|
|
|
|
\ / (_| | |_| | | |_ \ V V / (_| | | | (_| | __/ | | |
|
|
|
|
\/ \__,_|\__,_|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_|
|
2022-07-17 16:34:23 -04:00
|
|
|
${VAULT} UPDATE
|
2022-02-28 05:56:20 -05:00
|
|
|
${CL}"
|
|
|
|
}
|
|
|
|
|
|
|
|
update_info
|
|
|
|
while true; do
|
2022-11-16 11:32:52 -05:00
|
|
|
read -p "This will Update Vaultwarden to $VAULT (Ensure you set 2vCPU 3072MiB RAM Min.). Proceed(y/n)?" yn
|
2022-02-28 05:56:20 -05:00
|
|
|
case $yn in
|
2022-10-29 21:04:45 -04:00
|
|
|
[Yy]*) break ;;
|
|
|
|
[Nn]*) exit ;;
|
|
|
|
*) echo "Please answer yes or no." ;;
|
2022-02-28 05:56:20 -05:00
|
|
|
esac
|
|
|
|
done
|
2022-03-26 11:34:12 -04:00
|
|
|
sleep 2
|
2022-02-28 10:06:48 -05:00
|
|
|
echo -e "${GN} Stopping Vaultwarden... ${CL}"
|
|
|
|
systemctl stop vaultwarden.service
|
2022-02-28 10:07:57 -05:00
|
|
|
sleep 1
|
2022-02-28 05:56:20 -05:00
|
|
|
|
2022-07-17 16:34:23 -04:00
|
|
|
echo -e "${GN} Updating (Building) to ${VAULT} (Patience)... ${CL}"
|
|
|
|
git clone https://github.com/dani-garcia/vaultwarden &>/dev/null
|
|
|
|
cd vaultwarden
|
|
|
|
cargo build --features "sqlite,mysql,postgresql" --release &>/dev/null
|
2022-11-11 10:25:48 -05:00
|
|
|
DIR=/usr/bin/vaultwarden
|
|
|
|
if [ -d "$DIR" ]; then
|
|
|
|
cp target/release/vaultwarden /usr/bin/
|
|
|
|
else
|
|
|
|
cp target/release/vaultwarden /opt/vaultwarden/bin/
|
|
|
|
fi
|
2022-07-17 16:34:23 -04:00
|
|
|
echo -e "${GN} Starting Vaultwarden ${VAULT}... ${CL}"
|
2022-02-28 10:06:48 -05:00
|
|
|
systemctl start vaultwarden.service
|
|
|
|
sleep 1
|
2022-07-17 16:34:23 -04:00
|
|
|
|
|
|
|
echo -e "${GN} Cleaning up... ${CL}"
|
|
|
|
cd ~ && rm -rf vaultwarden
|
|
|
|
|
2022-11-16 11:32:52 -05:00
|
|
|
echo -e "${GN} Finished Update (Ensure you set resources back to normal settings)${CL}"
|