Skip to content

Commit

Permalink
refactor of the initialization of the script.
Browse files Browse the repository at this point in the history
Now the installation script has a few more extra checks for
existance of the directories and installation file since
the script could die in the early stage and leave some
dangling file.

see discussion
<gugod#568 (review)>
  • Loading branch information
fluca1978 committed Mar 13, 2018
1 parent 1755eaa commit 673cbd2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions perlbrew-install
Expand Up @@ -5,7 +5,13 @@ if [ -z "${PERLBREWURL}" ]; then
PERLBREWURL=https://raw.githubusercontent.com/gugod/App-perlbrew/master/perlbrew
fi

if [ -z "$TMPDIR" ]; then
clean_exit () {
[ ! -z "$LOCALINSTALLER" -a -f $LOCALINSTALLER ] && rm $LOCALINSTALLER
exit $1
}


if [ -z "$TMPDIR" -o ! -d "$TMPDIR" ]; then
if [ -d "/tmp" ]; then
TMPDIR="/tmp"
else
Expand All @@ -16,13 +22,6 @@ fi
# TMPDIR could have been exported as variable
# so it is required to change to such directory always
cd $TMPDIR || clean_exit 1


clean_exit () {
[ -f $LOCALINSTALLER ] && rm $LOCALINSTALLER
exit $1
}

LOCALINSTALLER=$(mktemp perlbrew.XXXXXX)


Expand Down

0 comments on commit 673cbd2

Please sign in to comment.