aboutsummaryrefslogtreecommitdiff
path: root/scripts/restore
diff options
context:
space:
mode:
authormagikcypress <cyp@rouquin.me>2017-04-18 02:47:58 +0200
committermagikcypress <cyp@rouquin.me>2017-04-18 02:47:58 +0200
commit128aa107baf2bbf713a6af43182e1bc6d9c7a1a7 (patch)
treec6ccfef70b81223ee61e28b2c6106a862c51ad8d /scripts/restore
parentcfdc9938e270ce9bd92446f628101f0b67db3e32 (diff)
downloadmastodon_ynh-128aa107baf2bbf713a6af43182e1bc6d9c7a1a7.tar.gz
mastodon_ynh-128aa107baf2bbf713a6af43182e1bc6d9c7a1a7.tar.bz2
mastodon_ynh-128aa107baf2bbf713a6af43182e1bc6d9c7a1a7.zip
[fix] secure rm + upgrade
Diffstat (limited to 'scripts/restore')
-rw-r--r--scripts/restore12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/restore b/scripts/restore
index f1c80ee..f79ee1c 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -61,10 +61,20 @@ sudo cp -a ./sources "$final_path"
# Set permissions
sudo chown -R $app: "$final_path"
+# Set UTF8 encoding by default
+sudo su -c "psql" postgres <<< \
+ "update pg_database set datistemplate='false' where datname='template1';"
+sudo su -c "psql" postgres <<< \
+ "drop database template1;"
+sudo su -c "psql" postgres <<< \
+ "create database template1 encoding='UTF8' template template0;"
+sudo su -c "psql" postgres <<< \
+ "update pg_database set datistemplate='true' where datname='template1';"
+
# Restore db
ynh_psql_create_db_without_password "$app"
sudo su - postgres <<COMMANDS
-pg_dump mastodon_production < ./mastodon_db.sql
+pg_dump -U mastodon mastodon_production < ./mastodon_db.sql
COMMANDS
# Restore Mastodon