diff options
author | Jan Steffens <jan.steffens@gmail.com> | 2011-03-13 19:06:27 +0100 |
---|---|---|
committer | Jan Steffens <jan.steffens@gmail.com> | 2011-03-22 19:47:32 +0100 |
commit | 174ff59dba8c24f544e354cd43f3b68aea91d265 (patch) | |
tree | 08eec872ad89cdb98850082347566a975067f377 /archbuild | |
parent | 5434d3991cd51873f987bde49d55948341c09f3e (diff) |
Add flock-based locking to chroots
This prevents accidents when chroots are shared between multiple users.
Diffstat (limited to 'archbuild')
-rwxr-xr-x | archbuild | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -36,6 +36,19 @@ fi if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then echo "Creating chroot for [${repo}] (${arch})..." + + for copy in ${chroots}/${repo}-${arch}/*; do + [[ -d $copy ]] || continue + echo "Deleting chroot copy '$(basename "${copy}")'..." + + # Lock the copy + exec 9>${copy}.lock + flock 9 + + rm -rf ${copy} + done + exec 9>&- + rm -rf ${chroots}/${repo}-${arch} mkdir -p ${chroots}/${repo}-${arch} setarch ${arch} mkarchroot \ |