From fd52fa4df432f4586de1718a6757a0d00cbeeb3b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 12 Jun 2020 05:47:09 +0200 Subject: [PATCH] cleanup --- scripts/install | 14 +++++++------- scripts/restore | 1 - scripts/upgrade | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index 49a53bca..09629431 100644 --- a/scripts/install +++ b/scripts/install @@ -147,13 +147,13 @@ ynh_script_progression --message="Modifying a config file..." config="$final_path/.env" cp ../conf/.env "$config" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__APP_KEY__" --replace_string="$app_key" --target_file="$config" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" +ynh_replace_string --match_string="__APP_KEY__" --replace_string="$app_key" --target_file="$config" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/restore b/scripts/restore index e243477c..b660b1ac 100644 --- a/scripts/restore +++ b/scripts/restore @@ -102,7 +102,6 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." -ynh_psql_test_if_first_run db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) ynh_psql_test_if_first_run ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd" diff --git a/scripts/upgrade b/scripts/upgrade index 4527df96..e18efe1e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,17 +43,17 @@ ynh_script_progression --message="Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app="$app" --key=is_public --value=1 + ynh_app_setting_set --app=$app --key=is_public --value=1 is_public=1 elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app="$app" --key=is_public --value=0 + ynh_app_setting_set --app=$app --key=is_public --value=0 is_public=0 fi # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name="$app") - ynh_app_setting_set --app="$app" --key=db_name --value="$db_name" + ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi # If final_path doesn't exist, create it @@ -205,13 +205,13 @@ config="$final_path/.env" ynh_backup_if_checksum_is_different --file="$config" cp ../conf/.env "$config" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__APP_KEY__" --replace_string="$app_key" --target_file="$config" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" +ynh_replace_string --match_string="__APP_KEY__" --replace_string="$app_key" --target_file="$config" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config" +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" +ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$config"