Make bootstrap script clean up after itself in case of errors

This commit is contained in:
Kristóf Tóth 2018-04-14 02:01:15 +02:00
parent 01eaf08f73
commit cf1174250b
1 changed files with 3 additions and 2 deletions

View File

@ -12,7 +12,8 @@ LOGFILE=/tmp/bootstrap_tfw.log
showlog() { echo && echo "Error! Showing logs:" && cat $LOGFILE; }
cleanlog() { rm $LOGFILE; }
trap showlog ERR
err_cleanup() { rm -rf "$BASEIMAGE" "$FRONTEND" "$TEST"; }
trap 'err_cleanup; showlog' ERR
trap cleanlog EXIT
: > $LOGFILE
@ -23,7 +24,7 @@ echo -n "test... " && git clone git@github.com:avatao-content/${TEST}.git >> $LO
echo "Done!"
echo -n "Installing frontend dependencies... "
cd ${FRONTEND}
cd "$FRONTEND"
yarn install >> $LOGFILE 2>&1
cd ..
echo "Done!"