aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2018-06-21 11:08:52 +0200
committernemsia <nemsia@nemsia.org>2018-06-21 11:08:52 +0200
commitf13690c38b42b07b75598018c85b4b84a88c3d24 (patch)
tree41cb165f17a5e6ff28cca34fd94852e7bf51c108 /scripts
parent6a4ca2a0e670afec810204cb90009097914f748c (diff)
downloadmastodon_ynh-f13690c38b42b07b75598018c85b4b84a88c3d24.tar.gz
mastodon_ynh-f13690c38b42b07b75598018c85b4b84a88c3d24.tar.bz2
mastodon_ynh-f13690c38b42b07b75598018c85b4b84a88c3d24.zip
Add $db_pwd compatibility
Diffstat (limited to 'scripts')
-rw-r--r--scripts/upgrade8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/upgrade b/scripts/upgrade
index 0f99bab..0350efe 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -50,6 +50,14 @@ if [[ "$admin" = "" || "$language" = "" ]]; then
ynh_die
fi
+# If db_pwd doesn't exist, create it, need for old install
+if [[ -z "$db_pwd" ]]; then
+ db_pwd=$(ynh_string_random)
+ ynh_app_setting_set $app db_pwd $db_pwd
+ ynh_psql_test_if_first_run
+ sudo --login --user=postgres psql -c"ALTER user $app WITH PASSWORD '$db_pwd'" postgres
+ sed -i "s@DB_PASS=@DB_PASS=${db_pwd}@g" "${final_path}/live/.env.production"
+fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP