From e497ba164c11361f700d124ae9c89797aa80b95d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 6 Mar 2019 10:03:41 +0100 Subject: [PATCH] Cleanup directories before and after building a package In case a package build fails, we can simply restart the build script without having to do manual cleanup of the intermediate directories. Signed-off-by: David Oberhollenzer --- mk.sh | 6 +++--- util/pkgcmd.sh | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mk.sh b/mk.sh index 62a51bf..2aaa86f 100755 --- a/mk.sh +++ b/mk.sh @@ -92,8 +92,8 @@ while read pkg; do if [ ! -e "$PKGLOGDIR/.$pkg" ]; then include_pkg "$pkg" - rm -rf "$TCDIR/$TARGET" - mkdir -p "$TCDIR/$TARGET" + rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" + mkdir -p "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" if [ ! -z "$DEPENDS" ]; then pkg install -omD -r "$TCDIR/$TARGET" -R "$REPODIR" $DEPENDS @@ -110,7 +110,7 @@ while read pkg; do -l "$PKGDEPLOYDIR/${f}.files" done - rm -rf "$PKGBUILDDIR" "$PKGDEPLOYDIR" + rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR" touch "$PKGLOGDIR/.$pkg" fi done < "$PACKAGELIST" diff --git a/util/pkgcmd.sh b/util/pkgcmd.sh index cadaba9..40805a3 100644 --- a/util/pkgcmd.sh +++ b/util/pkgcmd.sh @@ -17,8 +17,6 @@ run_pkg_command() { echo "$PKGNAME - $FUNCTION" - mkdir -p "$PKGBUILDDIR" "$PKGDEPLOYDIR" - pushd "$PKGBUILDDIR" > /dev/null $FUNCTION "$SRC" &>> "$LOGFILE" < /dev/null popd > /dev/null