Split check for return code and user

Signed-off-by: yubiuser <github@yubiuser.dev>
This commit is contained in:
yubiuser
2025-04-20 17:59:16 +02:00
parent 46948eb5c1
commit bff5de6a97

View File

@@ -251,9 +251,12 @@ fix_capabilities() {
setcap "${CAP_STR:1}"+ep "$(which pihole-FTL)" || ret=$? setcap "${CAP_STR:1}"+ep "$(which pihole-FTL)" || ret=$?
if [[ $ret -ne 0 && "${DNSMASQ_USER:-pihole}" != "root" ]]; then if [[ $ret -ne 0 ]]; then
echo " [!] ERROR: Unable to set capabilities for pihole-FTL. Cannot run as non-root." echo " [!] ERROR: Unable to set capabilities for pihole-FTL. "
echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'" 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 exit 1
fi fi
else else