From 1a8c282c2e7cd2c2a9e4699f6342ead9012252af Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Thu, 4 Oct 2012 14:22:07 +0100 Subject: Make install_perl_modules exit in error on failure Previously, install_perl_modules would exit with 0 regardless of whether installation of the modules succeeded or failed; this meant, in particularly, that when called from the install script with 'set -e', it's possible to miss that the module installation failed. By adding 'set -e' to install_perl_modules, we should get a useful exit code. --- bin/install_perl_modules | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'bin/install_perl_modules') diff --git a/bin/install_perl_modules b/bin/install_perl_modules index 2df4ffbf8..2311ae5f1 100755 --- a/bin/install_perl_modules +++ b/bin/install_perl_modules @@ -1,5 +1,7 @@ #!/bin/bash +set -e + DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd | sed -e 's/\/bin$//' )" $DIR/bin/cpanm -l $DIR/local Carton @@ -9,11 +11,7 @@ export PERL5LIB=$DIR/local/lib/perl5 carton install --deployment -perl -MImage::Magick -e 'exit()' >/dev/null 2>&1 - -HAVE_IM=$? - -if [ $HAVE_IM -ne 0 ] +if ! perl -MImage::Magick -e 'exit()' >/dev/null 2>&1 then read -p "Image::Magick is not installed. Do you want to attempt to install it?" yn case $yn in -- cgit v1.2.3