Commit add1d118 by Serge Hallyn Committed by Daniel Lezcano

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: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent e7f0d733
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment