diff options
author | Erich Eckner <git@eckner.net> | 2021-08-31 19:55:45 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-08-31 19:55:45 +0200 |
commit | 54282a81301fd506a934c2bb9801e1775e65e99d (patch) | |
tree | 4ebf33f985c61667e2e2b38cc13e5489acf0fa89 /update-sources | |
parent | 37fa93d74abb40033cfc423f1e884899e3453600 (diff) | |
download | archlinuxewe-54282a81301fd506a934c2bb9801e1775e65e99d.tar.xz |
update-sources: add lock
Diffstat (limited to 'update-sources')
-rwxr-xr-x | update-sources | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/update-sources b/update-sources index 8cae06165..1b4e98daf 100755 --- a/update-sources +++ b/update-sources @@ -8,6 +8,12 @@ if [ $# -eq 0 ]; then [ -d "${srcDir}" ] || exit 0 + lockFile="${srcDir}/.lock" + if [ -s "${lockFile}" ] && kill -0 "$(cat "${lockFile}")"; then + exit + fi + echo $$ >"${lockFile}" + find "${srcDir}" \ -type d \ -exec sh -c 'test -f "{}/HEAD"' \; \ @@ -19,6 +25,8 @@ if [ $# -eq 0 ]; then -prune \ | parallel -j 0 -l 1 "$0" + rm -f "${lockFile}" + elif [ $# -eq 1 ]; then case "${1%%: *}" in |