diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-01-22 17:06:06 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-01-22 17:06:06 +0100 |
commit | dc8f4526a6d85e4018f4bd4af61aac08fd4e88e7 (patch) | |
tree | 614572f81d0d917d3bbf2abe2af2d8ec96e15405 | |
parent | ec60a064cdd8a2eec93f0d1312209f42aca88e38 (diff) | |
download | bin-dc8f4526a6d85e4018f4bd4af61aac08fd4e88e7.tar.gz bin-dc8f4526a6d85e4018f4bd4af61aac08fd4e88e7.tar.xz |
ch: Add clean-single; improve cbuild
cbuild now works with multiple builds running in parallel (hopefully)
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | ch | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -6,7 +6,9 @@ set -e # ch build-single <id> [<arguments] # build the current package for one chroot and pass arguments to makechrootpkg # ch clean remove all working copies -# ch cbuild <id> ... clean then build +# ch clean <id> remove all working copies of this chroot +# ch clean-single <id> remove only this specific working copy +# ch cbuild <id> ... clean-single then build # ch install <id> <package files>... # install the package files in the chroot # ch kill <id> 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 |