From c9d72df9e6cc51155306b30b2f23b2e4f58fdc05 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 9 Dec 2010 06:52:34 +0100 Subject: repo_lock: check if repo is locked by repo-add or repo-remove --- db-functions | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'db-functions') diff --git a/db-functions b/db-functions index cb76e7a..8ac9e63 100644 --- a/db-functions +++ b/db-functions @@ -135,12 +135,19 @@ trap cleanup EXIT #repo_lock [timeout] repo_lock () { local LOCKDIR="$TMPDIR/.repolock.$1.$2" + local LOCKFILE="${FTP_BASE}/${1}/os/${2}/${1}${DBEXT}.lck" local _count local _trial local _timeout local _lockblock local _owner + # This is the lock file used by repo-add and repo-remove + if [ -f "${LOCKFILE}" ]; then + error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat $LOCKFILE)" + return 1 + fi + if [ $# -eq 2 ]; then _lockblock=true _trial=0 -- cgit v1.2.3-54-g00ecf