From bf44830db10874b575fdd6b393adfa8ba787ee39 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 2 Jul 2021 08:11:53 +0200 Subject: [PATCH] Fix --- conf/systemd.service | 2 +- scripts/install | 3 +-- scripts/restore | 11 ++++------- scripts/upgrade | 26 ++++++++------------------ 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index b64ec93..2b4ca77 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,7 +1,7 @@ [Unit] Description=NodeBB Documentation=https://docs.nodebb.org -After=system.slice multi-user.target mongod.service +After=system.slice multi-user.target [Service] Type=forking diff --git a/scripts/install b/scripts/install index 06e5fe8..90d9aab 100644 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,6 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#ynh_install_mongo #================================================= # CREATE A MYSQL DATABASE @@ -120,7 +119,7 @@ chown -R $app:www-data "$final_path" # CONFIGURE NODEBB #================================================= -chown -R $app: $final_path +chown -R $app $final_path #pushd $final_path #ynh_exec_as $app env $ynh_node_load_PATH diff --git a/scripts/restore b/scripts/restore index be76fd2..10556ae 100644 --- a/scripts/restore +++ b/scripts/restore @@ -59,6 +59,10 @@ ynh_script_progression --message="Restoring the app main directory..." --time -- ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -67,13 +71,6 @@ ynh_script_progression --message="Recreating the dedicated system user..." --tim # Create the dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R $app:$app $final_path - #================================================= # RESTORE THE MYSQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a1e018c..84eeb3f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -64,16 +64,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - -# Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -97,6 +87,14 @@ ynh_script_progression --message="Stopping a systemd service..." --time --weight ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -124,14 +122,6 @@ ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SETUP SYSTEMD #=================================================