From 229636f7fc916ed4b1c234de945e1d583a2d2e6b Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 5 May 2022 20:35:42 +0200 Subject: [PATCH] [mod] Move Duniter configuration in _common.sh In order to maintain these lines once to avoir repetitive code Improve progress message/comments --- scripts/_common.sh | 5 +++++ scripts/install | 7 +++---- scripts/restore | 7 +++---- scripts/upgrade | 7 +++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7e55ac0..fa6ab25 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,6 +10,11 @@ pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP #================================================= # PERSONAL HELPERS #================================================= +CONFIGURE_DUNITER() { + ynh_exec_as duniter duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp + ynh_exec_as duniter duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp + +} #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/install b/scripts/install index 893cac7..cf121f9 100644 --- a/scripts/install +++ b/scripts/install @@ -99,12 +99,11 @@ chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" #================================================= -# ADD A CONFIG FILE +# CONFIGURE DUNITER #================================================= -ynh_script_progression --message="Adding a configuration file…" +ynh_script_progression --message="Configure Duniter…" -ynh_exec_as duniter duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp -ynh_exec_as duniter duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp +CONFIGURE_DUNITER #================================================= # SETUP SYSTEMD diff --git a/scripts/restore b/scripts/restore index dc13cb5..4031cb3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -76,12 +76,11 @@ ynh_setup_source --dest_dir=$tempdir --source_id=$architecture ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.*-linux-*.deb #================================================= -# ADD A CONFIG FILE +# CONFIGURE DUNITER #================================================= -ynh_script_progression --message="Adding a configuration file…" +ynh_script_progression --message="Configure Duniter…" -ynh_exec_as duniter duniter --home $datadir config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp -ynh_exec_as duniter duniter --home $datadir config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp +CONFIGURE_DUNITER #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 400d441..398b528 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,12 +109,11 @@ if [[ ! -d "${datadir}" ]]; then fi #================================================= -# UPDATE A CONFIG FILE +# UPDATE DUNITER CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file…" +ynh_script_progression --message="Configure Duniter…" -ynh_exec_as duniter duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp -ynh_exec_as duniter duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp +CONFIGURE_DUNITER #================================================= # SETUP SYSTEMD