if ${USER} variable is blank, then populate it with whoami

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
pull/5341/head
Adam Warner 10 months ago
parent aec852fa51
commit 6edd6a4d55
No known key found for this signature in database

@ -544,6 +544,13 @@ if [[ ! $EUID -eq 0 && need_root -eq 1 ]];then
exit 1
fi
fi
# In the case of alpine running in a container, the USER variable appears to be blank
# which prevents the next trap from working correctly. Set it by running whoami
if [[ -z ${USER} ]]; then
USER=$(whoami)
fi
# Can also be user pihole for other functions
if [[ ${USER} != "pihole" && need_root -eq 0 ]];then
if [[ -x "$(command -v sudo)" ]]; then

Loading…
Cancel
Save