[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 1 | #!/bin/bash -e |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 2 | |
[email protected] | 2a89cd9 | 2012-02-18 01:58:43 | [diff] [blame] | 3 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
5 | # found in the LICENSE file. | ||||
6 | |||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 7 | # Script to install everything needed to build chromium on android that |
8 | # requires sudo privileges. | ||||
9 | # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 10 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 11 | DOWNLOAD_URL="http://ftp.us.debian.org/debian/pool/non-free/s/sun-java6" |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 12 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 13 | BIN_FILE_NAME="sun-java6-bin_6.26-0squeeze1_amd64.deb" |
14 | JRE_FILE_NAME="sun-java6-jre_6.26-0squeeze1_all.deb" | ||||
15 | JDK_FILE_NAME="sun-java6-jdk_6.26-0squeeze1_amd64.deb" | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 16 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 17 | if ! uname -m | egrep -q "i686|x86_64"; then |
18 | echo "Only x86 architectures are currently supported" >&2 | ||||
19 | exit | ||||
20 | fi | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 21 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 22 | if [ "x$(id -u)" != x0 ]; then |
23 | echo "Running as non-root user." | ||||
24 | echo "You might have to enter your password one or more times for 'sudo'." | ||||
25 | echo | ||||
26 | fi | ||||
27 | |||||
28 | sudo apt-get update | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 29 | |
30 | # The temporary directory used to store the downloaded file. | ||||
31 | TEMPDIR=$(mktemp -d) | ||||
32 | cleanup() { | ||||
33 | local status=${?} | ||||
34 | trap - EXIT | ||||
35 | rm -rf "${TEMPDIR}" | ||||
36 | exit ${status} | ||||
37 | } | ||||
38 | trap cleanup EXIT | ||||
39 | |||||
40 | ########################################################## | ||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 41 | # Download (i.e. wget) and install debian package. |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 42 | # The current directory is changed in this function. |
43 | # Arguments: | ||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 44 | # file_name |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 45 | # Returns: |
46 | # None | ||||
47 | ########################################################## | ||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 48 | install_deb_pkg() { |
49 | local file_name="${1}" | ||||
50 | local download_url="${DOWNLOAD_URL}/${file_name}" | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 51 | |
52 | cd "${TEMPDIR}" | ||||
53 | wget "${download_url}" | ||||
54 | |||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 55 | echo "Install ${file_name}" |
56 | sudo dpkg -i "${file_name}" | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 57 | } |
58 | |||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 59 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 60 | # Install ant |
61 | sudo apt-get install python-pexpect ant | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 62 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 63 | # Install sun-java6-bin |
64 | install_deb_pkg "${BIN_FILE_NAME}" | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 65 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 66 | # Install sun-java6-jre |
67 | install_deb_pkg "${JRE_FILE_NAME}" | ||||
[email protected] | 58b0fd67 | 2011-11-01 23:25:47 | [diff] [blame] | 68 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 69 | # Install sun-java6-jdk |
70 | install_deb_pkg "${JDK_FILE_NAME}" | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 71 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 72 | # Switch version of Java to java-6-sun |
73 | sudo update-java-alternatives -s java-6-sun | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 74 | |
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 75 | echo "install-build-deps-android.sh complete." |