From 952f516389af415ffe61830850fabbad9c4f5d3d Mon Sep 17 00:00:00 2001 From: udeved Date: Thu, 27 Apr 2017 15:13:22 +0200 Subject: [PATCH] util-*-chroot: minor changes --- lib/util-iso-chroot.sh | 20 +++++++++++++------- lib/util-pkg-chroot.sh | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/util-iso-chroot.sh b/lib/util-iso-chroot.sh index 81dc177..d423d5a 100644 --- a/lib/util-iso-chroot.sh +++ b/lib/util-iso-chroot.sh @@ -257,24 +257,30 @@ copy_from_cache(){ chroot_create(){ [[ "${1##*/}" == "rootfs" ]] && local flag="-L" setarch "${target_arch}" \ - mkchroot ${mkchroot_args[*]} ${flag} $@ + mkchroot "${mkchroot_args[@]}" ${flag} $@ } chroot_clean(){ - msg "Cleaning chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" - for root in "$1"/*fs; do + local dest="$1" +# msg "Cleaning chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" + for root in "$dest"/*; do [[ -d ${root} ]] || continue local name=${root##*/} if [[ $name != "mhwdfs" ]];then - stat_busy "Deleting chroot [%s] (%s) ..." "$name" "${1##*/}" - lock 9 "%s.lock" "Locking chroot '%s'" "${root}" "${root}" + slock 9 "%s.lock" "Locking chroot '%s'" "${root}" "${root}" + stat_busy "Deleting chroot [%s] (%s) ..." "${root}" "${root}" + subvolume_delete_recursive "${root}" + + stat_done + lock_close 9 + rm -rf --one-file-system "${root}" rm -f "${root}.lock" fi done - lock_close 9 - rm -rf --one-file-system "$1" + + rm -rf --one-file-system "$dest" } prepare_initcpio(){ diff --git a/lib/util-pkg-chroot.sh b/lib/util-pkg-chroot.sh index 80202ba..f3e75b9 100644 --- a/lib/util-pkg-chroot.sh +++ b/lib/util-pkg-chroot.sh @@ -148,12 +148,12 @@ chroot_init(){ local timer=$(get_timer) local dest="$1" init_base_devel - msg "Initialize chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" +# msg "Initialize chroot for [%s] (%s)..." "${target_branch}" "${target_arch}" mkdir -p "${dest}" setarch "${target_arch}" \ mkchroot "${mkchroot_args[@]}" \ "${dest}/root" \ - "${base_packages[@]}" || abort + ${base_packages[*]} || abort show_elapsed_time "${FUNCNAME}" "${timer}" }