diff --git a/src/sonic-build-hooks/scripts/buildinfo_base.sh b/src/sonic-build-hooks/scripts/buildinfo_base.sh index 6a55524660..d46ffec183 100755 --- a/src/sonic-build-hooks/scripts/buildinfo_base.sh +++ b/src/sonic-build-hooks/scripts/buildinfo_base.sh @@ -17,7 +17,7 @@ REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian' 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=''