Apply suggestions from code review

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2023-01-03 21:20:22 +01:00
parent f713b14ba0
commit 9e47b61c8f
No known key found for this signature in database

View file

@ -38,15 +38,16 @@ start() {
sh "${PI_HOLE_SCRIPT_DIR}/pihole-FTL-prestart.sh"
if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN,CAP_SYS_NICE,CAP_IPC_LOCK,CAP_CHOWN+eip "/usr/bin/pihole-FTL"; then
su -s /bin/sh -c "/usr/bin/pihole-FTL" pihole || ec=$?
su -s /bin/sh -c "/usr/bin/pihole-FTL" pihole
else
echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system"
/usr/bin/pihole-FTL || ec=$?
/usr/bin/pihole-FTL
fi
rc=$?
# Cleanup if startup failed
if [ -n "${ec}" ] && [ "${ec}" != 0 ]; then
if [ "${rc}" != 0 ]; then
cleanup
exit $ec
exit $rc
fi
echo
fi