Skip to content
Snippets Groups Projects
Commit 99fddf5f authored by Bob Mottram's avatar Bob Mottram
Browse files

Revert pleroma user permissions if an error occurs

parent 5a6669c0
No related branches found
No related tags found
No related merge requests found
...@@ -201,6 +201,8 @@ function pleroma_create_database { ...@@ -201,6 +201,8 @@ function pleroma_create_database {
if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then
PLEROMA_SECRET_KEY="$(create_password 30)$(create_password 30)" PLEROMA_SECRET_KEY="$(create_password 30)$(create_password 30)"
if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then if [ ${#PLEROMA_SECRET_KEY} -lt 50 ]; then
run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
echo $'Pleroma secret key not created' echo $'Pleroma secret key not created'
exit 6782352 exit 6782352
fi fi
...@@ -224,6 +226,8 @@ function pleroma_create_database { ...@@ -224,6 +226,8 @@ function pleroma_create_database {
chown -R pleroma:pleroma * chown -R pleroma:pleroma *
sudo -u pleroma mix local.rebar --force sudo -u pleroma mix local.rebar --force
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
echo $'mix local.rebar failed' echo $'mix local.rebar failed'
exit 73528562 exit 73528562
fi fi
...@@ -231,11 +235,15 @@ function pleroma_create_database { ...@@ -231,11 +235,15 @@ function pleroma_create_database {
sudo -u pleroma mix deps.compile mimerl sudo -u pleroma mix deps.compile mimerl
sudo -u pleroma mix ecto.create --force sudo -u pleroma mix ecto.create --force
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
echo $'mix ecto.create failed' echo $'mix ecto.create failed'
exit 83653582 exit 83653582
fi fi
sudo -u pleroma mix ecto.migrate --force sudo -u pleroma mix ecto.migrate --force
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
echo $'mix ecto.migrate failed' echo $'mix ecto.migrate failed'
exit 73752573 exit 73752573
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment