diff options
-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 |