Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: chrome/installer/linux/sysroot_scripts/sysroot-creator-debian.wheezy.sh

Issue 61493002: Linux: Verify checksums when downloading Debian Packages.bz2 files in the sysroot script. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 #@ This script builds a Debian Wheezy sysroot for building Google Chrome. 7 #@ This script builds a Debian Wheezy sysroot for building Google Chrome.
8 #@ 8 #@
9 #@ Generally this script is invoked as: 9 #@ Generally this script is invoked as:
10 #@ sysroot-creator-debian.wheezy.sh <mode> <args>* 10 #@ sysroot-creator-debian.wheezy.sh <mode> <args>*
(...skipping 15 matching lines...) Expand all
26 readonly INSTALL_ROOT_I386=$(pwd)/debian_wheezy_i386_staging 26 readonly INSTALL_ROOT_I386=$(pwd)/debian_wheezy_i386_staging
27 27
28 readonly REQUIRED_TOOLS="wget" 28 readonly REQUIRED_TOOLS="wget"
29 29
30 ###################################################################### 30 ######################################################################
31 # Package Config 31 # Package Config
32 ###################################################################### 32 ######################################################################
33 33
34 # this is where we get all the debian packages from 34 # this is where we get all the debian packages from
35 readonly DEBIAN_REPO=http://http.us.debian.org/debian 35 readonly DEBIAN_REPO=http://http.us.debian.org/debian
36 readonly REPO_BASEDIR="${DEBIAN_REPO}/dists/wheezy"
36 37
37 readonly PACKAGE_LIST_AMD64="${DEBIAN_REPO}/dists/wheezy/main/binary-amd64/Packa ges.bz2" 38 readonly RELEASE_FILE="Release"
38 readonly PACKAGE_LIST_I386="${DEBIAN_REPO}/dists/wheezy/main/binary-i386/Package s.bz2" 39 readonly RELEASE_FILE_GPG="Release.gpg"
40 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}"
41 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}"
42 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2"
43 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2"
44 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}"
45 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}"
39 46
40 # Sysroot packages: these are the packages needed to build chrome. 47 # Sysroot packages: these are the packages needed to build chrome.
41 # NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated 48 # NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated
42 # by running this script in GeneratePackageList mode. 49 # by running this script in GeneratePackageList mode.
43 readonly DEBIAN_PACKAGES="\ 50 readonly DEBIAN_PACKAGES="\
44 comerr-dev \ 51 comerr-dev \
45 gcc-4.6 \ 52 gcc-4.6 \
46 krb5-multidev \ 53 krb5-multidev \
47 libasound2 \ 54 libasound2 \
48 libasound2-dev \ 55 libasound2-dev \
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 #@ Build everything and package it 450 #@ Build everything and package it
444 BuildSysrootI386() { 451 BuildSysrootI386() {
445 ClearInstallDir 452 ClearInstallDir
446 InstallIntoSysroot ${DEBIAN_DEP_FILES_I386} 453 InstallIntoSysroot ${DEBIAN_DEP_FILES_I386}
447 CleanupJailSymlinks 454 CleanupJailSymlinks
448 HacksAndPatchesI386 455 HacksAndPatchesI386
449 CreateTarBall $1 456 CreateTarBall $1
450 } 457 }
451 458
452 # 459 #
460 # CheckForDebianGPGKeys
461 #
462 # Make sure the Debian GPG keys exist. Otherwise print a helpful message.
463 #
464 CheckForDebianGPGKeys() {
465 if [ ! -e "/etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg" ] ||
466 [ ! -e "/etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg" ]; then
467 echo "Debian GPG keys missing. Install the debian-archive-keyring package."
468 exit 1
469 fi
470 }
471
472 #
473 # VerifyPackageListing
474 #
475 # Verifies the downloaded Packages.bz2 file has the right checksums.
476 #
477 VerifyPackageListing() {
478 local file_path=$1
479 local output_file=$2
480 local release_file="${TMP}/${RELEASE_FILE}"
481 local release_file_gpg="${TMP}/${RELEASE_FILE_GPG}"
482
483 CheckForDebianGPGKeys
484
485 DownloadOrCopy ${RELEASE_LIST} ${release_file}
486 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg}
487 echo "Verifying: ${release_file} with ${release_file_gpg}"
488 gpgv --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg \
489 --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg \
490 ${release_file_gpg} ${release_file}
491
492 echo "Verifying: ${output_file}"
493 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2)
494 local md5sum=$(echo ${checksums} | cut -d " " -f 1)
495 local sha1sum=$(echo ${checksums} | cut -d " " -f 2)
496 local sha256sum=$(echo ${checksums} | cut -d " " -f 3)
497
498 if [ "${#md5sum}" -ne "32" ]; then
499 echo "Bad md5sum from ${RELEASE_LIST}"
500 exit 1
501 fi
502 if [ "${#sha1sum}" -ne "40" ]; then
503 echo "Bad sha1sum from ${RELEASE_LIST}"
504 exit 1
505 fi
506 if [ "${#sha256sum}" -ne "64" ]; then
507 echo "Bad sha256sum from ${RELEASE_LIST}"
508 exit 1
509 fi
510
511 echo "${md5sum} ${output_file}" | md5sum --quiet -c
512 echo "${sha1sum} ${output_file}" | sha1sum --quiet -c
513 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c
514 }
515
516 #
453 # GeneratePackageList 517 # GeneratePackageList
454 # 518 #
455 # Looks up package names in ${TMP}/Packages and write list of URLs 519 # Looks up package names in ${TMP}/Packages and write list of URLs
456 # to output file. 520 # to output file.
457 # 521 #
458 GeneratePackageList() { 522 GeneratePackageList() {
459 local output_file=$1 523 local output_file=$1
460 echo "Updating: ${output_file}" 524 echo "Updating: ${output_file}"
461 /bin/rm -f ${output_file} 525 /bin/rm -f ${output_file}
462 shift 526 shift
(...skipping 10 matching lines...) Expand all
473 } 537 }
474 538
475 #@ 539 #@
476 #@ UpdatePackageListsAmd64 540 #@ UpdatePackageListsAmd64
477 #@ 541 #@
478 #@ Regenerate the package lists such that they contain an up-to-date 542 #@ Regenerate the package lists such that they contain an up-to-date
479 #@ list of URLs within the Debian archive. (For amd64) 543 #@ list of URLs within the Debian archive. (For amd64)
480 UpdatePackageListsAmd64() { 544 UpdatePackageListsAmd64() {
481 local package_list="${TMP}/Packages.wheezy_amd64.bz2" 545 local package_list="${TMP}/Packages.wheezy_amd64.bz2"
482 DownloadOrCopy ${PACKAGE_LIST_AMD64} ${package_list} 546 DownloadOrCopy ${PACKAGE_LIST_AMD64} ${package_list}
547 VerifyPackageListing ${PACKAGE_FILE_AMD64} ${package_list}
483 bzcat ${package_list} | egrep '^(Package:|Filename:)' > ${TMP}/Packages 548 bzcat ${package_list} | egrep '^(Package:|Filename:)' > ${TMP}/Packages
484 549
485 GeneratePackageList ${DEBIAN_DEP_LIST_AMD64} "${DEBIAN_PACKAGES}" 550 GeneratePackageList ${DEBIAN_DEP_LIST_AMD64} "${DEBIAN_PACKAGES}"
486 } 551 }
487 552
488 #@ 553 #@
489 #@ UpdatePackageListsI386 554 #@ UpdatePackageListsI386
490 #@ 555 #@
491 #@ Regenerate the package lists such that they contain an up-to-date 556 #@ Regenerate the package lists such that they contain an up-to-date
492 #@ list of URLs within the Debian archive. (For i386) 557 #@ list of URLs within the Debian archive. (For i386)
493 UpdatePackageListsI386() { 558 UpdatePackageListsI386() {
494 local package_list="${TMP}/Packages.wheezy_i386.bz2" 559 local package_list="${TMP}/Packages.wheezy_i386.bz2"
495 DownloadOrCopy ${PACKAGE_LIST_I386} ${package_list} 560 DownloadOrCopy ${PACKAGE_LIST_I386} ${package_list}
561 VerifyPackageListing ${PACKAGE_FILE_I386} ${package_list}
496 bzcat ${package_list} | egrep '^(Package:|Filename:)' > ${TMP}/Packages 562 bzcat ${package_list} | egrep '^(Package:|Filename:)' > ${TMP}/Packages
497 563
498 GeneratePackageList ${DEBIAN_DEP_LIST_I386} "${DEBIAN_PACKAGES}" 564 GeneratePackageList ${DEBIAN_DEP_LIST_I386} "${DEBIAN_PACKAGES}"
499 } 565 }
500 566
501 if [ $# -eq 0 ] ; then 567 if [ $# -eq 0 ] ; then
502 echo "ERROR: you must specify a mode on the commandline" 568 echo "ERROR: you must specify a mode on the commandline"
503 echo 569 echo
504 Usage 570 Usage
505 exit 1 571 exit 1
506 elif [ "$(type -t $1)" != "function" ]; then 572 elif [ "$(type -t $1)" != "function" ]; then
507 echo "ERROR: unknown function '$1'." >&2 573 echo "ERROR: unknown function '$1'." >&2
508 echo "For help, try:" 574 echo "For help, try:"
509 echo " $0 help" 575 echo " $0 help"
510 exit 1 576 exit 1
511 else 577 else
512 ChangeDirectory 578 ChangeDirectory
513 SetEnvironmentVariables "$1" 579 SetEnvironmentVariables "$1"
514 SanityCheck 580 SanityCheck
515 "$@" 581 "$@"
516 fi 582 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698