From 9f4e21589629b300c4f2833d7033fbed006c42e8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 20:18:30 +0200 Subject: [PATCH] Fix rights --- scripts/install | 20 +++++++++----------- scripts/restore | 2 +- scripts/upgrade | 20 +++++++++----------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/scripts/install b/scripts/install index f1b2dc9..58c5750 100644 --- a/scripts/install +++ b/scripts/install @@ -86,7 +86,7 @@ ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -120,8 +120,6 @@ mkdir -p "$final_path/distbin-db/inbox" #================================================= ynh_script_progression --message="Installing Distbin..." -chown -R "$app":"$app" "$final_path" - pushd $final_path ynh_use_nodejs ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts @@ -133,14 +131,6 @@ pushd $final_path/dist ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -151,6 +141,14 @@ ynh_add_config --template="../conf/.env" --destination="$final_path/.env" chmod 400 "$final_path/.env" chown $app:$app "$final_path/.env" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 29499be..b8501d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # CREATE LOG FOLDER diff --git a/scripts/upgrade b/scripts/upgrade index 593a74a..75fcdf5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,7 +86,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -130,8 +130,6 @@ fi #================================================= ynh_script_progression --message="Making upgrade..." -chown -R "$app":"$app" "$final_path" - pushd $final_path ynh_use_nodejs ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts @@ -143,14 +141,6 @@ pushd $final_path/dist ynh_exec_warn_less sudo -u $app $ynh_node_load_PATH $ynh_npm install --ignore-scripts --production popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # UPDATE A CONFIG FILE #================================================= @@ -161,6 +151,14 @@ ynh_add_config --template="../conf/.env" --destination="$final_path/.env" chmod 400 "$final_path/.env" chown $app:$app "$final_path/.env" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Upgrading systemd configuration..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #=================================================