diff options
| author | yalh76 <yalh@yahoo.com> | 2019-05-11 02:16:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-11 02:16:49 +0200 |
| commit | ee4f535aa785b4258719b1e7df5a285b030ce7d5 (patch) | |
| tree | dad507ff2887c7232c4fb292cd1b7c8d1d0f9b83 /scripts | |
| parent | 7400f8e75d5a194beddb713c2d7794337c8e7eac (diff) | |
| parent | 750402c9c2c8bca9c172b67a5e78d2788f211c04 (diff) | |
| download | mastodon_ynh-ee4f535aa785b4258719b1e7df5a285b030ce7d5.tar.gz mastodon_ynh-ee4f535aa785b4258719b1e7df5a285b030ce7d5.tar.bz2 mastodon_ynh-ee4f535aa785b4258719b1e7df5a285b030ce7d5.zip | |
Merge branch 'testing' into v2.8.2
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/upgrade | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/scripts/upgrade b/scripts/upgrade index 55c3b07..6b03cb7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -72,7 +72,7 @@ fi # If paperclip_secret doesn't exist, retrieve it or create it if [[ -z "$paperclip_secret" ]]; then - paperclip_secret=$(grep -oP "PAPERCLIP_SECRET=\K\w+" test) + paperclip_secret=$(grep -oP "PAPERCLIP_SECRET=\K\w+" ${final_path}/live/.env.production) if [[ -z "$paperclip_secret" ]]; then paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi @@ -81,7 +81,7 @@ fi # If secret_key_base doesn't exist, retrieve it or create it if [[ -z "$secret_key_base" ]]; then - secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" test) + secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" ${final_path}/live/.env.production) if [[ -z "$secret_key_base" ]]; then secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi @@ -90,13 +90,21 @@ fi # If otp_secret doesn't exist, retrieve it or create it if [[ -z "$otp_secret" ]]; then - otp_secret=$(grep -oP "OTP_SECRET=\K\w+" test) + otp_secret=$(grep -oP "OTP_SECRET=\K\w+" ${final_path}/live/.env.production) if [[ -z "$otp_secret" ]]; then otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128) fi ynh_app_setting_set "$app" otp_secret "$otp_secret" fi +# If vapid_private_key doesn't exist, retrieve it or create it +if [[ -z "$vapid_private_key" ]]; then + vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" ${final_path}/live/.env.production) + vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" ${final_path}/live/.env.production) + ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" + ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -212,6 +220,9 @@ ynh_replace_string "__SECRET_KEY_BASE__" "$secret_key_base" "$final_path/live/.e ynh_replace_string "__OTP_SECRET__" "$otp_secret" "$final_path/live/.env.production" +ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "$final_path/live/.env.production" +ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "$final_path/live/.env.production" + #================================================= # UPGRADE MASTODON #================================================= @@ -234,14 +245,16 @@ pushd "$final_path/live" popd # If vapid_private_key doesn't exist, retrieve it or create it -if [[ -z "$vapid_private_key" ]]; then - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.1/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt - vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" "$final_path/live/key.txt") - vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" "$final_path/live/key.txt") - ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" - ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" - ynh_secure_remove "$final_path/live/key.txt" -fi +#if [[ -z "$vapid_private_key" ]]; then +# sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt +# vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K\w+" "$final_path/live/key.txt") +# vapid_public_key=$(grep -oP "VAPID_PUBLIC_KEY=\K\w+" "$final_path/live/key.txt") +# ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key" +# ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key" +# ynh_secure_remove "$final_path/live/key.txt" +# ynh_replace_string "__VAPID_PRIVATE_KEY__" "$vapid_private_key" "${final_path}/live/.env.production" +# ynh_replace_string "__VAPID_PUBLIC_KEY__" "$vapid_public_key" "${final_path}/live/.env.production" +#fi # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "${final_path}/live/.env.production" |
