From f5c876edf3253b1144df880702fd8766507934f9 Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Tue, 11 Jan 2022 16:48:04 +0800 Subject: [PATCH] [build] docker-sonic-mgmt replace USER by whoami (#9702) --- src/sonic-build-hooks/scripts/buildinfo_base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 0333345cc9ce..1c2f76554b28 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -18,7 +18,7 @@ DPKG_INSTALLTION_LOCK_FILE=/tmp/.dpkg_installation.lock URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#") -if [ $USER != 'root' ] && [ -n $(which sudo) ];then +if [ "$(whoami)" != "root" ] && [ -n "$(which sudo)" ];then SUDO=sudo else SUDO=''