From 65feff7a2eddfe797c4061fe3a7c9a74888c8a36 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 9 Oct 2020 13:51:09 +0200 Subject: [PATCH] fix --- scripts/install | 13 ++++++++----- scripts/remove | 8 -------- scripts/restore | 17 ++++++++--------- scripts/upgrade | 2 +- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/scripts/install b/scripts/install index 582f31f..dcccc14 100644 --- a/scripts/install +++ b/scripts/install @@ -108,7 +108,13 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --targ ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$final_path/user/config.php" ynh_replace_string --match_string="__RANDOM__" --replace_string="$(ynh_string_random 24)" --target_file="$final_path/user/config.php" -# Set permissions +# Calculate and store the config file checksum into the app settings +ynh_store_file_checksum "$final_path/user/config.php" + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + chown -R $app: $final_path # Reload Nginx and regenerate SSOwat conf @@ -124,13 +130,10 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=3 ynh_systemd_action --service_name=nginx --action=reload sleep 10 -# Start Yourls install (database table creation) +# Start YOURLS install (database table creation) ynh_local_curl "admin/install.php" "install=dummy" sleep 10 -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/user/config.php" - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index 0bd4b1a..bfc5c6f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,14 +28,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=2 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 71bfd96..c180eb4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,15 +58,6 @@ ynh_script_progression --message="Restoring YOURLS main directory..." --weight=3 ynh_restore_file --origin_path="$final_path" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=5 - -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -91,6 +82,14 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=5 + +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 58a0005..17268b6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -133,7 +133,7 @@ ynh_store_file_checksum --file="$final_path/user/config.php" # SECURE FILES AND DIRECTORIES #================================================= -# Set right permissions for curl installation +# Restore permissions on app files chown -R $app: $final_path #=================================================