diff --git a/scripts/install b/scripts/install index 40e2b4a..37391c4 100644 --- a/scripts/install +++ b/scripts/install @@ -52,7 +52,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=password --value=$password -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=users_status --value=$users_status #================================================= @@ -122,7 +121,7 @@ ynh_permission_update --permission="main" --add="visitors" # Installation with curl ynh_script_progression --message="Finalizing installation..." ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod" -ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" +ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name" # For now spip have a problem with LDAP #ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap1" diff --git a/scripts/upgrade b/scripts/upgrade index a02bfeb..2fb6f35 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) password=$(ynh_app_setting_get --app=$app --key=password) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) users_status=$(ynh_app_setting_get --app=$app --key=users_status) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -60,13 +59,10 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +# Remove is_public +if [ -n "$is_public" ]; then + ynh_app_setting_delete --app=$app --key=is_public fi # If db_name doesn't exist, create it @@ -170,8 +166,15 @@ chown -R $app:www-data "$final_path" # Set the app as temporarily public for curl call ynh_script_progression --message="Configuring SSOwat..." -# Making the app public for curl -ynh_permission_update --permission="main" --add="visitors" + + +if ! ynh_permission_has_user --permission=main --user="visitors"; then + is_public=0 + # Making the app public for curl + ynh_permission_update --permission="main" --add="visitors" +else + is_public=1 +fi ynh_backup_if_checksum_is_different --file="$final_path/config/connect.php" @@ -180,7 +183,7 @@ mv $final_path/config/connect.php $final_path/config/connect.php.ynh_bkp # Installation with curl ynh_script_progression --message="Finalizing installation..." ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=chmod" -ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=755" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" +ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=2" "chmod=750" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=3" "adresse_db=localhost" "login_db=$db_name" "pass_db=$db_pwd" "server_db=mysql" "choix_db=$db_name" "tprefix=$db_name" # For now spip have a problem with LDAP #ynh_local_curl "/ecrire/?suivant" "exec=install" "etape=ldap1" @@ -206,9 +209,6 @@ 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=fin" -# Remove the public access -ynh_permission_update --permission="main" --remove="visitors" - #================================================= # UPDATE A CONFIG FILE #================================================= @@ -235,12 +235,10 @@ ynh_store_file_checksum --file="$final_path/config/connect.php" #================================================= ynh_script_progression --message="Configuring permissions..." -# Make app public if necessary -if [ $is_public -eq 1 ] +# Make app private if necessary +if [ $is_public -eq 0 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" + ynh_permission_update --permission="main" --remove="visitors" fi #=================================================