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 <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-06 10:03:41 +01:00
parent 8fa44569d8
commit e497ba164c
2 changed files with 3 additions and 5 deletions

6
mk.sh
View File

@ -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"

View File

@ -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