aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar andy g scott ? <andyscott@users.noreply.github.com>2018-06-18 09:05:31 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-18 09:07:26 -0700
commit4dd6dacf2d095ec712eeecdb3b476c851674d382 (patch)
treee579569b8435f580302f6ec37f42720bd21bd4d1 /scripts
parenta86c267ed31999f6e6f6d5f206526775b804d3a0 (diff)
Add flag to skip early base extraction
This adds a flag to the installer to skip uncompressing the base image during installation. Uncompressing the base image during installation can be problematic: 1. If you configure the startup option `output_user_root` you'll wind up extracting the image twice. Once during installation and a second time during the first bazel invocation in your project. 2. If you're bootstrapping Bazel in a controlled environment (in my case via Nix) then you can get permission errors if Bazel defaults to extracting to the home directory. There's no way to skip this extraction and for the time being I have resorted to seting `HOME` to a throw away directory during install. Closes #5303. PiperOrigin-RevId: 201004235
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/packages/template_bin.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh
index ae332af6f6..355c713669 100755
--- a/scripts/packages/template_bin.sh
+++ b/scripts/packages/template_bin.sh
@@ -43,12 +43,15 @@ usage() {
echo " --base= set the base install path (default=%prefix%/lib/bazel)." >&2
echo " --user configure for user install, expands to:" >&2
echo ' --bin=$HOME/bin --base=$HOME/.bazel' >&2
+ echo " --skip-uncompress skip uncompressing the base image until the" >&2
+ echo " first bazel invocation" >&2
exit 1
}
prefix="/usr/local"
bin="%prefix%/bin"
base="%prefix%/lib/bazel"
+should_uncompress=true
for opt in "${@}"; do
case $opt in
@@ -65,6 +68,9 @@ for opt in "${@}"; do
bin="$HOME/bin"
base="$HOME/.bazel"
;;
+ --skip-uncompress)
+ should_uncompress=false
+ ;;
*)
usage
;;
@@ -158,7 +164,7 @@ echo -n .
ln -s "${base}/bin/bazel" "${bin}/bazel"
echo -n .
-if [ "${UID}" -ne 0 ]; then
+if [ "${should_uncompress}" = true ] && [ "${UID}" -ne 0 ]; then
# Uncompress the bazel base install for faster startup time
"${bin}/bazel" help >/dev/null
fi