mirror of
https://github.com/YunoHost-Apps/glitchsoc_ynh.git
synced 2024-09-03 19:15:59 +02:00
fix upgrade
This commit is contained in:
parent
d9c84a8297
commit
9719db911b
1 changed files with 16 additions and 3 deletions
|
@ -72,7 +72,7 @@ fi
|
||||||
|
|
||||||
# If paperclip_secret doesn't exist, retrieve it or create it
|
# If paperclip_secret doesn't exist, retrieve it or create it
|
||||||
if [[ -z "$paperclip_secret" ]]; then
|
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
|
if [[ -z "$paperclip_secret" ]]; then
|
||||||
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
paperclip_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||||
fi
|
fi
|
||||||
|
@ -81,7 +81,7 @@ fi
|
||||||
|
|
||||||
# If secret_key_base doesn't exist, retrieve it or create it
|
# If secret_key_base doesn't exist, retrieve it or create it
|
||||||
if [[ -z "$secret_key_base" ]]; then
|
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
|
if [[ -z "$secret_key_base" ]]; then
|
||||||
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
secret_key_base=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||||
fi
|
fi
|
||||||
|
@ -90,13 +90,21 @@ fi
|
||||||
|
|
||||||
# If otp_secret doesn't exist, retrieve it or create it
|
# If otp_secret doesn't exist, retrieve it or create it
|
||||||
if [[ -z "$otp_secret" ]]; then
|
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
|
if [[ -z "$otp_secret" ]]; then
|
||||||
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
otp_secret=$(head -n128 /dev/urandom | tail -n +1 | tr -dc -d 'a-z0-9' | head -c128)
|
||||||
fi
|
fi
|
||||||
ynh_app_setting_set "$app" otp_secret "$otp_secret"
|
ynh_app_setting_set "$app" otp_secret "$otp_secret"
|
||||||
fi
|
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
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -211,6 +219,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 "__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
|
# UPGRADE MASTODON
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -239,6 +250,8 @@ if [[ -z "$vapid_private_key" ]]; then
|
||||||
ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key"
|
ynh_app_setting_set "$app" vapid_private_key "$vapid_private_key"
|
||||||
ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key"
|
ynh_app_setting_set "$app" vapid_public_key "$vapid_public_key"
|
||||||
ynh_secure_remove "$final_path/live/key.txt"
|
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
|
fi
|
||||||
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
|
|
Loading…
Reference in a new issue