From c57a02635c4bac51dc37dbfd378b0400b6eaf2d5 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 10 Mar 2019 20:13:09 +0100 Subject: [PATCH] Fix the upgrade from old version --- scripts/install | 2 +- scripts/upgrade | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 095e922..c14505e 100644 --- a/scripts/install +++ b/scripts/install @@ -140,7 +140,7 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap5" "adresse_ldap=loc ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "ldap_present=true" email=$(yunohost user info $admin | grep mail: | cut -d' ' -f2 | tr -d '\n') -ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=$email" "login=$admin" "pass=$password" "pass_verif=$password" +ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=\"$email\"" "login=$admin" "pass=$password" "pass_verif=$password" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin" # Remove the public access diff --git a/scripts/upgrade b/scripts/upgrade index f937e27..c62a72c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,12 @@ elif [ "$is_public" = "No" ]; then is_public=0 fi +# If db_name doesn't exist, create it +if [ -z $db_name ]; then + db_name=$app + ynh_app_setting_set $app db_name $db_name +fi + # If final_path doesn't exist, create it if [ -z $final_path ]; then final_path=/var/www/$app @@ -158,7 +164,7 @@ ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap5" "adresse_ldap=loc ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "ldap_present=true" email=$(yunohost user info $admin | grep mail: | cut -d' ' -f2 | tr -d '\n') -ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=$email" "login=$admin" "pass=$password" "pass_verif=$password" +ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3b" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "sel_db=$db_name" "nom=$admin" "email=\"$email\"" "login=$admin" "pass=$password" "pass_verif=$password" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=fin" # Remove the public access @@ -201,6 +207,14 @@ ynh_print_info "Reloading nginx web server..." systemctl reload nginx +#================================================= +# SEND INFORMATION +#================================================= + +echo "To finish the upgrade, you may have to update the database by clicking on the button (if asked) at this location: https://$domain$path_url/ecrire/" > mail_to_send + +ynh_send_readme_to_admin --app_message="mail_to_send" --type="upgrade" + #================================================= # END OF SCRIPT #=================================================