Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / build / linux / sysroot_scripts / sysroot-creator.sh
blob822a5e8d9e17d5110d4a3f649816443720b4e87e
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
3 # found in the LICENSE file.
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
7 # to define certain environment variables: e.g.
8 # DISTRO=ubuntu
9 # DIST=trusty
10 # APT_REPO=http://archive.ubuntu.com/ubuntu
11 # KEYRING_FILE=/usr/share/keyrings/ubuntu-archive-keyring.gpg
12 # DEBIAN_PACKAGES="gcc libz libssl"
14 #@ This script builds a Debian sysroot images for building Google Chrome.
16 #@ Generally this script is invoked as:
17 #@ sysroot-creator-<flavour>.sh <mode> <args>*
18 #@ Available modes are shown below.
20 #@ List of modes:
22 ######################################################################
23 # Config
24 ######################################################################
26 set -o nounset
27 set -o errexit
29 SCRIPT_DIR=$(cd $(dirname $0) && pwd)
31 if [ -z "${DIST:-}" ]; then
32 echo "error: DIST not defined"
33 exit 1
36 if [ -z "${APT_REPO:-}" ]; then
37 echo "error: APT_REPO not defined"
38 exit 1
41 if [ -z "${KEYRING_FILE:-}" ]; then
42 echo "error: KEYRING_FILE not defined"
43 exit 1
46 if [ -z "${DEBIAN_PACKAGES:-}" ]; then
47 echo "error: DEBIAN_PACKAGES not defined"
48 exit 1
51 readonly REPO_BASEDIR="${APT_REPO}/dists/${DIST}"
53 readonly REQUIRED_TOOLS="wget"
55 ######################################################################
56 # Package Config
57 ######################################################################
59 readonly RELEASE_FILE="Release"
60 readonly RELEASE_FILE_GPG="Release.gpg"
61 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}"
62 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}"
63 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2"
64 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2"
65 readonly PACKAGE_FILE_ARM="main/binary-armhf/Packages.bz2"
66 readonly PACKAGE_FILE_MIPS="main/binary-mipsel/Packages.bz2"
67 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}"
68 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}"
69 readonly PACKAGE_LIST_ARM="${REPO_BASEDIR}/${PACKAGE_FILE_ARM}"
70 readonly PACKAGE_LIST_MIPS="${REPO_BASEDIR}/${PACKAGE_FILE_MIPS}"
72 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64"
73 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386"
74 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm"
75 readonly DEBIAN_DEP_LIST_MIPS="packagelist.${DIST}.mipsel"
77 ######################################################################
78 # Helper
79 ######################################################################
81 Banner() {
82 echo "######################################################################"
83 echo $*
84 echo "######################################################################"
88 SubBanner() {
89 echo "----------------------------------------------------------------------"
90 echo $*
91 echo "----------------------------------------------------------------------"
95 Usage() {
96 egrep "^#@" "${BASH_SOURCE[0]}" | cut --bytes=3-
100 DownloadOrCopy() {
101 if [ -f "$2" ] ; then
102 echo "$2 already in place"
103 return
106 HTTP=0
107 echo "$1" | grep -qs ^http:// && HTTP=1
108 if [ "$HTTP" = "1" ]; then
109 SubBanner "downloading from $1 -> $2"
110 wget "$1" -O "${2}.partial"
111 mv "${2}.partial" $2
112 else
113 SubBanner "copying from $1"
114 cp "$1" "$2"
119 SetEnvironmentVariables() {
120 ARCH=""
121 echo $1 | grep -qs Amd64$ && ARCH=AMD64
122 if [ -z "$ARCH" ]; then
123 echo $1 | grep -qs I386$ && ARCH=I386
125 if [ -z "$ARCH" ]; then
126 echo $1 | grep -qs Mips$ && ARCH=MIPS
128 if [ -z "$ARCH" ]; then
129 echo $1 | grep -qs ARM$ && ARCH=ARM
131 if [ -z "${ARCH}" ]; then
132 echo "ERROR: Unable to determine architecture based on: $1"
133 exit 1
135 ARCH_LOWER=$(echo $ARCH | tr '[:upper:]' '[:lower:]')
139 # some sanity checks to make sure this script is run from the right place
140 # with the right tools
141 SanityCheck() {
142 Banner "Sanity Checks"
144 local chrome_dir=$(cd "${SCRIPT_DIR}/../../../.." && pwd)
145 BUILD_DIR="${chrome_dir}/out/sysroot-build/${DIST}"
146 mkdir -p ${BUILD_DIR}
147 echo "Using build directory: ${BUILD_DIR}"
149 for tool in ${REQUIRED_TOOLS} ; do
150 if ! which ${tool} > /dev/null ; then
151 echo "Required binary $tool not found."
152 echo "Exiting."
153 exit 1
155 done
157 # This is where the staging sysroot is.
158 INSTALL_ROOT="${BUILD_DIR}/${DIST}_${ARCH_LOWER}_staging"
159 TARBALL="${BUILD_DIR}/${DISTRO}_${DIST}_${ARCH_LOWER}_sysroot.tgz"
161 if ! mkdir -p "${INSTALL_ROOT}" ; then
162 echo "ERROR: ${INSTALL_ROOT} can't be created."
163 exit 1
168 ChangeDirectory() {
169 # Change directory to where this script is.
170 cd ${SCRIPT_DIR}
174 ClearInstallDir() {
175 Banner "Clearing dirs in ${INSTALL_ROOT}"
176 rm -rf ${INSTALL_ROOT}/*
180 CreateTarBall() {
181 Banner "Creating tarball ${TARBALL}"
182 tar zcf ${TARBALL} -C ${INSTALL_ROOT} .
185 ExtractPackageBz2() {
186 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2"
189 GeneratePackageListAmd64() {
190 local output_file="$1"
191 local package_list="${BUILD_DIR}/Packages.${DIST}_amd64.bz2"
192 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64"
193 DownloadOrCopy "${PACKAGE_LIST_AMD64}" "${package_list}"
194 VerifyPackageListing "${PACKAGE_FILE_AMD64}" "${package_list}"
195 ExtractPackageBz2 "$package_list" "$tmp_package_list"
196 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}
197 ${DEBIAN_PACKAGES_X86}"
200 GeneratePackageListI386() {
201 local output_file="$1"
202 local package_list="${BUILD_DIR}/Packages.${DIST}_i386.bz2"
203 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64"
204 DownloadOrCopy "${PACKAGE_LIST_I386}" "${package_list}"
205 VerifyPackageListing "${PACKAGE_FILE_I386}" "${package_list}"
206 ExtractPackageBz2 "$package_list" "$tmp_package_list"
207 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}
208 ${DEBIAN_PACKAGES_X86}"
211 GeneratePackageListARM() {
212 local output_file="$1"
213 local package_list="${BUILD_DIR}/Packages.${DIST}_arm.bz2"
214 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm"
215 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}"
216 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}"
217 ExtractPackageBz2 "$package_list" "$tmp_package_list"
218 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}"
221 GeneratePackageListMips() {
222 local output_file="$1"
223 local package_list="${BUILD_DIR}/Packages.${DIST}_mips.bz2"
224 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_mips"
225 DownloadOrCopy "${PACKAGE_LIST_MIPS}" "${package_list}"
226 VerifyPackageListing "${PACKAGE_FILE_MIPS}" "${package_list}"
227 ExtractPackageBz2 "$package_list" "$tmp_package_list"
228 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}"
231 StripChecksumsFromPackageList() {
232 local package_file="$1"
233 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file"
236 VerifyPackageFilesMatch() {
237 local downloaded_package_file="$1"
238 local stored_package_file="$2"
239 diff -u "$downloaded_package_file" "$stored_package_file"
240 if [ "$?" -ne "0" ]; then
241 echo "ERROR: downloaded package files does not match $2."
242 echo "You may need to run UpdatePackageLists."
243 exit 1
247 ######################################################################
249 ######################################################################
251 HacksAndPatchesAmd64() {
252 Banner "Misc Hacks & Patches"
253 # these are linker scripts with absolute pathnames in them
254 # which we rewrite here
255 lscripts="${INSTALL_ROOT}/usr/lib/x86_64-linux-gnu/libpthread.so \
256 ${INSTALL_ROOT}/usr/lib/x86_64-linux-gnu/libc.so"
258 # Rewrite linker scripts
259 sed -i -e 's|/usr/lib/x86_64-linux-gnu/||g' ${lscripts}
260 sed -i -e 's|/lib/x86_64-linux-gnu/||g' ${lscripts}
262 # This is for chrome's ./build/linux/pkg-config-wrapper
263 # which overwrites PKG_CONFIG_PATH internally
264 SubBanner "Package Configs Symlink"
265 mkdir -p ${INSTALL_ROOT}/usr/share
266 ln -s ../lib/x86_64-linux-gnu/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig
268 SubBanner "Adding an additional ld.conf include"
269 LD_SO_HACK_CONF="${INSTALL_ROOT}/etc/ld.so.conf.d/zz_hack.conf"
270 echo /usr/lib/gcc/x86_64-linux-gnu/4.6 > "$LD_SO_HACK_CONF"
271 echo /usr/lib >> "$LD_SO_HACK_CONF"
275 HacksAndPatchesI386() {
276 Banner "Misc Hacks & Patches"
277 # these are linker scripts with absolute pathnames in them
278 # which we rewrite here
279 lscripts="${INSTALL_ROOT}/usr/lib/i386-linux-gnu/libpthread.so \
280 ${INSTALL_ROOT}/usr/lib/i386-linux-gnu/libc.so"
282 # Rewrite linker scripts
283 sed -i -e 's|/usr/lib/i386-linux-gnu/||g' ${lscripts}
284 sed -i -e 's|/lib/i386-linux-gnu/||g' ${lscripts}
286 # This is for chrome's ./build/linux/pkg-config-wrapper
287 # which overwrites PKG_CONFIG_PATH internally
288 SubBanner "Package Configs Symlink"
289 mkdir -p ${INSTALL_ROOT}/usr/share
290 ln -s ../lib/i386-linux-gnu/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig
292 SubBanner "Adding an additional ld.conf include"
293 LD_SO_HACK_CONF="${INSTALL_ROOT}/etc/ld.so.conf.d/zz_hack.conf"
294 echo /usr/lib/gcc/i486-linux-gnu/4.6 > "$LD_SO_HACK_CONF"
295 echo /usr/lib >> "$LD_SO_HACK_CONF"
299 HacksAndPatchesARM() {
300 Banner "Misc Hacks & Patches"
301 # these are linker scripts with absolute pathnames in them
302 # which we rewrite here
303 lscripts="${INSTALL_ROOT}/usr/lib/arm-linux-gnueabihf/libpthread.so \
304 ${INSTALL_ROOT}/usr/lib/arm-linux-gnueabihf/libc.so"
306 # Rewrite linker scripts
307 sed -i -e 's|/usr/lib/arm-linux-gnueabihf/||g' ${lscripts}
308 sed -i -e 's|/lib/arm-linux-gnueabihf/||g' ${lscripts}
310 # This is for chrome's ./build/linux/pkg-config-wrapper
311 # which overwrites PKG_CONFIG_PATH internally
312 SubBanner "Package Configs Symlink"
313 mkdir -p ${INSTALL_ROOT}/usr/share
314 ln -s ../lib/arm-linux-gnueabihf/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig
318 HacksAndPatchesMips() {
319 Banner "Misc Hacks & Patches"
320 # these are linker scripts with absolute pathnames in them
321 # which we rewrite here
322 lscripts="${INSTALL_ROOT}/usr/lib/mipsel-linux-gnu/libpthread.so \
323 ${INSTALL_ROOT}/usr/lib/mipsel-linux-gnu/libc.so"
325 # Rewrite linker scripts
326 sed -i -e 's|/usr/lib/mipsel-linux-gnu/||g' ${lscripts}
327 sed -i -e 's|/lib/mipsel-linux-gnu/||g' ${lscripts}
329 # This is for chrome's ./build/linux/pkg-config-wrapper
330 # which overwrites PKG_CONFIG_PATH internally
331 SubBanner "Package Configs Symlink"
332 mkdir -p ${INSTALL_ROOT}/usr/share
333 ln -s ../lib/mipsel-linux-gnu/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig
337 InstallIntoSysroot() {
338 Banner "Install Libs And Headers Into Jail"
340 mkdir -p ${BUILD_DIR}/debian-packages
341 mkdir -p ${INSTALL_ROOT}
342 while (( "$#" )); do
343 local file="$1"
344 local package="${BUILD_DIR}/debian-packages/${file##*/}"
345 shift
346 local sha256sum="$1"
347 shift
348 if [ "${#sha256sum}" -ne "64" ]; then
349 echo "Bad sha256sum from package list"
350 exit 1
353 Banner "Installing ${file}"
354 DownloadOrCopy ${APT_REPO}/pool/${file} ${package}
355 if [ ! -s "${package}" ] ; then
356 echo
357 echo "ERROR: bad package ${package}"
358 exit 1
360 echo "${sha256sum} ${package}" | sha256sum --quiet -c
362 SubBanner "Extracting to ${INSTALL_ROOT}"
363 dpkg --fsys-tarfile ${package}\
364 | tar -xf - --exclude=./usr/share -C ${INSTALL_ROOT}
365 done
369 CleanupJailSymlinks() {
370 Banner "Jail symlink cleanup"
372 SAVEDPWD=$(pwd)
373 cd ${INSTALL_ROOT}
374 local libdirs="lib usr/lib"
375 if [ "${ARCH}" != "MIPS" ]; then
376 libdirs+=" lib64"
378 find $libdirs -type l -printf '%p %l\n' | while read link target; do
379 # skip links with non-absolute paths
380 echo "${target}" | grep -qs ^/ || continue
381 echo "${link}: ${target}"
382 case "${link}" in
383 usr/lib/gcc/x86_64-linux-gnu/4.*/* | usr/lib/gcc/i486-linux-gnu/4.*/* | \
384 usr/lib/gcc/arm-linux-gnueabihf/4.*/* | \
385 usr/lib/gcc/mipsel-linux-gnu/4.*/*)
386 # Relativize the symlink.
387 ln -snfv "../../../../..${target}" "${link}"
389 usr/lib/x86_64-linux-gnu/* | usr/lib/i386-linux-gnu/* | \
390 usr/lib/arm-linux-gnueabihf/* | usr/lib/mipsel-linux-gnu/* )
391 # Relativize the symlink.
392 ln -snfv "../../..${target}" "${link}"
394 usr/lib/*)
395 # Relativize the symlink.
396 ln -snfv "../..${target}" "${link}"
398 lib64/* | lib/*)
399 # Relativize the symlink.
400 ln -snfv "..${target}" "${link}"
402 esac
403 done
405 find $libdirs -type l -printf '%p %l\n' | while read link target; do
406 # Make sure we catch new bad links.
407 if [ ! -r "${link}" ]; then
408 echo "ERROR: FOUND BAD LINK ${link}"
409 ls -l ${link}
410 exit 1
412 done
413 cd "$SAVEDPWD"
417 #@ BuildSysrootAmd64
419 #@ Build everything and package it
420 BuildSysrootAmd64() {
421 ClearInstallDir
422 local package_file="$BUILD_DIR/package_with_sha256sum_amd64"
423 GeneratePackageListAmd64 "$package_file"
424 local files_and_sha256sums="$(cat ${package_file})"
425 StripChecksumsFromPackageList "$package_file"
426 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_AMD64"
427 InstallIntoSysroot ${files_and_sha256sums}
428 CleanupJailSymlinks
429 HacksAndPatchesAmd64
430 CreateTarBall
434 #@ BuildSysrootI386
436 #@ Build everything and package it
437 BuildSysrootI386() {
438 ClearInstallDir
439 local package_file="$BUILD_DIR/package_with_sha256sum_i386"
440 GeneratePackageListI386 "$package_file"
441 local files_and_sha256sums="$(cat ${package_file})"
442 StripChecksumsFromPackageList "$package_file"
443 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_I386"
444 InstallIntoSysroot ${files_and_sha256sums}
445 CleanupJailSymlinks
446 HacksAndPatchesI386
447 CreateTarBall
451 #@ BuildSysrootARM
453 #@ Build everything and package it
454 BuildSysrootARM() {
455 ClearInstallDir
456 local package_file="$BUILD_DIR/package_with_sha256sum_arm"
457 GeneratePackageListARM "$package_file"
458 local files_and_sha256sums="$(cat ${package_file})"
459 StripChecksumsFromPackageList "$package_file"
460 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM"
461 APT_REPO=${APR_REPO_ARM:=$APT_REPO}
462 InstallIntoSysroot ${files_and_sha256sums}
463 CleanupJailSymlinks
464 HacksAndPatchesARM
465 CreateTarBall
469 #@ BuildSysrootMips
471 #@ Build everything and package it
472 BuildSysrootMips() {
473 ClearInstallDir
474 local package_file="$BUILD_DIR/package_with_sha256sum_arm"
475 GeneratePackageListMips "$package_file"
476 local files_and_sha256sums="$(cat ${package_file})"
477 StripChecksumsFromPackageList "$package_file"
478 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS"
479 APT_REPO=${APR_REPO_MIPS:=$APT_REPO}
480 InstallIntoSysroot ${files_and_sha256sums}
481 CleanupJailSymlinks
482 HacksAndPatchesMips
483 CreateTarBall
487 #@ BuildSysrootAll
489 #@ Build sysroot images for all architectures
490 BuildSysrootAll() {
491 RunCommand BuildSysrootAmd64
492 RunCommand BuildSysrootI386
493 RunCommand BuildSysrootARM
494 RunCommand BuildSysrootMips
497 UploadSysroot() {
498 local rev=$1
499 if [ -z "${rev}" ]; then
500 echo "Please specify a revision to upload at."
501 exit 1
503 set -x
504 gsutil cp -a public-read "${TARBALL}" \
505 "gs://chrome-linux-sysroot/toolchain/$rev/"
506 set +x
510 #@ UploadSysrootAmd64 <revision>
512 UploadSysrootAmd64() {
513 UploadSysroot "$@"
517 #@ UploadSysrootI386 <revision>
519 UploadSysrootI386() {
520 UploadSysroot "$@"
524 #@ UploadSysrootARM <revision>
526 UploadSysrootARM() {
527 UploadSysroot "$@"
531 #@ UploadSysrootMips <revision>
533 UploadSysrootMips() {
534 UploadSysroot "$@"
538 #@ UploadSysrootAll <revision>
540 #@ Upload sysroot image for all architectures
541 UploadSysrootAll() {
542 RunCommand UploadSysrootAmd64 "$@"
543 RunCommand UploadSysrootI386 "$@"
544 RunCommand UploadSysrootARM "$@"
545 RunCommand UploadSysrootMips "$@"
549 # CheckForDebianGPGKeyring
551 # Make sure the Debian GPG keys exist. Otherwise print a helpful message.
553 CheckForDebianGPGKeyring() {
554 if [ ! -e "$KEYRING_FILE" ]; then
555 echo "Debian GPG keys missing. Install the debian-archive-keyring package."
556 exit 1
561 # VerifyPackageListing
563 # Verifies the downloaded Packages.bz2 file has the right checksums.
565 VerifyPackageListing() {
566 local file_path=$1
567 local output_file=$2
568 local release_file="${BUILD_DIR}/${RELEASE_FILE}"
569 local release_file_gpg="${BUILD_DIR}/${RELEASE_FILE_GPG}"
570 local tmp_keyring_file="${BUILD_DIR}/keyring.gpg"
572 CheckForDebianGPGKeyring
574 DownloadOrCopy ${RELEASE_LIST} ${release_file}
575 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg}
576 echo "Verifying: ${release_file} with ${release_file_gpg}"
577 cp "${KEYRING_FILE}" "${tmp_keyring_file}"
578 gpg --primary-keyring "${tmp_keyring_file}" --recv-keys 2B90D010
579 gpgv --keyring "${tmp_keyring_file}" "${release_file_gpg}" "${release_file}"
581 echo "Verifying: ${output_file}"
582 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2)
583 local sha256sum=$(echo ${checksums} | cut -d " " -f 3)
585 if [ "${#sha256sum}" -ne "64" ]; then
586 echo "Bad sha256sum from ${RELEASE_LIST}"
587 exit 1
590 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c
594 # GeneratePackageList
596 # Looks up package names in ${BUILD_DIR}/Packages and write list of URLs
597 # to output file.
599 GeneratePackageList() {
600 local input_file="$1"
601 local output_file="$2"
602 echo "Updating: ${output_file} from ${input_file}"
603 /bin/rm -f "${output_file}"
604 shift
605 shift
606 for pkg in $@ ; do
607 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \
608 egrep -o "pool/.*")
609 if [ -z "${pkg_full}" ]; then
610 echo "ERROR: missing package: $pkg"
611 exit 1
613 local pkg_nopool=$(echo "$pkg_full" | sed "s/^pool\///")
614 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \
615 grep ^SHA256: | sed 's/^SHA256: //')
616 if [ "${#sha256sum}" -ne "64" ]; then
617 echo "Bad sha256sum from Packages"
618 exit 1
620 echo $pkg_nopool $sha256sum >> "$output_file"
621 done
622 # sort -o does an in-place sort of this file
623 sort "$output_file" -o "$output_file"
627 #@ UpdatePackageListsAmd64
629 #@ Regenerate the package lists such that they contain an up-to-date
630 #@ list of URLs within the Debian archive. (For amd64)
631 UpdatePackageListsAmd64() {
632 GeneratePackageListAmd64 "$DEBIAN_DEP_LIST_AMD64"
633 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_AMD64"
637 #@ UpdatePackageListsI386
639 #@ Regenerate the package lists such that they contain an up-to-date
640 #@ list of URLs within the Debian archive. (For i386)
641 UpdatePackageListsI386() {
642 GeneratePackageListI386 "$DEBIAN_DEP_LIST_I386"
643 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_I386"
647 #@ UpdatePackageListsARM
649 #@ Regenerate the package lists such that they contain an up-to-date
650 #@ list of URLs within the Debian archive. (For arm)
651 UpdatePackageListsARM() {
652 GeneratePackageListARM "$DEBIAN_DEP_LIST_ARM"
653 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM"
657 #@ UpdatePackageListsMips
659 #@ Regenerate the package lists such that they contain an up-to-date
660 #@ list of URLs within the Debian archive. (For arm)
661 UpdatePackageListsMips() {
662 GeneratePackageListMips "$DEBIAN_DEP_LIST_MIPS"
663 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_MIPS"
667 #@ UpdatePackageListsAll
669 #@ Regenerate the package lists for all architectures.
670 UpdatePackageListsAll() {
671 RunCommand UpdatePackageListsAmd64
672 RunCommand UpdatePackageListsI386
673 RunCommand UpdatePackageListsARM
674 RunCommand UpdatePackageListsMips
677 RunCommand() {
678 SetEnvironmentVariables "$1"
679 SanityCheck
680 "$@"
683 if [ $# -eq 0 ] ; then
684 echo "ERROR: you must specify a mode on the commandline"
685 echo
686 Usage
687 exit 1
688 elif [ "$(type -t $1)" != "function" ]; then
689 echo "ERROR: unknown function '$1'." >&2
690 echo "For help, try:"
691 echo " $0 help"
692 exit 1
693 else
694 ChangeDirectory
695 if echo $1 | grep -qs "All$"; then
696 "$@"
697 else
698 RunCommand "$@"