From dc8f4526a6d85e4018f4bd4af61aac08fd4e88e7 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 22 Jan 2017 17:06:06 +0100 Subject: ch: Add clean-single; improve cbuild cbuild now works with multiple builds running in parallel (hopefully) Signed-off-by: Florian Pritz --- ch | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'ch') diff --git a/ch b/ch index 1c97768..4baa097 100755 --- a/ch +++ b/ch @@ -6,7 +6,9 @@ set -e # ch build-single [ ... clean then build +# ch clean remove all working copies of this chroot +# ch clean-single remove only this specific working copy +# ch cbuild ... clean-single then build # ch install ... # install the package files in the chroot # ch kill remove a chroot (including master chroot) @@ -163,11 +165,21 @@ chclean() { continue fi + sudo btrfs subvolume delete "$copy/var/lib/machines" || true sudo btrfs subvolume delete "$copy" sudo rm -f "${copy%/}.lock" done } +chclean-single() { + __chrootalias_resolve_create "$1" || return + if [[ -e $copydir ]]; then + sudo btrfs subvolume delete "$copydir/var/lib/machines" || true + sudo btrfs subvolume delete "$copydir" + sudo rm -f "${copydir%/}.lock" + fi +} + chrshell() { __chrootalias_resolve_create "$1" || return sudo arch-nspawn "$chrootdir/root" "${2:-/bin/bash}" "${@:3}" @@ -190,7 +202,7 @@ case $command in ;; cbuild) for arg; do - chclean "$arg" + chclean-single "$arg" chbuild "$arg" done ;; @@ -224,6 +236,11 @@ case $command in done fi ;; + clean-single) + for arg; do + chclean-single "$arg" + done + ;; kill) for arg; do chkill $arg -- cgit v1.2.3-24-g4f1b