diff options
author | 2012-03-28 19:34:46 +0000 | |
---|---|---|
committer | 2012-03-28 19:34:46 +0000 | |
commit | cdb2780af3af24a8da7405c999db7a6cb53947a4 (patch) | |
tree | 3c59d066f2a2a8282c2ccc718c416c6aa0751538 | |
parent | add $ROOT support #389243 by Zdenek Behan (diff) | |
download | build-docbook-catalog-cdb2780af3af24a8da7405c999db7a6cb53947a4.tar.gz build-docbook-catalog-cdb2780af3af24a8da7405c999db7a6cb53947a4.tar.bz2 build-docbook-catalog-cdb2780af3af24a8da7405c999db7a6cb53947a4.zip |
add locking to /etc/xml dir to avoid multiple runs trashing each otherv1.19
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-x | build-docbook-catalog | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/build-docbook-catalog b/build-docbook-catalog index 0c8a193..21054fb 100755 --- a/build-docbook-catalog +++ b/build-docbook-catalog @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.18 2012/03/28 19:27:46 vapier Exp $ +# $Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.19 2012/03/28 19:34:46 vapier Exp $ # # build-docbook-catalog: populate /etc/xml/docbook based in # installed docbook-xml-dtd versions. @@ -61,6 +61,15 @@ main() { echo "Working on root ${ROOT}" fi + if [[ ! -d ${ROOT}${ROOTCONFDIR} ]] ; then + mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}" + fi + + ( + # Lock the dir to avoid trashing other runs that might + # be running parallel. + flock 123 || error "unable to lock ${ROOTCONFDIR}" + create_catalogs # will exit on error for type in xsl xsl-ns xsl-saxon xsl-xalan; do populate_xsl ${type} @@ -81,6 +90,8 @@ main() { populate_entities fi + ) 123>"${ROOT}${ROOTCONFDIR}/.keep" + exit 0 } @@ -142,10 +153,6 @@ multi_xmlcatalog_add() { create_catalogs() { local adds - if [[ ! -d ${ROOT}${ROOTCONFDIR} ]] ; then - mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}" - fi - if [[ ! -r ${ROOT}${ROOTCATALOG} ]] ; then echo "Creating XML Catalog root ${ROOTCATALOG}" xmlcatalog --noout --create "${ROOT}${ROOTCATALOG}" |