Skip to content

Commit cb9fe3d

Browse files
committed
Split check for return code and user
Signed-off-by: yubiuser <[email protected]>
1 parent 1ef7039 commit cb9fe3d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/bash_functions.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ fix_capabilities() {
251251

252252
setcap "${CAP_STR:1}"+ep "$(which pihole-FTL)" || ret=$?
253253

254-
if [[ $ret -ne 0 && "${DNSMASQ_USER:-pihole}" != "root" ]]; then
255-
echo " [!] ERROR: Unable to set capabilities for pihole-FTL. Cannot run as non-root."
256-
echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'"
254+
if [[ $ret -ne 0 ]]; then
255+
echo " [!] ERROR: Unable to set capabilities for pihole-FTL. "
256+
if [[ "${DNSMASQ_USER:-pihole}" != "root" ]]; then
257+
echo " Cannot run as non-root."
258+
echo " If you are seeing this error, please set the environment variable 'DNSMASQ_USER' to the value 'root'"
259+
fi
257260
exit 1
258261
fi
259262
else

0 commit comments

Comments
 (0)