From f13ece7df37dfae9c07ef5fd368a1768d96eda31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 23 Apr 2023 12:50:04 +0200 Subject: [PATCH] fix --- manifest.toml | 2 +- scripts/install | 11 +++++++++-- scripts/upgrade | 9 ++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 32f9098..e1720a5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -46,6 +46,6 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] - dir = "/usr/local/bin/__APP__" + dir = "/usr/local/bin/simplex" [resources.permissions] diff --git a/scripts/install b/scripts/install index 7b1847c..3ad0c4e 100755 --- a/scripts/install +++ b/scripts/install @@ -27,8 +27,15 @@ chmod +x $install_dir/smp-server pushd "$install_dir" public_ip4="$(curl -s ip.yunohost.org)" || true - ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 - ./smp-server init --no-password --ip $public_ip4 -y + public_ip6="$(curl -s ipv6.yunohost.org)" || true + #ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 + + if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) + then + echo "external-ip=${public_ip4}/${public_ip6}" + fi + + ./smp-server init --no-password --ip $external-ip -y popd fingerprint=$(cat /etc/opt/simplex/fingerprint) diff --git a/scripts/upgrade b/scripts/upgrade index 5de770f..f647f91 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,8 +20,15 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= public_ip4="$(curl -s ip.yunohost.org)" || true +public_ip6="$(curl -s ipv6.yunohost.org)" || true + +if ( [[ -n "$public_ip4" ]] && ynh_validate_ip4 --ip_address="$public_ip4" || [[ -n "$public_ip6" ]] && ynh_validate_ip6 --ip_address="$public_ip6" ) +then + echo "external-ip=${public_ip4}/${public_ip6}" + ynh_app_setting_set --app=$app --key=external-ip --value=$external-ip +fi + fingerprint=$(cat /etc/opt/simplex/fingerprint) -ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint #=================================================