diff --git a/manifest.json b/manifest.json index f294841..39d2b72 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage passwords and other sensitive informations", "fr": "Géres les mots de passe et autres informations sensibles" }, - "version": "1.14.2~ynh1", + "version": "1.14.2~ynh2", "url": "https://github.com/dani-garcia/bitwarden_rs", "license": "GPL-3.0-or-later", "maintainer": { diff --git a/scripts/restore b/scripts/restore index 2bb3d30..07e0ffb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,6 @@ ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3e2da5a..70210ec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,8 +139,27 @@ then sudo -u "$app" env PATH="$PATH" cargo build --features sqlite --release popd + # Backup files + tmpdir="$(mktemp -d)" + if [ -f $final_path/live/bitwarden_rs.env ]; then + cp -af "$final_path/live/bitwarden_rs.env" "$tmpdir/." + fi + if [ -d $final_path/live/data ]; then + cp -af "$final_path/live/data" "$tmpdir/." + fi + # Install bitwarden_rs - cp -a "$final_path"/build/target/release/. "$final_path"/live/. + ynh_secure_remove --file="$final_path/live" + cp -a "$final_path/build/target/release/." "$final_path/live/." + + # Restore files + if [ -f $tmpdir/bitwarden_rs.env ]; then + cp -af "$tmpdir/bitwarden_rs.env" "$final_path/live/." + fi + if [ -d $tmpdir/data ]; then + cp -af "$tmpdir/data" "$final_path/live/." + fi + ynh_secure_remove --file="$tmpdir" # Remove build files and rustup ynh_secure_remove --file="$final_path/build"