diff --git a/scripts/restore b/scripts/restore index 20e5730..fa876bf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,6 +56,13 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "$final_path" +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE APP DATA #================================================= @@ -65,10 +72,11 @@ ynh_restore_file "$data_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db "$db_user" "$db_name" "$db_pwd" -ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./db.sql +ynh_psql_test_if_first_run +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RECREATE THE DEDICATED USER diff --git a/scripts/upgrade b/scripts/upgrade index 84ed45c..acaab5d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,6 +116,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # SETUP SYSTEMD #================================================= @@ -144,9 +151,9 @@ fi # RESTORE FILE PERMISSIONS #================================================= -chown -R "$mattermost_user:www-data" "$final_path" -chown -R "$mattermost_user:www-data" "$data_path" -chown -R "$mattermost_user:adm" "$logs_path" +chown -R "$app:www-data" "$final_path" +chown -R "$app:www-data" "$data_path" +chown -R "$app:adm" "$logs_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST