From af07d5b0132bb7e890220f2a492211775a3f13c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 23 Feb 2024 16:59:23 +0100 Subject: [PATCH] Add warning, wipe data when moving to 1.8.7 --- doc/PRE_UPGRADE.d/1.8.7.md | 7 +++++++ manifest.toml | 2 +- scripts/_common.sh | 15 +++++++++------ scripts/upgrade | 4 ++++ 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 doc/PRE_UPGRADE.d/1.8.7.md diff --git a/doc/PRE_UPGRADE.d/1.8.7.md b/doc/PRE_UPGRADE.d/1.8.7.md new file mode 100644 index 0000000..0bbcd2e --- /dev/null +++ b/doc/PRE_UPGRADE.d/1.8.7.md @@ -0,0 +1,7 @@ +**CAREFUL, THIS UPGRADE WILL WIPE DATA.** + +This is a Duniter issue, not related to YunoHost, see . + +You will just have to restart the synchronization. + +If you think you lost data in the process, don't forget that YunoHost provides backups! diff --git a/manifest.toml b/manifest.toml index eebdd10..a289580 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Duniter" description.en = "Crypto-currency software to operate Ğ1 libre currency" description.fr = "Logiciel de cryptomonnaie pour faire fonctionner la monnaie libre Ğ1" -version = "1.8.7~ynh0" +version = "1.8.7~ynh1" maintainers = ["Moul"] diff --git a/scripts/_common.sh b/scripts/_common.sh index 7d72090..97bd5c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,18 +8,21 @@ # PERSONAL HELPERS #================================================= -CONFIGURE_DUNITER() { - ynh_exec_as "duniter" duniter --home "$data_dir" config \ - --bma --ipv4 127.0.0.1 --port "$port_local_bma" --remoteh $domain --remotep 443 --noupnp +run_duniter() { + ynh_exec_as "duniter" duniter --home "$data_dir" "$@" +} - ynh_exec_as "duniter" duniter --home "$data_dir" config \ + +CONFIGURE_DUNITER() { + run_duniter config --bma --ipv4 127.0.0.1 --port "$port_local_bma" --remoteh $domain --remotep 443 --noupnp + + run_duniter config \ --ws2p-host 127.0.0.1 --ws2p-port "$port_local_ws2p" \ --ws2p-remote-host "$domain" --ws2p-remote-port 443 \ --ws2p-remote-path "/ws2p" --ws2p-noupnp # Add BMAS with path, remove auto-generated BMAS endpoint - ynh_exec_as "duniter" duniter --home "$data_dir" config \ - --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443" + run_duniter config --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443" } #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 835e6ff..a657bb6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,6 +29,10 @@ if [ -z "$(ls -A "$data_dir")" ]; then chown -R "$app:www-data" "$data_dir" fi +if ynh_compare_current_package_version --comparison lt --version 1.8.7~ynh1; then + run_duniter reset data +fi + #================================================= # SPECIFIC UPGRADE #=================================================