diff --git a/README.md b/README.md index dab5e16..1d93cdf 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ The YunoHost team uses [Weblate](https://weblate.org) for translations: https://translate.yunohost.org +## Admin + +An admin user is created at installation, the password is *weblate*. ## Weblate and databases diff --git a/scripts/_common.sh b/scripts/_common.sh index 20a842e..fc320db 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -63,7 +63,7 @@ ynh_psql_execute_as_root () { ynh_psql_execute_file_as_root() { file="$1" db="$2" - sudo -u postgres psql "$db" <<< "$file" + su -c "psql $db" postgres < $file } # Create a database, an user and its password. Then store the password in the app's config diff --git a/scripts/restore b/scripts/restore index 5cd3469..78d86d1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) +db_pwd=$(ynh_app_setting_get "$app" psqlpwd) smtp_pwd=$(ynh_app_setting_get $app smtppwd) #================================================= @@ -85,16 +86,15 @@ ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \ #================================================= ynh_psql_test_if_first_run - -db_pwd=$(ynh_app_setting_get "$app" pgsqlpwd) ynh_psql_setup_db "$db_name" "$db_name" "$db_pwd" -ynh_psql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql +ynh_psql_execute_file_as_root ./db.sql "$db_name" #================================================= # RESTORE THE SERVICE #================================================= ynh_restore_file "/etc/systemd/system/$app.service" +systemctl enable "$app.service" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL @@ -121,4 +121,5 @@ ynh_restore_file "/etc/logrotate.d/$app" #================================================= systemctl reload nginx -systemctl reload "$app.service" +systemctl stop "$app.service" +systemctl start "$app.service"