Index: tools/install_dependencies.sh |
diff --git a/tools/install_dependencies.sh b/tools/install_dependencies.sh |
index ae98884d1e98f38c281d9718747199b9d1ecfe21..037b8940bd0609f2c5fcff8f4c5c6eeabb8ba087 100755 |
--- a/tools/install_dependencies.sh |
+++ b/tools/install_dependencies.sh |
@@ -10,21 +10,35 @@ |
set -e |
+# Return 0 iff all package name arguments are installed. |
+dpkg_all_installed() { |
+ for arg; do |
+ if !(dpkg-query -W -f'${Status}' "$arg" 2>/dev/null | \ |
+ grep -q "ok installed"); then |
+ return 1 |
+ fi |
+ done |
+ return 0 |
+} |
+ |
if command -v lsb_release > /dev/null ; then |
case $(lsb_release -i -s) in |
Ubuntu) |
- sudo apt-get install \ |
- build-essential \ |
- libfreetype6-dev \ |
- libfontconfig-dev \ |
- libpng12-dev \ |
- libgif-dev \ |
- libqt4-dev \ |
- clang |
- if [ $(lsb_release -r -s) = '14.04' ] ; then |
- sudo apt-get install \ |
- ninja-build |
- fi |
+ PACKAGES=$(cat<<-EOF |
+ build-essential |
+ libfreetype6-dev |
+ libfontconfig-dev |
+ libpng12-dev |
+ libgif-dev |
+ libqt4-dev |
+ EOF |
+ ) |
+ if [ $(lsb_release -r -s) = '14.04' ] ; then |
+ PACKAGES="${PACKAGES} ninja-build" |
+ fi |
+ if ! dpkg_all_installed $PACKAGES; then |
+ sudo apt-get install $PACKAGES |
+ fi |
exit |
;; |
esac |