crossgcc: Move temp file handling into cleanup function

Move code to handle leaving temp files around into cleanup.

Change-Id: Ief346d7973f693ec06c8bef6492cf1330858d9e1
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/14346
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Stefan Reinauer 2016-04-06 15:39:48 -07:00
parent 7844912f37
commit 88e83e580d
1 changed files with 6 additions and 5 deletions

View File

@ -332,6 +332,11 @@ build() {
cleanup()
{
if [ $SAVETEMPS -ne 0 ]; then
printf "Leaving temporary files around... ${green}ok${NC}\n"
return
fi
printf "Cleaning up temporary files... "
for package in $PACKAGES; do
rm -rf build-${TARGETARCH}-$package build-$package $(eval echo \$$package"_DIR")
@ -811,10 +816,6 @@ PROGNAME=$(basename "$0")
rm -f "$DESTDIR$TARGETDIR/share/$PROGNAME-*"
cp "$PROGNAME" "$DESTDIR$TARGETDIR/share/$PROGNAME-$CROSSGCC_VERSION-$CROSGCC_COMMIT"
if [ $SAVETEMPS -eq 0 ]; then
cleanup
else
printf "Leaving temporary files around... ${green}ok${NC}\n"
fi
cleanup
printf "\n${green}You can now run your $NAME toolchain from $TARGETDIR.${NC}\n"