diff --git a/scripts/remove b/scripts/remove index 2e28280..c891e99 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,11 +26,6 @@ fi # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index d7e6837..be5a0a4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -21,6 +21,12 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# RESTORE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 + +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # SPECIFIC RESTORATION #================================================= @@ -31,19 +37,12 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_python --python_version=$python_version -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +yunohost service add $app --description "$app daemon" --log="/var/log/$app/$app.log" #================================================= # PYTHON DEPENDENCIES @@ -58,14 +57,6 @@ pushd "$install_dir" ynh_exec_warn_less $ynh_pip install -r $install_dir/requirements.txt popd -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - #================================================= # CONFIGURE LOG DIR #================================================= @@ -74,13 +65,6 @@ mkdir -p /var/log/$app chown -R $app /var/log/$app chgrp -R www-data /var/log/$app -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description "$app daemon" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #=================================================