shutils/make-binpkg.sh: cleanup while creating unfinished binpkgs.
- If creating the binpkg fails remove the file, the same if SIGINT is caught. --HG-- extra : convert_revision : 113ce6580cc514c791835d87bf572a566b3341f8
This commit is contained in:
parent
faed7daa5c
commit
a94b2511d0
1 changed files with 17 additions and 2 deletions
|
@ -43,6 +43,13 @@ xbps_make_binpkg()
|
|||
return $?
|
||||
}
|
||||
|
||||
binpkg_cleanup()
|
||||
{
|
||||
printf "\nInterrupted! removing $binpkg file!\n"
|
||||
rm -f $pkgdir/$binpkg
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# This function builds a binary package from an installed xbps
|
||||
# package in destdir.
|
||||
|
@ -78,7 +85,7 @@ xbps_make_binpkg_real()
|
|||
# Don't overwrite existing binpkgs by default, skip them.
|
||||
#
|
||||
if [ -f $pkgdir/$binpkg ]; then
|
||||
msg_normal "Skipping existing $binpkg ..."
|
||||
echo "=> Skipping existing $binpkg pkg..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
@ -104,11 +111,19 @@ xbps_make_binpkg_real()
|
|||
[ -n "$XBPS_COMPRESS_LEVEL" ] && clevel="-$XBPS_COMPRESS_LEVEL"
|
||||
|
||||
[ ! -d $pkgdir ] && mkdir -p $pkgdir
|
||||
|
||||
# Remove binpkg if interrupted...
|
||||
trap "binpkg_cleanup" INT
|
||||
|
||||
echo -n "=> Building $binpkg... "
|
||||
run_rootcmd $use_sudo tar --exclude "var/db/xbps/metadata/*/flist" \
|
||||
-cpf - ${mfiles} ${dirs} | \
|
||||
$XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg
|
||||
if [ $? -eq 0 ]; then
|
||||
msg_normal "Built package: $binpkg"
|
||||
echo "done."
|
||||
else
|
||||
rm -f $pkgdir/$binpkg
|
||||
echo "failed!"
|
||||
fi
|
||||
|
||||
return $?
|
||||
|
|
Loading…
Reference in a new issue