aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Philipp Wollermann <philwo@google.com>2017-05-08 05:17:06 -0400
committerGravatar Kristina Chodorow <kchodorow@google.com>2017-05-08 09:49:23 -0400
commit720561113bfa702acfc2ca24ce3cc3fd7ee9c115 (patch)
tree71a44e252dd873b193fcbeaf2fdcd9b6667ed7dd
parent0cf3821123c2c697041600179a2a308188c9e313 (diff)
Fix #2958: Installer should not overwrite bazelrc
Closes #2959. Ping #2692 for cherry-picking into Bazel 0.5.0. PiperOrigin-RevId: 155357560
-rwxr-xr-xscripts/packages/template_bin.sh22
1 files changed, 2 insertions, 20 deletions
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh
index c35b2463d6..906a3871d3 100755
--- a/scripts/packages/template_bin.sh
+++ b/scripts/packages/template_bin.sh
@@ -41,25 +41,20 @@ usage() {
echo " --prefix=/some/path set the prefix path (default=/usr/local)." >&2
echo " --bin= set the binary folder path (default=%prefix%/bin)." >&2
echo " --base= set the base install path (default=%prefix%/lib/bazel)." >&2
- echo " --bazelrc= set the path to bazelrc (default=/etc/bazel.bazelrc)." >&2
echo " --user configure for user install, expands to:" >&2
- echo ' --bin=$HOME/bin --base=$HOME/.bazel --bazelrc=$HOME/.bazelrc' >&2
+ echo ' --bin=$HOME/bin --base=$HOME/.bazel' >&2
exit 1
}
prefix="/usr/local"
bin="%prefix%/bin"
base="%prefix%/lib/bazel"
-bazelrc="/etc/bazel.bazelrc"
for opt in "${@}"; do
case $opt in
--prefix=*)
prefix="$(echo "$opt" | cut -d '=' -f 2-)"
;;
- --bazelrc=*)
- bazelrc="$(echo "$opt" | cut -d '=' -f 2-)"
- ;;
--bin=*)
bin="$(echo "$opt" | cut -d '=' -f 2-)"
;;
@@ -69,7 +64,6 @@ for opt in "${@}"; do
--user)
bin="$HOME/bin"
base="$HOME/.bazel"
- bazelrc="$HOME/.bazelrc"
;;
*)
usage
@@ -79,7 +73,6 @@ done
bin="${bin//%prefix%/${prefix}}"
base="${base//%prefix%/${prefix}}"
-bazelrc="${bazelrc//%prefix%/${prefix}}"
test_write() {
local file="$1"
@@ -133,7 +126,6 @@ fi
# Test for write access
test_write "${bin}"
test_write "${base}"
-test_write "${bazelrc}"
# Do the actual installation
echo -n "Uncompressing."
@@ -159,17 +151,7 @@ echo -n .
ln -s "${base}/bin/bazel" "${bin}/bazel"
echo -n .
-if [ -f "${bazelrc}" ]; then
- echo
- echo "${bazelrc} already exists, moving it to ${bazelrc}.bak."
- mv "${bazelrc}" "${bazelrc}.bak"
-fi
-
-# Not necessary, but this way it matches the Debian package.
-touch "${bazelrc}"
-if [ "${UID}" -eq 0 ]; then
- chmod 0644 "${bazelrc}"
-else
+if [ "${UID}" -ne 0 ]; then
# Uncompress the bazel base install for faster startup time
"${bin}/bazel" help >/dev/null
fi