| OLD | NEW |
| 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>* |
| 11 #@ Available modes are shown below. | 11 #@ Available modes are shown below. |
| 12 #@ | 12 #@ |
| 13 #@ List of modes: | 13 #@ List of modes: |
| 14 | 14 |
| 15 ###################################################################### | 15 ###################################################################### |
| 16 # Config | 16 # Config |
| 17 ###################################################################### | 17 ###################################################################### |
| 18 | 18 |
| 19 set -o nounset | 19 set -o nounset |
| 20 set -o errexit | 20 set -o errexit |
| 21 | 21 |
| 22 readonly SCRIPT_DIR=$(dirname $0) | 22 readonly SCRIPT_DIR=$(dirname $0) |
| 23 | 23 |
| 24 # This is where the staging sysroot is. | 24 # This is where the staging sysroot is. |
| 25 readonly INSTALL_ROOT_AMD64=$(pwd)/debian_wheezy_amd64_staging | 25 readonly INSTALL_ROOT_AMD64=$(pwd)/debian_wheezy_amd64_staging |
| 26 readonly INSTALL_ROOT_I386=$(pwd)/debian_wheezy_i386_staging | 26 readonly INSTALL_ROOT_I386=$(pwd)/debian_wheezy_i386_staging |
| 27 readonly INSTALL_ROOT_ARM=$(pwd)/debian_wheezy_arm_staging |
| 27 | 28 |
| 28 readonly REQUIRED_TOOLS="wget" | 29 readonly REQUIRED_TOOLS="wget" |
| 29 | 30 |
| 30 ###################################################################### | 31 ###################################################################### |
| 31 # Package Config | 32 # Package Config |
| 32 ###################################################################### | 33 ###################################################################### |
| 33 | 34 |
| 34 # This is where we get all the debian packages from. | 35 # This is where we get all the debian packages from. |
| 35 readonly DEBIAN_REPO=http://http.us.debian.org/debian | 36 readonly DEBIAN_REPO=http://http.us.debian.org/debian |
| 36 readonly REPO_BASEDIR="${DEBIAN_REPO}/dists/wheezy" | 37 readonly REPO_BASEDIR="${DEBIAN_REPO}/dists/wheezy" |
| 37 | 38 |
| 38 readonly RELEASE_FILE="Release" | 39 readonly RELEASE_FILE="Release" |
| 39 readonly RELEASE_FILE_GPG="Release.gpg" | 40 readonly RELEASE_FILE_GPG="Release.gpg" |
| 40 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}" | 41 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}" |
| 41 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}" | 42 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}" |
| 42 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2" | 43 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2" |
| 43 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2" | 44 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2" |
| 45 readonly PACKAGE_FILE_ARM="main/binary-armhf/Packages.bz2" |
| 44 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}" | 46 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}" |
| 45 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}" | 47 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}" |
| 48 readonly PACKAGE_LIST_ARM="${REPO_BASEDIR}/${PACKAGE_FILE_ARM}" |
| 46 | 49 |
| 47 # Sysroot packages: these are the packages needed to build chrome. | 50 # Sysroot packages: these are the packages needed to build chrome. |
| 48 # NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated | 51 # NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated |
| 49 # by running this script in GeneratePackageList mode. | 52 # by running this script in GeneratePackageList mode. |
| 50 readonly DEBIAN_PACKAGES="\ | 53 readonly DEBIAN_PACKAGES="\ |
| 51 comerr-dev \ | 54 comerr-dev \ |
| 52 gcc-4.6 \ | 55 gcc-4.6 \ |
| 53 krb5-multidev \ | 56 krb5-multidev \ |
| 54 libasound2 \ | 57 libasound2 \ |
| 55 libasound2-dev \ | 58 libasound2-dev \ |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 libpcre3 \ | 138 libpcre3 \ |
| 136 libpcre3-dev \ | 139 libpcre3-dev \ |
| 137 libpcrecpp0 \ | 140 libpcrecpp0 \ |
| 138 libpixman-1-0 \ | 141 libpixman-1-0 \ |
| 139 libpixman-1-dev \ | 142 libpixman-1-dev \ |
| 140 libpng12-0 \ | 143 libpng12-0 \ |
| 141 libpng12-dev \ | 144 libpng12-dev \ |
| 142 libpulse0 \ | 145 libpulse0 \ |
| 143 libpulse-dev \ | 146 libpulse-dev \ |
| 144 libpulse-mainloop-glib0 \ | 147 libpulse-mainloop-glib0 \ |
| 145 libquadmath0 \ | |
| 146 libselinux1 \ | 148 libselinux1 \ |
| 147 libspeechd2 \ | 149 libspeechd2 \ |
| 148 libspeechd-dev \ | 150 libspeechd-dev \ |
| 149 libssl1.0.0 \ | 151 libssl1.0.0 \ |
| 150 libssl-dev \ | 152 libssl-dev \ |
| 151 libstdc++6 \ | 153 libstdc++6 \ |
| 152 libstdc++6-4.6-dev \ | 154 libstdc++6-4.6-dev \ |
| 153 libtasn1-3 \ | 155 libtasn1-3 \ |
| 154 libudev0 \ | 156 libudev0 \ |
| 155 libudev-dev \ | 157 libudev-dev \ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 x11proto-input-dev \ | 203 x11proto-input-dev \ |
| 202 x11proto-kb-dev \ | 204 x11proto-kb-dev \ |
| 203 x11proto-randr-dev \ | 205 x11proto-randr-dev \ |
| 204 x11proto-record-dev \ | 206 x11proto-record-dev \ |
| 205 x11proto-render-dev \ | 207 x11proto-render-dev \ |
| 206 x11proto-scrnsaver-dev \ | 208 x11proto-scrnsaver-dev \ |
| 207 x11proto-xext-dev \ | 209 x11proto-xext-dev \ |
| 208 zlib1g \ | 210 zlib1g \ |
| 209 zlib1g-dev" | 211 zlib1g-dev" |
| 210 | 212 |
| 211 readonly DEBIAN_DEP_LIST_AMD64="${SCRIPT_DIR}/packagelist.debian.wheezy.amd64" | 213 DEBIAN_PACKAGES_X86="libquadmath0" |
| 212 readonly DEBIAN_DEP_LIST_I386="${SCRIPT_DIR}/packagelist.debian.wheezy.i386" | 214 |
| 215 readonly DEBIAN_DEP_LIST_AMD64="packagelist.debian.wheezy.amd64" |
| 216 readonly DEBIAN_DEP_LIST_I386="packagelist.debian.wheezy.i386" |
| 217 readonly DEBIAN_DEP_LIST_ARM="packagelist.debian.wheezy.arm" |
| 213 | 218 |
| 214 ###################################################################### | 219 ###################################################################### |
| 215 # Helper | 220 # Helper |
| 216 ###################################################################### | 221 ###################################################################### |
| 217 | 222 |
| 218 Banner() { | 223 Banner() { |
| 219 echo "######################################################################" | 224 echo "######################################################################" |
| 220 echo $* | 225 echo $* |
| 221 echo "######################################################################" | 226 echo "######################################################################" |
| 222 } | 227 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 251 fi | 256 fi |
| 252 } | 257 } |
| 253 | 258 |
| 254 | 259 |
| 255 SetEnvironmentVariables() { | 260 SetEnvironmentVariables() { |
| 256 ARCH="" | 261 ARCH="" |
| 257 echo $1 | grep -qs Amd64$ && ARCH=AMD64 | 262 echo $1 | grep -qs Amd64$ && ARCH=AMD64 |
| 258 if [ -z "$ARCH" ]; then | 263 if [ -z "$ARCH" ]; then |
| 259 echo $1 | grep -qs I386$ && ARCH=I386 | 264 echo $1 | grep -qs I386$ && ARCH=I386 |
| 260 fi | 265 fi |
| 266 if [ -z "$ARCH" ]; then |
| 267 echo $1 | grep -qs ARM$ && ARCH=ARM |
| 268 fi |
| 261 case "$ARCH" in | 269 case "$ARCH" in |
| 270 ARM) |
| 271 INSTALL_ROOT="$INSTALL_ROOT_ARM"; |
| 272 ;; |
| 262 AMD64) | 273 AMD64) |
| 263 INSTALL_ROOT="$INSTALL_ROOT_AMD64"; | 274 INSTALL_ROOT="$INSTALL_ROOT_AMD64"; |
| 264 ;; | 275 ;; |
| 265 I386) | 276 I386) |
| 266 INSTALL_ROOT="$INSTALL_ROOT_I386"; | 277 INSTALL_ROOT="$INSTALL_ROOT_I386"; |
| 267 ;; | 278 ;; |
| 268 *) | 279 *) |
| 269 echo "ERROR: Unexpected bad architecture." | 280 echo "ERROR: Unexpected bad architecture." |
| 270 exit 1 | 281 exit 1 |
| 271 ;; | 282 ;; |
| 272 esac | 283 esac |
| 273 } | 284 } |
| 274 | 285 |
| 275 Cleanup() { | 286 Cleanup() { |
| 287 echo "Cleaning: $TMP" |
| 276 rm -rf "$TMP" | 288 rm -rf "$TMP" |
| 277 } | 289 } |
| 278 | 290 |
| 279 # some sanity checks to make sure this script is run from the right place | 291 # some sanity checks to make sure this script is run from the right place |
| 280 # with the right tools | 292 # with the right tools |
| 281 SanityCheck() { | 293 SanityCheck() { |
| 282 Banner "Sanity Checks" | 294 Banner "Sanity Checks" |
| 283 | 295 |
| 284 if [ "$(basename $(pwd))" != "sysroot_scripts" ] ; then | 296 if [ "$(basename $(pwd))" != "sysroot_scripts" ] ; then |
| 285 echo -n "ERROR: run this script from " | 297 echo -n "ERROR: run this script from " |
| (...skipping 18 matching lines...) Expand all Loading... |
| 304 echo "Required binary $tool not found." | 316 echo "Required binary $tool not found." |
| 305 echo "Exiting." | 317 echo "Exiting." |
| 306 exit 1 | 318 exit 1 |
| 307 fi | 319 fi |
| 308 done | 320 done |
| 309 } | 321 } |
| 310 | 322 |
| 311 | 323 |
| 312 ChangeDirectory() { | 324 ChangeDirectory() { |
| 313 # Change directory to where this script is. | 325 # Change directory to where this script is. |
| 314 cd $(dirname "$0") | 326 cd ${SCRIPT_DIR} |
| 315 } | 327 } |
| 316 | 328 |
| 317 | 329 |
| 318 ClearInstallDir() { | 330 ClearInstallDir() { |
| 319 Banner "Clearing dirs in ${INSTALL_ROOT}" | 331 Banner "Clearing dirs in ${INSTALL_ROOT}" |
| 320 rm -rf ${INSTALL_ROOT}/* | 332 rm -rf ${INSTALL_ROOT}/* |
| 321 } | 333 } |
| 322 | 334 |
| 323 | 335 |
| 324 CreateTarBall() { | 336 CreateTarBall() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 339 fi | 351 fi |
| 340 } | 352 } |
| 341 | 353 |
| 342 ExtractPackageBz2() { | 354 ExtractPackageBz2() { |
| 343 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" | 355 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" |
| 344 } | 356 } |
| 345 | 357 |
| 346 GeneratePackageListAmd64() { | 358 GeneratePackageListAmd64() { |
| 347 local output_file="$1" | 359 local output_file="$1" |
| 348 local package_list="${TMP}/Packages.wheezy_amd64.bz2" | 360 local package_list="${TMP}/Packages.wheezy_amd64.bz2" |
| 349 DownloadOrCopy ${PACKAGE_LIST_AMD64} ${package_list} | 361 local tmp_package_list="${TMP}/Packages.wheezy_amd64" |
| 350 VerifyPackageListing ${PACKAGE_FILE_AMD64} ${package_list} | 362 DownloadOrCopy "${PACKAGE_LIST_AMD64}" "${package_list}" |
| 351 ExtractPackageBz2 "$package_list" "${TMP}/Packages" | 363 VerifyPackageListing "${PACKAGE_FILE_AMD64}" "${package_list}" |
| 364 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 352 | 365 |
| 353 GeneratePackageList "$output_file" "${DEBIAN_PACKAGES}" | 366 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} |
| 367 ${DEBIAN_PACKAGES_X86}" |
| 354 } | 368 } |
| 355 | 369 |
| 356 GeneratePackageListI386() { | 370 GeneratePackageListI386() { |
| 357 local output_file="$1" | 371 local output_file="$1" |
| 358 local package_list="${TMP}/Packages.wheezy_i386.bz2" | 372 local package_list="${TMP}/Packages.wheezy_i386.bz2" |
| 359 DownloadOrCopy ${PACKAGE_LIST_I386} ${package_list} | 373 local tmp_package_list="${TMP}/Packages.wheezy_amd64" |
| 360 VerifyPackageListing ${PACKAGE_FILE_I386} ${package_list} | 374 DownloadOrCopy "${PACKAGE_LIST_I386}" "${package_list}" |
| 361 ExtractPackageBz2 "$package_list" "${TMP}/Packages" | 375 VerifyPackageListing "${PACKAGE_FILE_I386}" "${package_list}" |
| 376 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 362 | 377 |
| 363 GeneratePackageList "$output_file" "${DEBIAN_PACKAGES}" | 378 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} |
| 379 ${DEBIAN_PACKAGES_X86}" |
| 380 } |
| 381 |
| 382 GeneratePackageListARM() { |
| 383 local output_file="$1" |
| 384 local package_list="${TMP}/Packages.wheezy_arm.bz2" |
| 385 local tmp_package_list="${TMP}/Packages.wheezy_arm" |
| 386 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}" |
| 387 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}" |
| 388 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 389 |
| 390 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" |
| 364 } | 391 } |
| 365 | 392 |
| 366 StripChecksumsFromPackageList() { | 393 StripChecksumsFromPackageList() { |
| 367 local package_file="$1" | 394 local package_file="$1" |
| 368 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" | 395 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" |
| 369 } | 396 } |
| 370 | 397 |
| 371 VerifyPackageFilesMatch() { | 398 VerifyPackageFilesMatch() { |
| 372 local downloaded_package_file="$1" | 399 local downloaded_package_file="$1" |
| 373 local stored_package_file="$2" | 400 local stored_package_file="$2" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 mkdir -p ${INSTALL_ROOT}/usr/share | 451 mkdir -p ${INSTALL_ROOT}/usr/share |
| 425 ln -s ../lib/i386-linux-gnu/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig | 452 ln -s ../lib/i386-linux-gnu/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig |
| 426 | 453 |
| 427 SubBanner "Adding an additional ld.conf include" | 454 SubBanner "Adding an additional ld.conf include" |
| 428 LD_SO_HACK_CONF="${INSTALL_ROOT}/etc/ld.so.conf.d/zz_hack.conf" | 455 LD_SO_HACK_CONF="${INSTALL_ROOT}/etc/ld.so.conf.d/zz_hack.conf" |
| 429 echo /usr/lib/gcc/i486-linux-gnu/4.6 > "$LD_SO_HACK_CONF" | 456 echo /usr/lib/gcc/i486-linux-gnu/4.6 > "$LD_SO_HACK_CONF" |
| 430 echo /usr/lib >> "$LD_SO_HACK_CONF" | 457 echo /usr/lib >> "$LD_SO_HACK_CONF" |
| 431 } | 458 } |
| 432 | 459 |
| 433 | 460 |
| 461 HacksAndPatchesARM() { |
| 462 Banner "Misc Hacks & Patches" |
| 463 # these are linker scripts with absolute pathnames in them |
| 464 # which we rewrite here |
| 465 lscripts="${INSTALL_ROOT}/usr/lib/arm-linux-gnueabihf/libpthread.so \ |
| 466 ${INSTALL_ROOT}/usr/lib/arm-linux-gnueabihf/libc.so" |
| 467 |
| 468 #SubBanner "Rewriting Linker Scripts" |
| 469 sed -i -e 's|/usr/lib/arm-linux-gnueabihf/||g' ${lscripts} |
| 470 sed -i -e 's|/lib/arm-linux-gnueabihf/||g' ${lscripts} |
| 471 |
| 472 # This is for chrome's ./build/linux/pkg-config-wrapper |
| 473 # which overwrites PKG_CONFIG_PATH internally |
| 474 SubBanner "Package Configs Symlink" |
| 475 mkdir -p ${INSTALL_ROOT}/usr/share |
| 476 ln -s ../lib/arm-linux-gnueabihf/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig |
| 477 } |
| 478 |
| 479 |
| 434 InstallIntoSysroot() { | 480 InstallIntoSysroot() { |
| 435 Banner "Install Libs And Headers Into Jail" | 481 Banner "Install Libs And Headers Into Jail" |
| 436 | 482 |
| 437 mkdir -p ${TMP}/debian-packages | 483 mkdir -p ${TMP}/debian-packages |
| 438 mkdir -p ${INSTALL_ROOT} | 484 mkdir -p ${INSTALL_ROOT} |
| 439 while (( "$#" )); do | 485 while (( "$#" )); do |
| 440 local file="$1" | 486 local file="$1" |
| 441 local package="${TMP}/debian-packages/${file##*/}" | 487 local package="${TMP}/debian-packages/${file##*/}" |
| 442 shift | 488 shift |
| 443 local sha256sum="$1" | 489 local sha256sum="$1" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 466 CleanupJailSymlinks() { | 512 CleanupJailSymlinks() { |
| 467 Banner "Jail symlink cleanup" | 513 Banner "Jail symlink cleanup" |
| 468 | 514 |
| 469 SAVEDPWD=$(pwd) | 515 SAVEDPWD=$(pwd) |
| 470 cd ${INSTALL_ROOT} | 516 cd ${INSTALL_ROOT} |
| 471 find lib lib64 usr/lib -type l -printf '%p %l\n' | while read link target; do | 517 find lib lib64 usr/lib -type l -printf '%p %l\n' | while read link target; do |
| 472 # skip links with non-absolute paths | 518 # skip links with non-absolute paths |
| 473 echo "${target}" | grep -qs ^/ || continue | 519 echo "${target}" | grep -qs ^/ || continue |
| 474 echo "${link}: ${target}" | 520 echo "${link}: ${target}" |
| 475 case "${link}" in | 521 case "${link}" in |
| 476 usr/lib/gcc/x86_64-linux-gnu/4.*/* | usr/lib/gcc/i486-linux-gnu/4.*/*) | 522 usr/lib/gcc/x86_64-linux-gnu/4.*/* | usr/lib/gcc/i486-linux-gnu/4.*/* | \ |
| 523 usr/lib/gcc/arm-linux-gnueabihf/4.*/*) |
| 477 # Relativize the symlink. | 524 # Relativize the symlink. |
| 478 ln -snfv "../../../../..${target}" "${link}" | 525 ln -snfv "../../../../..${target}" "${link}" |
| 479 ;; | 526 ;; |
| 480 usr/lib/x86_64-linux-gnu/* | usr/lib/i386-linux-gnu/*) | 527 usr/lib/x86_64-linux-gnu/* | usr/lib/i386-linux-gnu/* | \ |
| 528 usr/lib/arm-linux-gnueabihf/*) |
| 481 # Relativize the symlink. | 529 # Relativize the symlink. |
| 482 ln -snfv "../../..${target}" "${link}" | 530 ln -snfv "../../..${target}" "${link}" |
| 483 ;; | 531 ;; |
| 484 usr/lib/*) | 532 usr/lib/*) |
| 485 # Relativize the symlink. | 533 # Relativize the symlink. |
| 486 ln -snfv "../..${target}" "${link}" | 534 ln -snfv "../..${target}" "${link}" |
| 487 ;; | 535 ;; |
| 488 lib64/* | lib/*) | 536 lib64/* | lib/*) |
| 489 # Relativize the symlink. | 537 # Relativize the symlink. |
| 490 ln -snfv "..${target}" "${link}" | 538 ln -snfv "..${target}" "${link}" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 508 #@ | 556 #@ |
| 509 #@ Build everything and package it | 557 #@ Build everything and package it |
| 510 BuildSysrootAmd64() { | 558 BuildSysrootAmd64() { |
| 511 CheckBuildSysrootArgs $@ | 559 CheckBuildSysrootArgs $@ |
| 512 ClearInstallDir | 560 ClearInstallDir |
| 513 local package_file="$TMP/package_with_sha256sum_amd64" | 561 local package_file="$TMP/package_with_sha256sum_amd64" |
| 514 GeneratePackageListAmd64 "$package_file" | 562 GeneratePackageListAmd64 "$package_file" |
| 515 local files_and_sha256sums="$(cat ${package_file})" | 563 local files_and_sha256sums="$(cat ${package_file})" |
| 516 StripChecksumsFromPackageList "$package_file" | 564 StripChecksumsFromPackageList "$package_file" |
| 517 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_AMD64" | 565 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_AMD64" |
| 518 InstallIntoSysroot ${files_and_sha256sums} | 566 InstallIntoSysroot "${files_and_sha256sums}" |
| 519 CleanupJailSymlinks | 567 CleanupJailSymlinks |
| 520 HacksAndPatchesAmd64 | 568 HacksAndPatchesAmd64 |
| 521 CreateTarBall "$1" | 569 CreateTarBall "$1" |
| 522 } | 570 } |
| 523 | 571 |
| 524 #@ | 572 #@ |
| 525 #@ BuildSysrootI386 <tarball-name> | 573 #@ BuildSysrootI386 <tarball-name> |
| 526 #@ | 574 #@ |
| 527 #@ Build everything and package it | 575 #@ Build everything and package it |
| 528 BuildSysrootI386() { | 576 BuildSysrootI386() { |
| 529 CheckBuildSysrootArgs $@ | 577 CheckBuildSysrootArgs $@ |
| 530 ClearInstallDir | 578 ClearInstallDir |
| 531 local package_file="$TMP/package_with_sha256sum_amd64" | 579 local package_file="$TMP/package_with_sha256sum_i386" |
| 532 GeneratePackageListI386 "$package_file" | 580 GeneratePackageListI386 "$package_file" |
| 533 local files_and_sha256sums="$(cat ${package_file})" | 581 local files_and_sha256sums="$(cat ${package_file})" |
| 534 StripChecksumsFromPackageList "$package_file" | 582 StripChecksumsFromPackageList "$package_file" |
| 535 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_I386" | 583 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_I386" |
| 536 InstallIntoSysroot ${files_and_sha256sums} | 584 InstallIntoSysroot "${files_and_sha256sums}" |
| 537 CleanupJailSymlinks | 585 CleanupJailSymlinks |
| 538 HacksAndPatchesI386 | 586 HacksAndPatchesI386 |
| 539 CreateTarBall "$1" | 587 CreateTarBall "$1" |
| 540 } | 588 } |
| 541 | 589 |
| 590 #@ |
| 591 #@ BuildSysrootARM <tarball-name> |
| 592 #@ |
| 593 #@ Build everything and package it |
| 594 BuildSysrootARM() { |
| 595 CheckBuildSysrootArgs $@ |
| 596 ClearInstallDir |
| 597 local package_file="$TMP/package_with_sha256sum_arm" |
| 598 GeneratePackageListARM "$package_file" |
| 599 local files_and_sha256sums="$(cat ${package_file})" |
| 600 StripChecksumsFromPackageList "$package_file" |
| 601 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM" |
| 602 InstallIntoSysroot "${files_and_sha256sums}" |
| 603 CleanupJailSymlinks |
| 604 HacksAndPatchesARM |
| 605 CreateTarBall "$1" |
| 606 } |
| 607 |
| 542 # | 608 # |
| 543 # CheckForDebianGPGKeys | 609 # CheckForDebianGPGKeyring |
| 544 # | 610 # |
| 545 # Make sure the Debian GPG keys exist. Otherwise print a helpful message. | 611 # Make sure the Debian GPG keys exist. Otherwise print a helpful message. |
| 546 # | 612 # |
| 547 CheckForDebianGPGKeys() { | 613 CheckForDebianGPGKeyring() { |
| 548 if [ ! -e "/etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg" ] || | 614 if [ ! -e "/usr/share/keyrings/debian-archive-keyring.gpg" ]; then |
| 549 [ ! -e "/etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg" ]; then | |
| 550 echo "Debian GPG keys missing. Install the debian-archive-keyring package." | 615 echo "Debian GPG keys missing. Install the debian-archive-keyring package." |
| 551 exit 1 | 616 exit 1 |
| 552 fi | 617 fi |
| 553 } | 618 } |
| 554 | 619 |
| 555 # | 620 # |
| 556 # VerifyPackageListing | 621 # VerifyPackageListing |
| 557 # | 622 # |
| 558 # Verifies the downloaded Packages.bz2 file has the right checksums. | 623 # Verifies the downloaded Packages.bz2 file has the right checksums. |
| 559 # | 624 # |
| 560 VerifyPackageListing() { | 625 VerifyPackageListing() { |
| 561 local file_path=$1 | 626 local file_path=$1 |
| 562 local output_file=$2 | 627 local output_file=$2 |
| 563 local release_file="${TMP}/${RELEASE_FILE}" | 628 local release_file="${TMP}/${RELEASE_FILE}" |
| 564 local release_file_gpg="${TMP}/${RELEASE_FILE_GPG}" | 629 local release_file_gpg="${TMP}/${RELEASE_FILE_GPG}" |
| 565 | 630 |
| 566 CheckForDebianGPGKeys | 631 CheckForDebianGPGKeyring |
| 567 | 632 |
| 568 DownloadOrCopy ${RELEASE_LIST} ${release_file} | 633 DownloadOrCopy ${RELEASE_LIST} ${release_file} |
| 569 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg} | 634 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg} |
| 570 echo "Verifying: ${release_file} with ${release_file_gpg}" | 635 echo "Verifying: ${release_file} with ${release_file_gpg}" |
| 571 gpgv --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg \ | 636 gpgv --keyring /usr/share/keyrings/debian-archive-keyring.gpg \ |
| 572 --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg \ | |
| 573 ${release_file_gpg} ${release_file} | 637 ${release_file_gpg} ${release_file} |
| 574 | 638 |
| 575 echo "Verifying: ${output_file}" | 639 echo "Verifying: ${output_file}" |
| 576 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2) | 640 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2) |
| 577 local sha256sum=$(echo ${checksums} | cut -d " " -f 3) | 641 local sha256sum=$(echo ${checksums} | cut -d " " -f 3) |
| 578 | 642 |
| 579 if [ "${#sha256sum}" -ne "64" ]; then | 643 if [ "${#sha256sum}" -ne "64" ]; then |
| 580 echo "Bad sha256sum from ${RELEASE_LIST}" | 644 echo "Bad sha256sum from ${RELEASE_LIST}" |
| 581 exit 1 | 645 exit 1 |
| 582 fi | 646 fi |
| 583 | 647 |
| 584 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c | 648 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c |
| 585 } | 649 } |
| 586 | 650 |
| 587 # | 651 # |
| 588 # GeneratePackageList | 652 # GeneratePackageList |
| 589 # | 653 # |
| 590 # Looks up package names in ${TMP}/Packages and write list of URLs | 654 # Looks up package names in ${TMP}/Packages and write list of URLs |
| 591 # to output file. | 655 # to output file. |
| 592 # | 656 # |
| 593 GeneratePackageList() { | 657 GeneratePackageList() { |
| 594 local output_file="$1" | 658 local input_file="$1" |
| 595 echo "Updating: ${output_file}" | 659 local output_file="$2" |
| 660 echo "Updating: ${output_file} from ${input_file}" |
| 596 /bin/rm -f "${output_file}" | 661 /bin/rm -f "${output_file}" |
| 597 shift | 662 shift |
| 663 shift |
| 598 for pkg in $@ ; do | 664 for pkg in $@ ; do |
| 599 local pkg_full=$(grep -A 1 " ${pkg}\$" "${TMP}/Packages" | \ | 665 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \ |
| 600 egrep -o "pool/.*") | 666 egrep -o "pool/.*") |
| 601 if [ -z "${pkg_full}" ]; then | 667 if [ -z "${pkg_full}" ]; then |
| 602 echo "ERROR: missing package: $pkg" | 668 echo "ERROR: missing package: $pkg" |
| 603 exit 1 | 669 exit 1 |
| 604 fi | 670 fi |
| 605 local pkg_nopool=$(echo "$pkg_full" | sed "s/^pool\///") | 671 local pkg_nopool=$(echo "$pkg_full" | sed "s/^pool\///") |
| 606 local sha256sum=$(grep -A 4 " ${pkg}\$" "${TMP}/Packages" | \ | 672 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \ |
| 607 grep ^SHA256: | sed 's/^SHA256: //') | 673 grep ^SHA256: | sed 's/^SHA256: //') |
| 608 if [ "${#sha256sum}" -ne "64" ]; then | 674 if [ "${#sha256sum}" -ne "64" ]; then |
| 609 echo "Bad sha256sum from Packages" | 675 echo "Bad sha256sum from Packages" |
| 610 exit 1 | 676 exit 1 |
| 611 fi | 677 fi |
| 612 echo $pkg_nopool $sha256sum >> "$output_file" | 678 echo $pkg_nopool $sha256sum >> "$output_file" |
| 613 done | 679 done |
| 614 # sort -o does an in-place sort of this file | 680 # sort -o does an in-place sort of this file |
| 615 sort "$output_file" -o "$output_file" | 681 sort "$output_file" -o "$output_file" |
| 616 } | 682 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 628 #@ | 694 #@ |
| 629 #@ UpdatePackageListsI386 | 695 #@ UpdatePackageListsI386 |
| 630 #@ | 696 #@ |
| 631 #@ Regenerate the package lists such that they contain an up-to-date | 697 #@ Regenerate the package lists such that they contain an up-to-date |
| 632 #@ list of URLs within the Debian archive. (For i386) | 698 #@ list of URLs within the Debian archive. (For i386) |
| 633 UpdatePackageListsI386() { | 699 UpdatePackageListsI386() { |
| 634 GeneratePackageListI386 "$DEBIAN_DEP_LIST_I386" | 700 GeneratePackageListI386 "$DEBIAN_DEP_LIST_I386" |
| 635 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_I386" | 701 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_I386" |
| 636 } | 702 } |
| 637 | 703 |
| 704 #@ |
| 705 #@ UpdatePackageListsARM |
| 706 #@ |
| 707 #@ Regenerate the package lists such that they contain an up-to-date |
| 708 #@ list of URLs within the Debian archive. (For arm) |
| 709 UpdatePackageListsARM() { |
| 710 GeneratePackageListARM "$DEBIAN_DEP_LIST_ARM" |
| 711 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM" |
| 712 } |
| 713 |
| 638 if [ $# -eq 0 ] ; then | 714 if [ $# -eq 0 ] ; then |
| 639 echo "ERROR: you must specify a mode on the commandline" | 715 echo "ERROR: you must specify a mode on the commandline" |
| 640 echo | 716 echo |
| 641 Usage | 717 Usage |
| 642 exit 1 | 718 exit 1 |
| 643 elif [ "$(type -t $1)" != "function" ]; then | 719 elif [ "$(type -t $1)" != "function" ]; then |
| 644 echo "ERROR: unknown function '$1'." >&2 | 720 echo "ERROR: unknown function '$1'." >&2 |
| 645 echo "For help, try:" | 721 echo "For help, try:" |
| 646 echo " $0 help" | 722 echo " $0 help" |
| 647 exit 1 | 723 exit 1 |
| 648 else | 724 else |
| 649 ChangeDirectory | 725 ChangeDirectory |
| 650 SetEnvironmentVariables "$1" | 726 SetEnvironmentVariables "$1" |
| 651 SanityCheck | 727 SanityCheck |
| 652 "$@" | 728 "$@" |
| 653 fi | 729 fi |
| OLD | NEW |