diff --git a/scripts/upgrade b/scripts/upgrade index e4c05a1..6d143b4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -96,6 +96,28 @@ if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" fi +if ynh_version_gt "3.55~ynh1" "${previous_version}" ; then + # Install dependencies + ynh_remove_nodejs + ynh_install_nodejs --nodejs_version="8.16.2" + ynh_use_nodejs + + # Create a dedicated systemd config + ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service" + ynh_add_systemd_config + + # Create a dedicated .env config + config_file="$final_path/.env" + ynh_backup_if_checksum_is_different --file="$config_file" + cp "../conf/.env" "$config_file" + ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$config_file" + ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file" + ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config_file" + ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain$path_url" --target_file="$config_file" + ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" + ynh_store_file_checksum "$config_file" +fi + #================================================= # CHECK THE PATH #=================================================