templates: don't fail on busy flock

Just wait until the lock is available.  That is a nicer behavior
for concurrent lxc-creates.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Serge Hallyn 2012-07-31 16:07:18 +02:00 committed by Daniel Lezcano
parent e7f0d73311
commit add1d11833
7 changed files with 12 additions and 12 deletions

View File

@ -198,7 +198,7 @@ install_altlinux()
{
mkdir -p /var/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
@ -314,7 +314,7 @@ clean()
# lock, so we won't purge while someone is creating a repository
(
flock -n -x 200
flock -x 200
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1

View File

@ -153,7 +153,7 @@ install_debian()
rootfs=$1
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
@ -234,7 +234,7 @@ clean()
# lock, so we won't purge while someone is creating a repository
(
flock -n -x 200
flock -x 200
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1

View File

@ -190,7 +190,7 @@ install_fedora()
{
mkdir -p /var/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
@ -284,7 +284,7 @@ clean()
# lock, so we won't purge while someone is creating a repository
(
flock -n -x 200
flock -x 200
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1

View File

@ -142,7 +142,7 @@ install_debian()
rootfs=$1
mkdir -p @LOCALSTATEDIR@/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
@ -222,7 +222,7 @@ clean()
# lock, so we won't purge while someone is creating a repository
(
flock -n -x 200
flock -x 200
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1

View File

@ -217,7 +217,7 @@ install_opensuse()
rootfs=$1
mkdir -p /var/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1
@ -303,7 +303,7 @@ clean()
# lock, so we won't purge while someone is creating a repository
(
flock -n -x 200
flock -x 200
if [ $? != 0 ]; then
echo "Cache repository is busy."
exit 1

View File

@ -290,7 +290,7 @@ build_root_tgz()
mkdir -p /var/lock/subsys/
(
flock -n -x 200
flock -x 200
cd $cache
if [ $flushcache -eq 1 ]; then

View File

@ -228,7 +228,7 @@ install_ubuntu()
mkdir -p /var/lock/subsys/
(
flock -n -x 200
flock -x 200
if [ $? -ne 0 ]; then
echo "Cache repository is busy."
return 1