[arch-projects] [DEVTOOLS][PATCH 6/6] makechrootpkg: Remove btrfs copy after successful build
Sébastien Luttringer
seblu at seblu.net
Fri Mar 1 23:21:13 EST 2013
Avoid to manually cleanup of subvolumes when a build was successful.
Really useful with random copy directory.
Signed-off-by: Sébastien Luttringer <seblu at seblu.net>
---
makechrootpkg.in | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 0e2d5c0..3f160bc 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -23,6 +23,7 @@ chrootdir=
passeddir=
declare -a install_pkgs
declare -i ret=0
+no_purge=false
default_copy=$USER
[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER
@@ -58,10 +59,11 @@ usage() {
echo ' Useful for maintaining multiple copies.'
echo " Default: $default_copy or random for btrfs"
echo '-n Run namcap on the package'
+ echo "-p Don't purge the chroot copy after succesful build (btrfs only)"
exit 1
}
-while getopts 'hcudr:I:l:n' arg; do
+while getopts 'hcudr:I:l:np' arg; do
case "$arg" in
h) usage ;;
c) clean_first=true ;;
@@ -71,6 +73,7 @@ while getopts 'hcudr:I:l:n' arg; do
I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
+ p) no_purge=true ;;
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
esac
done
@@ -321,4 +324,8 @@ done
if (( ret != 0 )); then
die "Build failed, check $copydir/build"
+elif [[ "$chroottype" == btrfs ]] && ! $no_purge; then
+ btrfs subvolume delete "$copydir" >/dev/null ||
+ error "Unable to delete subvolume $copydir"
+ rm "$copydir.lock"
fi
--
Sébastien "Seblu" Luttringer
More information about the arch-projects
mailing list