Skip to content

Commit

Permalink
install-deps.sh: exit on error if dependencies cannot be installed
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ldachary committed May 8, 2015
1 parent 7b28a6f commit c255e80
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions install-deps.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e
#
# Ceph distributed storage system
#
Expand Down Expand Up @@ -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
Expand All @@ -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."
Expand All @@ -92,15 +92,15 @@ 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)
require=$(ls *requirements.txt 2>/dev/null | sed -e 's/^/-r /')
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
Expand Down

0 comments on commit c255e80

Please sign in to comment.