]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: exit on error if dependencies cannot be installed 4615/head
authorLoic Dachary <ldachary@redhat.com>
Fri, 8 May 2015 07:19:44 +0000 (09:19 +0200)
committerLoic Dachary <ldachary@redhat.com>
Fri, 8 May 2015 07:46:02 +0000 (09:46 +0200)
Now that pre-installing pip dependencies is done at the end of the
script, the last command to run is no longer the installation
command. Therefore the status of the script is no longer the status of
the install command and no longer reflect success or failure to install
the dependencies. Add explicit || exit 1 to commands that are to be
treated as fatal errors.

Also set -e so that another error has a better chance to be caught.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
install-deps.sh

index 3710707d5732b738f74d8742a7663f577bfa977f..93297869fbf8f17844e15c36fd8baefc52504c14 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
 #
 # Ceph distributed storage system
 #
@@ -52,7 +52,7 @@ Ubuntu|Debian|Devuan)
                 ;;
         esac
         packages=$(echo $packages) # change newlines into spaces
-        $SUDO bash -c "DEBIAN_FRONTEND=noninteractive apt-get install $backports -y $packages"
+        $SUDO bash -c "DEBIAN_FRONTEND=noninteractive apt-get install $backports -y $packages" || exit 1
         ;;
 CentOS|Fedora|RedHatEnterpriseServer)
         case $(lsb_release -si) in
@@ -73,11 +73,11 @@ CentOS|Fedora|RedHatEnterpriseServer)
                 ;;
         esac
         sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
-        $SUDO yum-builddep -y $DIR/ceph.spec
+        $SUDO yum-builddep -y $DIR/ceph.spec || exit 1
         ;;
 *SUSE*)
         sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
-        $SUDO zypper --non-interactive install $(rpmspec -q --buildrequires $DIR/ceph.spec)
+        $SUDO zypper --non-interactive install $(rpmspec -q --buildrequires $DIR/ceph.spec) || exit 1
         ;;
 *)
         echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
@@ -92,7 +92,7 @@ for interpreter in python2.7 python3 ; do
     rm -fr install-deps
     virtualenv --python $interpreter install-deps
     . install-deps/bin/activate
-    pip --log install-deps/log.txt install wheel
+    pip --log install-deps/log.txt install wheel || exit 1
     find . -name tox.ini | while read ini ; do
         (
             cd $(dirname $ini)
@@ -100,7 +100,7 @@ for interpreter in python2.7 python3 ; do
             if test "$require" ; then
                 # although pip comes with virtualenv, having a recent version
                 # of pip matters when it comes to using wheel packages
-                pip --log install-deps/log.txt wheel $require 'distribute >= 0.7' 'pip >= 6.1'
+                pip --log install-deps/log.txt wheel $require 'distribute >= 0.7' 'pip >= 6.1' || exit 1
             fi
         )
     done