]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
templates: Consistent use of locking
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 5 Dec 2012 23:51:09 +0000 (18:51 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 6 Dec 2012 14:43:29 +0000 (09:43 -0500)
Move to per-template lock (except for oracle that's per-container).
Also ensure that the path used for the lock is relative to LOCALSTATEDIR.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
templates/lxc-altlinux.in
templates/lxc-debian.in
templates/lxc-fedora.in
templates/lxc-lenny.in
templates/lxc-opensuse.in
templates/lxc-oracle.in
templates/lxc-ubuntu-cloud.in
templates/lxc-ubuntu.in

index eab473c2647cfd02b42b569635dc5dcb9f6494c0..fac545cc32c076a0a2717ad19842e98ac54dfdcd 100644 (file)
@@ -228,7 +228,7 @@ install_altlinux()
             return 1
         fi
         return 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
 
     return $?
 }
@@ -325,7 +325,7 @@ clean()
         echo -n "Purging the download cache for ALTLinux-$release..."
         rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
         exit 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-altlinux
 }
 
 usage()
index 6b5f2f95e106b5de4e6e0766b1f0286c42f05123..7bbc46b94103a3a87df91db9d289b9a240186dfc 100644 (file)
@@ -191,7 +191,7 @@ install_debian()
 
         return 0
 
-        ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+        ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
 
     return $?
 }
@@ -261,7 +261,7 @@ clean()
         rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
         exit 0
 
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-debian
 }
 
 usage()
index bc4b264a7cdba21345a446e52de8a57ce5b44afe..366e776c1fa0d020a3bda89f3bf3ef17e8cf288b 100644 (file)
@@ -233,7 +233,7 @@ install_fedora()
         fi
 
         return 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-fedora
 
     return $?
 }
@@ -301,7 +301,7 @@ clean()
         echo -n "Purging the download cache for Fedora-$release..."
         rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
         exit 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-fedora
 }
 
 usage()
index afc93214cd63535d33aba3390f631a905bd9d835..cb938536c6ce1989d47f71f27d42c465cf289495 100644 (file)
@@ -166,7 +166,7 @@ install_debian()
             return 1
         fi
         return 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-lenny
 
     return $?
 }
@@ -234,7 +234,7 @@ clean()
         echo -n "Purging the download cache..."
         rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
         exit 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-lenny
 }
 
 usage()
index e0f8e0091061ec2cc0985385ed0c7f9eeee726c1..65fb7b0f845baab181cc6efd01d64d7dedc19e9c 100644 (file)
@@ -242,7 +242,7 @@ install_opensuse()
         fi
 
         return 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
 
     return $?
 }
@@ -314,7 +314,7 @@ clean()
         echo -n "Purging the download cache..."
         rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
         exit 0
-    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-opensuse
 }
 
 usage()
index 243f0e490f3c2e636d2fc67b98cae569f1f24806..f3252820a94d2f2d5be6306f26a21dc8e482f020 100644 (file)
@@ -337,7 +337,7 @@ container_rootfs_create()
         fi
     done
 
-    mkdir -p /var/lock/subsys/
+    mkdir -p @LOCALSTATEDIR@/lock/subsys/lxc
     (
         flock -x 200
         if [ $? -ne 0 ]; then
@@ -433,7 +433,7 @@ container_rootfs_create()
         echo "Rebuilding rpm database"
         rm -f $container_rootfs/var/lib/rpm/__db*
         chroot $container_rootfs rpm --rebuilddb >/dev/null 2>&1
-    ) 200>/var/lock/subsys/lxc-oracle-$name
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-oracle-$name
 }
 
 usage()
index 4ef5f8de501cf2bf0b96fa930c116e3c9173cac1..de9f3c31dcd85701a79161a4a5063b9b7c82502a 100644 (file)
@@ -395,7 +395,7 @@ EOF
         echo "If you do not have a meta-data service, this container will likely be useless."
 
     fi
-) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubucloud
+) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubuntu-cloud
 
 copy_configuration $path $rootfs $name $arch $release
 
index 19de99139f65277937948e332cbf7f0a0177221d..0ed8808c76167ca98d21cbee3db943c874666e43 100644 (file)
@@ -259,7 +259,7 @@ install_ubuntu()
     release=$2
     flushcache=$3
     cache="@LOCALSTATEDIR@/cache/lxc/$release"
-    mkdir -p /var/lock/subsys/
+    mkdir -p @LOCALSTATEDIR@/lock/subsys/
 
     (
         flock -x 200
@@ -293,7 +293,7 @@ install_ubuntu()
 
         return 0
 
-    ) 200>/var/lock/subsys/lxc
+    ) 200>@LOCALSTATEDIR@/lock/subsys/lxc-ubuntu
 
     return $?
 }