aboutsummaryrefslogtreecommitdiffstats
path: root/bin/install_perl_modules
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2012-10-04 14:22:07 +0100
committerMark Longair <mhl@pobox.com>2012-10-04 14:25:06 +0100
commit1a8c282c2e7cd2c2a9e4699f6342ead9012252af (patch)
treee2f247dc5db1ecb4ea87c4ff6461dfe2e0d54602 /bin/install_perl_modules
parent98171090747addff1583a9c7744eca7d4255312f (diff)
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.
Diffstat (limited to 'bin/install_perl_modules')
-rwxr-xr-xbin/install_perl_modules8
1 files changed, 3 insertions, 5 deletions
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