docker: do not always require root privileges for docker build (#1579)

due to docker can be running normal user, and inside docker can be root.

so drop root privileges for docker build.

Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
This commit is contained in:
zhangn1985
2019-09-29 17:42:41 +08:00
committed by Igor Pečovnik
parent 507a19ff0d
commit 552f4bdb4e

View File

@@ -29,7 +29,11 @@ else
exit 255 exit 255
fi fi
if [[ $EUID != 0 && "$1" != vagrant ]]; then if [[ $EUID == 0 ]] || [[ "$1" == vagrant ]]; then
:
elif [[ "$1" == docker ]] && grep -q `whoami` <(getent group docker); then
:
else
display_alert "This script requires root privileges, trying to use sudo" "" "wrn" display_alert "This script requires root privileges, trying to use sudo" "" "wrn"
sudo "$SRC/compile.sh" "$@" sudo "$SRC/compile.sh" "$@"
exit $? exit $?