From 3d0687519d89edb0dfbf5a0de4e03453d89cd443 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 25 Jun 2023 18:09:03 +0200 Subject: [PATCH] V2 --- scripts/restore | 57 +++---------------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/scripts/restore b/scripts/restore index e8f1622..4405768 100755 --- a/scripts/restore +++ b/scripts/restore @@ -11,48 +11,8 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_install_ruby__2 source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -82,14 +42,10 @@ chown -R $app:www-data "$data_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1 +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies ynh_install_nodejs --nodejs_version=$nodejs_version -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" -apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -cs) main" --package="libnginx-mod-http-passenger" ynh_install_ruby --ruby_version=$ruby_version #================================================= @@ -102,11 +58,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -#REMOVEME? ynh_psql_test_if_first_run -#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= @@ -128,15 +81,11 @@ popd ynh_script_progression --message="Building app..." --weight=1 pushd "$install_dir/live" -#REMOVEME? ynh_secure_remove --file="$install_dir/live/Gemfile.lock" + ynh_secure_remove --file="$install_dir/live/Gemfile.lock" bundle install ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path bin/rails assets:precompile popd -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies -#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -cs) main" --package="libnginx-mod-http-passenger" -ynh_package_autoremove - #================================================= # RESTORE VARIOUS FILES #=================================================