1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pleroma_ynh.git synced 2024-09-03 20:15:59 +02:00

Merge pull request #6 from yalh76/master

Fix install issue but need to improve database rights
This commit is contained in:
yalh76 2019-01-23 01:22:13 +01:00 committed by GitHub
commit c34fada8d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ path_url="/"
admin=$YNH_APP_ARG_ADMIN
admin_email=$(ynh_user_get_info $admin 'mail')
admin_name=$(ynh_user_get_info $admin 'firstname')
admin_pass=$(ynh_string_random 24)
admin_pass_reset_url=""
is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_random 64)
name=$YNH_APP_ARG_NAME
@ -117,6 +117,8 @@ ynh_app_setting_set "$app" psqlpwd "$db_pwd"
ynh_psql_test_if_first_run
ynh_psql_create_user "$app" "$db_pwd"
ynh_psql_execute_as_root \
"ALTER USER $app WITH SUPERUSER;"
ynh_psql_execute_as_root \
"CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;"
ynh_psql_execute_as_root "\connect $db_name
CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
@ -198,10 +200,12 @@ chown -R "$app":"$app" "$final_path"
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.rebar --force )
( cd $final_path/$app && sudo -u "$app" mix deps.get )
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force )
# Add user
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix register_user "$admin" "$admin_name" "$admin_email" "Moderator of this instance" "$admin_pass" )
# Add user and retrieve a password reset link that you can then send to the user
admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" | tail -1 )
# Make user moderator
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix set_moderator "$admin" true )
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator )
# Make user admin
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin )
#=================================================
# SETUP SSOWAT
@ -240,7 +244,7 @@ message=" $app was successfully installed :)
Please open your $app domain: https://$domain$path_url
The moderator username is: $admin
The moderator password is: $admin_pass
To reset your password: $admin_pass_reset_url
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/pleroma_ynh/
If you are not afraid of the terminal, check out https://git.pleroma.social/pleroma/pleroma/wikis/home to see what more you can do with your awesome instance!"