Skip to content

Commit

Permalink
More error checking checking
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Mar 24, 2014
1 parent e597590 commit ceb5eec
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions nextflow
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eE
#!/bin/bash
#
# Copyright (c) 2013, Paolo Di Tommaso <[email protected]>
#
Expand Down Expand Up @@ -28,9 +28,7 @@ function get() {
fi

printf "Downloading nextflow dependencies. It may require some seconds, please wait .. "
set +e
$GET; status=$?
set -e
printf "\r\033[K"
if [ $status -ne 0 ]; then
echo "Error: cannot download nextflow required file -- make sure you can connect the internet"
Expand All @@ -46,14 +44,14 @@ function get() {
}

function install() {
if [ "$(uname)" = 'Darwin' ]; then tmpfile=$(mktemp $PWD/XXXXX);
else tmpfile=$(mktemp -t XXXXX --tmpdir=$PWD);
if [ "$(uname)" = 'Darwin' ]; then tmpfile=$(mktemp $PWD/XXXXX) || exit $?
else tmpfile=$(mktemp -t XXXXX --tmpdir=$PWD) || exit $?
fi

get "http://nextflow.io/releases/latest/nextflow" "$tmpfile" "$1"
mv $tmpfile $1;
chmod +x $1
bash $1 -download
get "http://nextflow.io/releases/latest/nextflow" "$tmpfile" "$1" || exit $?
mv $tmpfile $1 || exit $?
chmod +x $1 || exit $?
bash $1 -download || exit $?
echo ''
echo -e $'Nextflow installation completed. Please note:'
echo -e $'- the executable file \'nextflow\' has been created in this folder'
Expand All @@ -64,8 +62,10 @@ function install() {
# check self-install
if [ "$0" = "bash" ] || [ "$0" = "/bin/bash" ]; then
if [ -d nextflow ]; then
echo "The install procedure needs to create a file named 'nextflow' in this folder, but a directory with this name already exists."
echo "Please renamed/delete that directory, or execute the Nextflow install procedure in another folder."
echo 'Please note:'
echo "- The install procedure needs to create a file named 'nextflow' in this folder, but a directory with this name already exists."
echo "- Please renamed/delete that directory, or execute the Nextflow install procedure in another folder."
echo ''
exit 1
fi
install "$PWD/nextflow"
Expand All @@ -87,8 +87,8 @@ for opt in "$@"; do
hazelcast)
NXF_PACK='hz';;
-download)
rm -rf $NXF_HOME/framework/$NXF_VER
$0 -version
rm -rf $NXF_HOME/framework/$NXF_VER || exit $?
$0 -version || exit $?
exit 0;;
-self-update|self-update)
install $0;
Expand All @@ -111,7 +111,7 @@ if [ ! -f "$NXF_BIN" ]; then
exit 1
fi

mkdir -p $NXF_PATH
mkdir -p $NXF_PATH || exit $?
get "$NXF_URL" "$NXF_BIN"
fi

Expand Down

0 comments on commit ceb5eec

Please sign in to comment.