1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 16:07:18 +00:00

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

View File

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