| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 # | 4 # |
| 5 # This script should not be run directly but sourced by the other | 5 # This script should not be run directly but sourced by the other |
| 6 # scripts (e.g. sysroot-creator-trusty.sh). Its up to the parent scripts | 6 # scripts (e.g. sysroot-creator-trusty.sh). Its up to the parent scripts |
| 7 # to define certain environment variables: e.g. | 7 # to define certain environment variables: e.g. |
| 8 # DISTRO=ubuntu | 8 # DISTRO=ubuntu |
| 9 # DIST=trusty | 9 # DIST=trusty |
| 10 # APT_REPO=http://archive.ubuntu.com/ubuntu | 10 # APT_REPO=http://archive.ubuntu.com/ubuntu |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 fi | 134 fi |
| 135 ARCH_LOWER=$(echo $ARCH | tr '[:upper:]' '[:lower:]') | 135 ARCH_LOWER=$(echo $ARCH | tr '[:upper:]' '[:lower:]') |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 # some sanity checks to make sure this script is run from the right place | 139 # some sanity checks to make sure this script is run from the right place |
| 140 # with the right tools | 140 # with the right tools |
| 141 SanityCheck() { | 141 SanityCheck() { |
| 142 Banner "Sanity Checks" | 142 Banner "Sanity Checks" |
| 143 | 143 |
| 144 local chrome_dir=$(cd "${SCRIPT_DIR}/../../../.." && pwd) | 144 local chrome_dir=$(cd "${SCRIPT_DIR}/../../.." && pwd) |
| 145 BUILD_DIR="${chrome_dir}/out/sysroot-build/${DIST}" | 145 BUILD_DIR="${chrome_dir}/out/sysroot-build/${DIST}" |
| 146 mkdir -p ${BUILD_DIR} | 146 mkdir -p ${BUILD_DIR} |
| 147 echo "Using build directory: ${BUILD_DIR}" | 147 echo "Using build directory: ${BUILD_DIR}" |
| 148 | 148 |
| 149 for tool in ${REQUIRED_TOOLS} ; do | 149 for tool in ${REQUIRED_TOOLS} ; do |
| 150 if ! which ${tool} > /dev/null ; then | 150 if ! which ${tool} > /dev/null ; then |
| 151 echo "Required binary $tool not found." | 151 echo "Required binary $tool not found." |
| 152 echo "Exiting." | 152 echo "Exiting." |
| 153 exit 1 | 153 exit 1 |
| 154 fi | 154 fi |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ${DEBIAN_PACKAGES_X86}" | 208 ${DEBIAN_PACKAGES_X86}" |
| 209 } | 209 } |
| 210 | 210 |
| 211 GeneratePackageListARM() { | 211 GeneratePackageListARM() { |
| 212 local output_file="$1" | 212 local output_file="$1" |
| 213 local package_list="${BUILD_DIR}/Packages.${DIST}_arm.bz2" | 213 local package_list="${BUILD_DIR}/Packages.${DIST}_arm.bz2" |
| 214 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm" | 214 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm" |
| 215 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}" | 215 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}" |
| 216 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}" | 216 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}" |
| 217 ExtractPackageBz2 "$package_list" "$tmp_package_list" | 217 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 218 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" | 218 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} |
| 219 ${DEBIAN_PACKAGES_ARM}" |
| 219 } | 220 } |
| 220 | 221 |
| 221 GeneratePackageListMips() { | 222 GeneratePackageListMips() { |
| 222 local output_file="$1" | 223 local output_file="$1" |
| 223 local package_list="${BUILD_DIR}/Packages.${DIST}_mips.bz2" | 224 local package_list="${BUILD_DIR}/Packages.${DIST}_mips.bz2" |
| 224 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_mips" | 225 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_mips" |
| 225 DownloadOrCopy "${PACKAGE_LIST_MIPS}" "${package_list}" | 226 DownloadOrCopy "${PACKAGE_LIST_MIPS}" "${package_list}" |
| 226 VerifyPackageListing "${PACKAGE_FILE_MIPS}" "${package_list}" | 227 VerifyPackageListing "${PACKAGE_FILE_MIPS}" "${package_list}" |
| 227 ExtractPackageBz2 "$package_list" "$tmp_package_list" | 228 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 228 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" | 229 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 # | 561 # |
| 561 # VerifyPackageListing | 562 # VerifyPackageListing |
| 562 # | 563 # |
| 563 # Verifies the downloaded Packages.bz2 file has the right checksums. | 564 # Verifies the downloaded Packages.bz2 file has the right checksums. |
| 564 # | 565 # |
| 565 VerifyPackageListing() { | 566 VerifyPackageListing() { |
| 566 local file_path=$1 | 567 local file_path=$1 |
| 567 local output_file=$2 | 568 local output_file=$2 |
| 568 local release_file="${BUILD_DIR}/${RELEASE_FILE}" | 569 local release_file="${BUILD_DIR}/${RELEASE_FILE}" |
| 569 local release_file_gpg="${BUILD_DIR}/${RELEASE_FILE_GPG}" | 570 local release_file_gpg="${BUILD_DIR}/${RELEASE_FILE_GPG}" |
| 570 local tmp_keyring_file="${BUILD_DIR}/keyring.gpg" | 571 local local_keyring_file="${BUILD_DIR}/keyring.gpg" |
| 571 | 572 |
| 572 CheckForDebianGPGKeyring | 573 CheckForDebianGPGKeyring |
| 573 | 574 |
| 574 DownloadOrCopy ${RELEASE_LIST} ${release_file} | 575 DownloadOrCopy ${RELEASE_LIST} ${release_file} |
| 575 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg} | 576 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg} |
| 577 if [ ! -f "${local_keyring_file}" ]; then |
| 578 echo "Generating keyring: ${local_keyring_file}" |
| 579 set -x |
| 580 cp "${KEYRING_FILE}" "${local_keyring_file}" |
| 581 gpg --primary-keyring "${local_keyring_file}" --recv-keys 2B90D010 |
| 582 set +x |
| 583 fi |
| 576 echo "Verifying: ${release_file} with ${release_file_gpg}" | 584 echo "Verifying: ${release_file} with ${release_file_gpg}" |
| 577 cp "${KEYRING_FILE}" "${tmp_keyring_file}" | 585 gpgv --keyring "${local_keyring_file}" "${release_file_gpg}" "${release_file}" |
| 578 gpg --primary-keyring "${tmp_keyring_file}" --recv-keys 2B90D010 | |
| 579 gpgv --keyring "${tmp_keyring_file}" "${release_file_gpg}" "${release_file}" | |
| 580 | 586 |
| 581 echo "Verifying: ${output_file}" | 587 echo "Verifying: ${output_file}" |
| 582 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2) | 588 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2) |
| 583 local sha256sum=$(echo ${checksums} | cut -d " " -f 3) | 589 local sha256sum=$(echo ${checksums} | cut -d " " -f 3) |
| 584 | 590 |
| 585 if [ "${#sha256sum}" -ne "64" ]; then | 591 if [ "${#sha256sum}" -ne "64" ]; then |
| 586 echo "Bad sha256sum from ${RELEASE_LIST}" | 592 echo "Bad sha256sum from ${RELEASE_LIST}" |
| 587 exit 1 | 593 exit 1 |
| 588 fi | 594 fi |
| 589 | 595 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 echo " $0 help" | 697 echo " $0 help" |
| 692 exit 1 | 698 exit 1 |
| 693 else | 699 else |
| 694 ChangeDirectory | 700 ChangeDirectory |
| 695 if echo $1 | grep -qs "All$"; then | 701 if echo $1 | grep -qs "All$"; then |
| 696 "$@" | 702 "$@" |
| 697 else | 703 else |
| 698 RunCommand "$@" | 704 RunCommand "$@" |
| 699 fi | 705 fi |
| 700 fi | 706 fi |
| OLD | NEW |