mirror of
https://github.com/YunoHost-Apps/vaultwarden_ynh.git
synced 2024-09-03 18:26:31 +02:00
backup config file before upgrade, and restore it when it's done
This commit is contained in:
parent
d1b3e2d01f
commit
795b6a85db
1 changed files with 12 additions and 0 deletions
|
@ -139,6 +139,12 @@ then
|
|||
sudo -u "$app" env PATH="$PATH" cargo build --features sqlite --release
|
||||
popd
|
||||
|
||||
# Backup config file
|
||||
tmpdir="$(mktemp -d)"
|
||||
if [ -f $final_path/live/bitwarden_rs.env ]; then
|
||||
cp -af "$final_path/live/bitwarden_rs.env" "$tmpdir/."
|
||||
fi
|
||||
|
||||
# Remove old generated files before copying the new ones
|
||||
ynh_secure_remove --file="$final_path/live/build"
|
||||
ynh_secure_remove --file="$final_path/live/deps"
|
||||
|
@ -147,6 +153,12 @@ then
|
|||
# Install bitwarden_rs
|
||||
cp -a "$final_path"/build/target/release/. "$final_path"/live/.
|
||||
|
||||
# Restore config file
|
||||
if [ -f $tmpdir/bitwarden_rs.env ]; then
|
||||
cp -af "$tmpdir/bitwarden_rs.env" "$final_path/live/."
|
||||
fi
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
|
||||
# Remove build files and rustup
|
||||
ynh_secure_remove --file="$final_path/build"
|
||||
ynh_secure_remove --file="$final_path/.cargo"
|
||||
|
|
Loading…
Add table
Reference in a new issue