From e72fd346d04de338eb7eee071a2e43ef3fd0f03a Mon Sep 17 00:00:00 2001
From: Marco Cunha <marco.cunha@gmail.com>
Date: Tue, 21 May 2024 00:31:56 +0100
Subject: [PATCH] Ensure logrotate doesn't use non-existing npm user

Upstream uses a dedicated user to run NPM. Ensure we do not try to user the missing user to rotate logs [which fails].
---
 install/nginxproxymanager-install.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/install/nginxproxymanager-install.sh b/install/nginxproxymanager-install.sh
index ae267817..4a0873a8 100644
--- a/install/nginxproxymanager-install.sh
+++ b/install/nginxproxymanager-install.sh
@@ -193,6 +193,7 @@ customize
 
 msg_info "Starting Services"
 sed -i 's/user npm/user root/g; s/^pid/#pid/g' /usr/local/openresty/nginx/conf/nginx.conf
+sed -r -i 's/^([[:space:]]*)su npm npm/\1#su npm npm/g;' /etc/logrotate.d/nginx-proxy-manager
 sed -i 's/include-system-site-packages = false/include-system-site-packages = true/g' /opt/certbot/pyvenv.cfg
 systemctl enable -q --now openresty
 systemctl enable -q --now npm