Index: build/install-build-deps.sh |
diff --git a/build/install-build-deps.sh b/build/install-build-deps.sh |
index cda72a66978c7b365c8ef2bb6f61f1c36e56bbdd..24873364ea064d404c8d4086a899d48367070212 100755 |
--- a/build/install-build-deps.sh |
+++ b/build/install-build-deps.sh |
@@ -17,6 +17,10 @@ usage() { |
echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\ |
"fonts" |
echo "--no-prompt: silently select standard options/defaults" |
+ echo "--quick-check: quickly try to determine if dependencies are installed" |
+ echo " (this avoids interactive prompts and sudo commands," |
+ echo " so might not be 100% accurate)" |
+ echo "--unsupported: attempt installation even on unsupported systems" |
echo "Script will prompt interactively if options not given." |
exit 1 |
} |
@@ -41,6 +45,7 @@ do |
--no-prompt) do_default=1 |
do_quietly="-qq --assume-yes" |
;; |
+ --quick-check) do_quick_check=1;; |
--unsupported) do_unsupported=1;; |
*) usage;; |
esac |
@@ -55,7 +60,7 @@ ubuntu_issue="Ubuntu ($ubuntu_versions|$ubuntu_codenames)" |
# they're doing. |
gcel_issue="^GCEL" |
-if [ 0 -eq "${do_unsupported-0}" ] ; then |
+if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then |
if ! egrep -q "($ubuntu_issue|$gcel_issue)" /etc/issue; then |
echo "ERROR: Only Ubuntu 12.04 (precise) through 13.04 (raring) are"\ |
"currently supported" >&2 |
@@ -68,14 +73,14 @@ if [ 0 -eq "${do_unsupported-0}" ] ; then |
fi |
fi |
-if [ "x$(id -u)" != x0 ]; then |
+if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then |
echo "Running as non-root user." |
echo "You might have to enter your password one or more times for 'sudo'." |
echo |
fi |
# Packages needed for chromeos only |
-chromeos_dev_list="libbluetooth-dev libbrlapi-dev" |
+chromeos_dev_list="libbluetooth-dev" |
# Packages need for development |
dev_list="apache2.2-bin bison curl elfutils fakeroot flex g++ gperf |
@@ -100,7 +105,7 @@ if [ "$(uname -m)" = "x86_64" ]; then |
fi |
# Run-time libraries required by chromeos only |
-chromeos_lib_list="libpulse0 libbz2-1.0 libcurl4-gnutls-dev" |
+chromeos_lib_list="libpulse0 libbz2-1.0" |
# Full list of required run-time libraries |
lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1 |
@@ -203,7 +208,7 @@ yes_no() { |
done |
} |
-if test "$do_inst_syms" = "" |
+if test "$do_inst_syms" = "" && test 0 -eq ${do_quick_check-0} |
then |
echo "This script installs all tools and libraries needed to build Chromium." |
echo "" |
@@ -216,9 +221,9 @@ then |
fi |
fi |
if test "$do_inst_syms" = "1"; then |
- echo "Installing debugging symbols." |
+ echo "Including debugging symbols." |
else |
- echo "Skipping installation of debugging symbols." |
+ echo "Skipping debugging symbols." |
dbg_list= |
fi |
@@ -229,19 +234,59 @@ if [ "$(uname -m)" = "x86_64" ]; then |
arm_list="$arm_list g++-multilib" |
fi |
-if test "$do_inst_arm" = "1"; then |
+if test "$do_inst_arm" = "1" ; then |
. /etc/lsb-release |
- if test "$DISTRIB_CODENAME" != "precise"; then |
+ if ! [ "${DISTRIB_CODENAME}" = "precise" -o \ |
+ 1 -eq "${do_unsupported-0}" ]; then |
echo "ERROR: Installing the ARM cross toolchain is only available on" \ |
"Ubuntu precise." >&2 |
exit 1 |
fi |
- echo "Installing ARM cross toolchain." |
+ echo "Including ARM cross toolchain." |
else |
- echo "Skipping installation of ARM cross toolchain." |
+ echo "Skipping ARM cross toolchain." |
arm_list= |
fi |
+packages="$(echo "${dev_list} ${lib_list} ${dbg_list} ${arm_list}" | \ |
+ tr " " "\n" | sort -u | tr "\n" " ")" |
+ |
+if [ 1 -eq "${do_quick_check-0}" ] ; then |
+ failed_check="$(dpkg-query -W -f '${PackageSpec}:${Status}\n' \ |
+ ${packages} 2>&1 | grep -v "ok installed" || :)" |
+ if [ -n "${failed_check}" ]; then |
+ echo |
+ nomatch="$(echo "${failed_check}" | \ |
+ sed -e "s/^No packages found matching \(.*\).$/\1/;t;d")" |
+ missing="$(echo "${failed_check}" | \ |
+ sed -e "/^No packages found matching/d;s/^\(.*\):.*$/\1/")" |
+ if [ "$nomatch" ]; then |
+ # Distinguish between packages that actually aren't available to the |
+ # system (i.e. not in any repo) and packages that just aren't known to |
+ # dpkg (i.e. managed by apt). |
+ unknown="" |
+ for p in ${nomatch}; do |
+ if apt-cache show ${p} > /dev/null 2>&1; then |
+ missing="${p}\n${missing}" |
+ else |
+ unknown="${p}\n${unknown}" |
+ fi |
+ done |
+ if [ -n "${unknown}" ]; then |
+ echo "WARNING: The following packages are unknown to your system" |
+ echo "(maybe missing a repo or need to 'sudo apt-get update'):" |
+ echo -e "${unknown}" | sed -e "s/^/ /" |
+ fi |
+ fi |
+ if [ -n "${missing}" ]; then |
+ echo "WARNING: The following packages are not installed:" |
+ echo -e "${missing}" | sed -e "s/^/ /" |
+ fi |
+ exit 1 |
+ fi |
+ exit 0 |
+fi |
+ |
sudo apt-get update |
# We initially run "apt-get" with the --reinstall option and parse its output. |
@@ -249,7 +294,6 @@ sudo apt-get update |
# without accidentally promoting any packages from "auto" to "manual". |
# We then re-run "apt-get" with just the list of missing packages. |
echo "Finding missing packages..." |
-packages="${dev_list} ${lib_list} ${dbg_list} ${arm_list}" |
# Intentionally leaving $packages unquoted so it's more readable. |
echo "Packages required: " $packages |
echo |