mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-25 23:53:17 +00:00
If ${USER} variable is blank, then populate it with whoami (#5341)
This commit is contained in:
commit
eda83a4141
1 changed files with 7 additions and 0 deletions
7
pihole
7
pihole
|
@ -544,6 +544,13 @@ if [[ ! $EUID -eq 0 && need_root -eq 1 ]];then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
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
|
# Can also be user pihole for other functions
|
||||||
if [[ ${USER} != "pihole" && need_root -eq 0 ]];then
|
if [[ ${USER} != "pihole" && need_root -eq 0 ]];then
|
||||||
if [[ -x "$(command -v sudo)" ]]; then
|
if [[ -x "$(command -v sudo)" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue