From 23546d9cd29f52e341199fe901ed0ed068f30f41 Mon Sep 17 00:00:00 2001 From: Antoine Lima Date: Sun, 10 Mar 2024 22:54:59 +0100 Subject: [PATCH] Fix permission in the install_dir to that npm can install --- scripts/_common.sh | 5 +++++ scripts/restore | 2 ++ 2 files changed, 7 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index e9c7bde..f6b0dde 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -149,6 +149,11 @@ ynh_setup_my_nodeapp() { ynh_add_config --template="nginx-nodejs.conf" --destination="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_systemd_action --service_name=nginx --action=reload + + # Subsequent npm install will write to this folder (as it is within $app's home) + # As such we prepare it with fitting rights + mkdir -p "$install_dir/.npm" + chown $app:$app "$install_dir/.npm" } ynh_remove_my_nodeapp() { diff --git a/scripts/restore b/scripts/restore index 75f0adb..401e36e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -90,6 +90,8 @@ then ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs.service" ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs-watcher.service" ynh_restore_file --origin_path="/etc/systemd/system/${app}-nodejs-watcher.path" + mkdir -p "$install_dir"/.npm + chown -R $app:$app "$install_dir"/.npm fi #=================================================