From cfea07c39a33d3a19bb477f4224e2399f866b736 Mon Sep 17 00:00:00 2001 From: Fabian Wilkens Date: Sun, 24 Jan 2021 11:36:36 +0100 Subject: [PATCH] Fix some upgrade script issues --- conf/message | 2 +- scripts/upgrade | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/conf/message b/conf/message index 09b8a8a..f26ef93 100644 --- a/conf/message +++ b/conf/message @@ -1,5 +1,5 @@ Standard Notes - Syncing Server was successfully __TYPE__. -Please configure the Standard Notes web app or mobile app to use this syninc server: https://__DOMAIN____PATH_URL__/ +Please configure the Standard Notes web app or mobile app to use this syning server: https://__DOMAIN____PATH_URL__/ __ACTION__ __CONFIG_PANEL__ __EXTENSIONS__ diff --git a/scripts/upgrade b/scripts/upgrade index e3256a0..9cac568 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -81,9 +81,9 @@ fi if [[ ! -d "$final_path/live/public/extensions/" || \ ! -d "$final_path/live/public/extensions/src/" ]] then - if test -e "$../sources/extra_files/app" + if test -e "../sources/extra_files/app" then - cp -a $../sources/extra_files/app/. "$final_path/" + cp -a "../sources/extra_files/app/." "$final_path/live" fi fi @@ -174,22 +174,20 @@ ynh_system_user_create --username=$app --home_dir=$final_path # MODIFY A CONFIG FILE #================================================= config_file="$final_path/live/.env" -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Modifying a config file..." --weight=2 +ynh_script_progression --message="Modifying a config file..." --weight=2 + +cp -f ../conf/env.sample $config_file +ynh_replace_string --match_string="EXPOSED_PORT=3000" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file" +secret_key=$(ynh_string_random --length=48 | base64) +ynh_replace_string --match_string="SECRET_KEY_BASE=changeme123" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file" +pseudo_key=$(ynh_string_random --length=48 | base64) +ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=changeme456" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file" +ynh_replace_string --match_string="RAILS_ENV=development" --replace_string="RAILS_ENV=production" --target_file="$config_file" +ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file" +ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file" +ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file" +ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file" - cp -f ../conf/env.sample $config_file - ynh_replace_string --match_string="EXPOSED_PORT=3000" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file" - secret_key=$(ynh_string_random --length=48 | base64) - ynh_replace_string --match_string="SECRET_KEY_BASE=changeme123" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file" - pseudo_key=$(ynh_string_random --length=48 | base64) - ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=changeme456" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file" - ynh_replace_string --match_string="RAILS_ENV=development" --replace_string="RAILS_ENV=production" --target_file="$config_file" - ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file" - ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file" - ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file" - ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file" -fi #================================================= # INSTALLING Standard Notes - Synicing Server #=================================================