From 88e83e580d0a95058be474014fb4f4e0be28d169 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Wed, 6 Apr 2016 15:39:48 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/14346 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/crossgcc/buildgcc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc index ea7c2e9853..98b57f7bb6 100755 --- a/util/crossgcc/buildgcc +++ b/util/crossgcc/buildgcc @@ -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" -- cgit v1.2.3