Only run `bazel help` if the user isn't root
Fixes #739.
--
MOS_MIGRATED_REVID=116257685
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh
index e852fd5..81ddc85 100755
--- a/scripts/packages/template_bin.sh
+++ b/scripts/packages/template_bin.sh
@@ -155,9 +155,6 @@
ln -s "${base}/bin/bazel" "${bin}/bazel"
echo -n .
-# Uncompress the bazel base install for faster startup time
-"${bin}/bazel" help >/dev/null
-
if [ -f "${bazelrc}" ]; then
echo
echo "${bazelrc} already exists, moving it to ${bazelrc}.bak."
@@ -166,8 +163,11 @@
# Not necessary, but this way it matches the Debian package.
touch "${bazelrc}"
-if [ "${UID}" == 0 ]; then
+if [ "${UID}" -eq 0 ]; then
chmod 0644 "${bazelrc}"
+else
+ # Uncompress the bazel base install for faster startup time
+ "${bin}/bazel" help >/dev/null
fi
echo .