diff --git a/scripts/install b/scripts/install index 67bc3f8..165b160 100755 --- a/scripts/install +++ b/scripts/install @@ -84,8 +84,8 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -ynh_systemd_action --service_name="xftp" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name="xftp" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index a87faaf..52cb464 100755 --- a/scripts/restore +++ b/scripts/restore @@ -58,8 +58,8 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -ynh_systemd_action --service_name=xftp --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name=xftp --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 8836b1a..9abe129 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,17 +15,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STORE SETTINGS -#================================================= - -public_ip4="$(curl -s ip.yunohost.org)" || true -fingerprint=$(cat /etc/opt/simplex/fingerprint) -xftp_fingerprint=$(cat /etc/opt/simplex-xftp/fingerprint) -ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 -ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint -ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -33,8 +22,8 @@ ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" -ynh_systemd_action --service_name=xftp --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name=xftp --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -67,6 +56,27 @@ chown -R $app:www-data "$install_dir" chmod +x $install_dir/smp-server chmod +x $install_dir/xftp-server +#================================================= +# SPECIFIC SETUP +#================================================= + +public_ip4="$(curl -s ip.yunohost.org)" || true +ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 + +if [ -z "/etc/opt/simplex-xftp/fingerprint" ]; then + pushd "$install_dir" + ./xftp-server init --ip $public_ip4 --quota '20gb' --store-log --path $data_dir + popd + + xftp_fingerprint=$(cat /etc/opt/simplex-xftp/fingerprint) + ynh_app_setting_set --app=$app --key=xftp_fingerprint --value=$xftp_fingerprint + + ynh_replace_string --match_string="port: 443" --replace_string="port: $port_xftp" --target_file="/etc/opt/simplex-xftp/file-server.ini" + + chown -R $app:$app "/etc/opt/simplex" + chown -R $app:$app "/etc/opt/simplex-xftp" +fi + #================================================= # ADD A CONFIGURATION #================================================= @@ -94,8 +104,8 @@ yunohost service add xftp --description="Messaging platform" --log="/var/log/$ap #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -ynh_systemd_action --service_name=xftp --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name=xftp --action="start" --log_path="systemd" #================================================= # END OF SCRIPT