diff --git a/scripts/_common.sh b/scripts/_common.sh index 07a84ad..cbc1622 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,9 @@ # COMMON VARIABLES #================================================= +# dependencies used by the app +pkg_dependencies="postgresql" + # dependencies used by the app YNH_PHP_VERSION="7.3" diff --git a/scripts/install b/scripts/install index 0513cde..5fa6d7a 100755 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,18 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= +<<<<<<< Updated upstream # CREATE A POSTGRESQL DATABASE +======= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=20 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# CREATE A MYSQL DATABASE +>>>>>>> Stashed changes #================================================= ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 diff --git a/scripts/remove b/scripts/remove index 716072b..3f8042b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -30,6 +30,17 @@ ynh_script_progression --message="Removing the PostgreSQL database..." --weight= # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user=$db_user --db_name=$db_name +<<<<<<< Updated upstream +======= + +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies +>>>>>>> Stashed changes #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index c6710a0..6f74f19 100644 --- a/scripts/restore +++ b/scripts/restore @@ -49,6 +49,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -56,6 +64,18 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=6 + +# Define and install dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= @@ -65,14 +85,6 @@ ynh_psql_test_if_first_run 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 -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # RESTORE USER RIGHTS #=================================================