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 # DIST_UPDATES=trusty-updates |
10 # APT_REPO=http://archive.ubuntu.com/ubuntu | 11 # APT_REPO=http://archive.ubuntu.com/ubuntu |
11 # KEYRING_FILE=/usr/share/keyrings/ubuntu-archive-keyring.gpg | 12 # KEYRING_FILE=/usr/share/keyrings/ubuntu-archive-keyring.gpg |
12 # DEBIAN_PACKAGES="gcc libz libssl" | 13 # DEBIAN_PACKAGES="gcc libz libssl" |
13 | 14 |
14 #@ This script builds Debian/Ubuntu sysroot images for building Google Chrome. | 15 #@ This script builds Debian/Ubuntu sysroot images for building Google Chrome. |
15 #@ | 16 #@ |
16 #@ Generally this script is invoked as: | 17 #@ Generally this script is invoked as: |
17 #@ sysroot-creator-<flavour>.sh <mode> <args>* | 18 #@ sysroot-creator-<flavour>.sh <mode> <args>* |
18 #@ Available modes are shown below. | 19 #@ Available modes are shown below. |
19 #@ | 20 #@ |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DownloadOrCopy() { | 97 DownloadOrCopy() { |
97 if [ -f "$2" ] ; then | 98 if [ -f "$2" ] ; then |
98 echo "$2 already in place" | 99 echo "$2 already in place" |
99 return | 100 return |
100 fi | 101 fi |
101 | 102 |
102 HTTP=0 | 103 HTTP=0 |
103 echo "$1" | grep -qs ^http:// && HTTP=1 | 104 echo "$1" | grep -qs ^http:// && HTTP=1 |
104 if [ "$HTTP" = "1" ]; then | 105 if [ "$HTTP" = "1" ]; then |
105 SubBanner "downloading from $1 -> $2" | 106 SubBanner "downloading from $1 -> $2" |
106 wget "$1" -O "${2}.partial" | 107 # Appending the "$$" shell pid is necessary here to prevent concurrent |
107 mv "${2}.partial" $2 | 108 # instances of sysroot-creator.sh from trying to write to the same file. |
| 109 wget "$1" -O "${2}.partial.$$" |
| 110 mv "${2}.partial.$$" $2 |
108 else | 111 else |
109 SubBanner "copying from $1" | 112 SubBanner "copying from $1" |
110 cp "$1" "$2" | 113 cp "$1" "$2" |
111 fi | 114 fi |
112 } | 115 } |
113 | 116 |
114 | 117 |
115 SetEnvironmentVariables() { | 118 SetEnvironmentVariables() { |
116 ARCH="" | 119 ARCH="" |
117 echo $1 | grep -qs Amd64$ && ARCH=AMD64 | 120 echo $1 | grep -qs Amd64$ && ARCH=AMD64 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 550 |
548 #@ | 551 #@ |
549 #@ BuildSysrootMips | 552 #@ BuildSysrootMips |
550 #@ | 553 #@ |
551 #@ Build everything and package it | 554 #@ Build everything and package it |
552 BuildSysrootMips() { | 555 BuildSysrootMips() { |
553 if [ "$HAS_ARCH_MIPS" = "0" ]; then | 556 if [ "$HAS_ARCH_MIPS" = "0" ]; then |
554 return | 557 return |
555 fi | 558 fi |
556 ClearInstallDir | 559 ClearInstallDir |
557 local package_file="$BUILD_DIR/package_with_sha256sum_arm" | 560 local package_file="$BUILD_DIR/package_with_sha256sum_mips" |
558 GeneratePackageListMips "$package_file" | 561 GeneratePackageListMips "$package_file" |
559 local files_and_sha256sums="$(cat ${package_file})" | 562 local files_and_sha256sums="$(cat ${package_file})" |
560 StripChecksumsFromPackageList "$package_file" | 563 StripChecksumsFromPackageList "$package_file" |
561 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS" | 564 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS" |
562 APT_REPO=${APT_REPO_MIPS:=$APT_REPO} | 565 APT_REPO=${APT_REPO_MIPS:=$APT_REPO} |
563 InstallIntoSysroot ${files_and_sha256sums} | 566 InstallIntoSysroot ${files_and_sha256sums} |
564 CleanupJailSymlinks | 567 CleanupJailSymlinks |
565 HacksAndPatchesMips | 568 HacksAndPatchesMips |
566 CreateTarBall | 569 CreateTarBall |
567 } | 570 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 #@ | 809 #@ |
807 #@ Regenerate the package lists for all architectures. | 810 #@ Regenerate the package lists for all architectures. |
808 UpdatePackageListsAll() { | 811 UpdatePackageListsAll() { |
809 RunCommand UpdatePackageListsAmd64 | 812 RunCommand UpdatePackageListsAmd64 |
810 RunCommand UpdatePackageListsI386 | 813 RunCommand UpdatePackageListsI386 |
811 RunCommand UpdatePackageListsARM | 814 RunCommand UpdatePackageListsARM |
812 RunCommand UpdatePackageListsARM64 | 815 RunCommand UpdatePackageListsARM64 |
813 RunCommand UpdatePackageListsMips | 816 RunCommand UpdatePackageListsMips |
814 } | 817 } |
815 | 818 |
| 819 #@ |
| 820 #@ PrintArchitectures |
| 821 #@ |
| 822 #@ Prints supported architectures. |
| 823 PrintArchitectures() { |
| 824 if [ "$HAS_ARCH_AMD64" = "1" ]; then |
| 825 echo Amd64 |
| 826 fi |
| 827 if [ "$HAS_ARCH_I386" = "1" ]; then |
| 828 echo I386 |
| 829 fi |
| 830 if [ "$HAS_ARCH_ARM" = "1" ]; then |
| 831 echo ARM |
| 832 fi |
| 833 if [ "$HAS_ARCH_ARM64" = "1" ]; then |
| 834 echo ARM64 |
| 835 fi |
| 836 if [ "$HAS_ARCH_MIPS" = "1" ]; then |
| 837 echo Mips |
| 838 fi |
| 839 } |
| 840 |
| 841 #@ |
| 842 #@ PrintDistro |
| 843 #@ |
| 844 #@ Prints distro. eg: ubuntu |
| 845 PrintDistro() { |
| 846 echo ${DISTRO} |
| 847 } |
| 848 |
| 849 #@ |
| 850 #@ DumpRelease |
| 851 #@ |
| 852 #@ Prints disto release. eg: trusty |
| 853 PrintRelease() { |
| 854 echo ${DIST} |
| 855 } |
| 856 |
816 RunCommand() { | 857 RunCommand() { |
817 SetEnvironmentVariables "$1" | 858 SetEnvironmentVariables "$1" |
818 SanityCheck | 859 SanityCheck |
819 "$@" | 860 "$@" |
820 } | 861 } |
821 | 862 |
822 if [ $# -eq 0 ] ; then | 863 if [ $# -eq 0 ] ; then |
823 echo "ERROR: you must specify a mode on the commandline" | 864 echo "ERROR: you must specify a mode on the commandline" |
824 echo | 865 echo |
825 Usage | 866 Usage |
826 exit 1 | 867 exit 1 |
827 elif [ "$(type -t $1)" != "function" ]; then | 868 elif [ "$(type -t $1)" != "function" ]; then |
828 echo "ERROR: unknown function '$1'." >&2 | 869 echo "ERROR: unknown function '$1'." >&2 |
829 echo "For help, try:" | 870 echo "For help, try:" |
830 echo " $0 help" | 871 echo " $0 help" |
831 exit 1 | 872 exit 1 |
832 else | 873 else |
833 ChangeDirectory | 874 ChangeDirectory |
834 if echo $1 | grep -qs "All$"; then | 875 if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then |
835 "$@" | 876 "$@" |
836 else | 877 else |
837 RunCommand "$@" | 878 RunCommand "$@" |
838 fi | 879 fi |
839 fi | 880 fi |
OLD | NEW |