From bff5de6a974a90645c423702049b9c0b051ecdf5 Mon Sep 17 00:00:00 2001 From: yubiuser Date: Sun, 20 Apr 2025 17:59:16 +0200 Subject: [PATCH] Split check for return code and user Signed-off-by: yubiuser --- src/bash_functions.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bash_functions.sh b/src/bash_functions.sh index 52a0bf0..d47ddd0 100644 --- a/src/bash_functions.sh +++ b/src/bash_functions.sh @@ -251,9 +251,12 @@ fix_capabilities() { setcap "${CAP_STR:1}"+ep "$(which pihole-FTL)" || ret=$? - if [[ $ret -ne 0 && "${DNSMASQ_USER:-pihole}" != "root" ]]; then - echo " [!] ERROR: Unable to set capabilities for pihole-FTL. Cannot run as non-root." - echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'" + if [[ $ret -ne 0 ]]; then + echo " [!] ERROR: Unable to set capabilities for pihole-FTL. " + if [[ "${DNSMASQ_USER:-pihole}" != "root" ]]; then + echo " Cannot run as non-root." + echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'" + fi exit 1 fi else