diff options
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r-- | makechrootpkg.in | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index bf4034e..0164754 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -121,23 +121,14 @@ chroottype=$(stat -f -c %T "$chrootdir") # Lock the chroot we want to use. We'll keep this lock until we exit. # Note this is the same FD number as in mkarchroot -exec 9>"$copydir.lock" -if ! flock -n 9; then - stat_busy "Locking chroot copy [$copy]" - flock 9 - stat_done -fi +lock_open_write 9 "$copydir" \ + "Waiting for existing lock on chroot copy to be released: [$copy]" if [[ ! -d $copydir ]] || $clean_first; then # Get a read lock on the root chroot to make # sure we don't clone a half-updated chroot - exec 8>"$chrootdir/root.lock" - - if ! flock -sn 8; then - stat_busy "Locking clean chroot" - flock -s 8 - stat_done - fi + lock_open_read 8 "$chrootdir/root" \ + "Waiting for existing lock on clean chroot to be released" stat_busy "Creating clean working copy [$copy]" if [[ "$chroottype" == btrfs ]]; then @@ -154,7 +145,7 @@ if [[ ! -d $copydir ]] || $clean_first; then stat_done # Drop the read lock again - exec 8>&- + lock_close 8 fi if [[ -n "${install_pkgs[*]}" ]]; then @@ -289,11 +280,11 @@ EOF chmod +x "$copydir/chrootbuild" if arch-nspawn "$copydir" /chrootbuild; then + mkdir -p "$copydir/repo" for pkgfile in "$copydir"/pkgdest/*.pkg.tar.?z; do if $add_to_db; then - mkdir -p "$copydir/repo" + cp "$pkgfile" "$copydir/repo" pushd "$copydir/repo" >/dev/null - cp "$pkgfile" . repo-add repo.db.tar.gz "${pkgfile##*/}" popd >/dev/null fi |