Philipp Wollermann | a5afe95 | 2016-06-21 14:58:09 +0000 | [diff] [blame] | 1 | #!/bin/sh |
Lukacs Berki | eb851fe | 2015-10-19 10:52:31 +0000 | [diff] [blame] | 2 | # |
| 3 | # Copyright 2015 The Bazel Authors. All rights reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
Philipp Wollermann | a5afe95 | 2016-06-21 14:58:09 +0000 | [diff] [blame] | 17 | set -eu |
| 18 | |
Lukacs Berki | eb851fe | 2015-10-19 10:52:31 +0000 | [diff] [blame] | 19 | # This script bootstraps building a Bazel binary without Bazel then |
| 20 | # use this compiled Bazel to bootstrap Bazel itself. It can also |
| 21 | # be provided with a previous version of Bazel to bootstrap Bazel |
| 22 | # itself. |
| 23 | |
| 24 | WORKDIR=$(pwd) |
| 25 | OUT=$1 |
| 26 | EMBEDDED_TOOLS=$2 |
| 27 | DEPLOY_JAR=$3 |
| 28 | INSTALL_BASE_KEY=$4 |
| 29 | shift 4 |
| 30 | |
| 31 | TMP_DIR=${TMPDIR:-/tmp} |
| 32 | PACKAGE_DIR="$(mktemp -d ${TMP_DIR%%/}/bazel.XXXXXXXX)" |
| 33 | mkdir -p "${PACKAGE_DIR}" |
| 34 | trap "rm -fr ${PACKAGE_DIR}" EXIT |
| 35 | |
| 36 | cp $* ${PACKAGE_DIR} |
| 37 | cp ${DEPLOY_JAR} ${PACKAGE_DIR}/A-server.jar |
| 38 | cp ${INSTALL_BASE_KEY} ${PACKAGE_DIR}/install_base_key |
| 39 | # The timestamp of embedded tools should already be zeroed out in the input zip |
| 40 | touch -t 198001010000.00 ${PACKAGE_DIR}/* |
| 41 | |
Klaus Aehlig | 2571982 | 2016-06-14 08:45:44 +0000 | [diff] [blame] | 42 | if [ -n "${EMBEDDED_TOOLS}" ]; then |
Lukacs Berki | eb851fe | 2015-10-19 10:52:31 +0000 | [diff] [blame] | 43 | mkdir ${PACKAGE_DIR}/embedded_tools |
| 44 | (cd ${PACKAGE_DIR}/embedded_tools && unzip -q ${WORKDIR}/${EMBEDDED_TOOLS}) |
| 45 | fi |
| 46 | |
Lukacs Berki | c4e74d1 | 2015-11-10 15:28:00 +0000 | [diff] [blame] | 47 | (cd ${PACKAGE_DIR} && find . -type f | sort | zip -qDX@ ${WORKDIR}/${OUT}) |