more upgrade-friendly
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 11 Apr 2012 22:06:28 +0000 (00:06 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 11 Apr 2012 22:06:28 +0000 (00:06 +0200)
initscripts/lxc-sliceimage

index 5026900..e17f838 100755 (executable)
@@ -19,25 +19,18 @@ function check_node () {
 function start () {
 
     check_node
+    
+    mkdir -p $lxc_dir
 
-    sliceimages=$(cd $sliceimage_dir ; ls )
+    slicefamilies=$(cd $sliceimage_dir ; ls )
 
-    for sliceimage in $sliceimages; do
-       mkdir -p $lxc_dir
-       # already known to lxc - skip it 
-        # xxx we need a smarter way to handle upgrades
-       [ -d $lxc_dir/$sliceimage ] && continue
-       
-       btrfs subvolume create $lxc_dir/$sliceimage
-        # what is that ?
+    for slicefamily in $slicefamilies; do
+       # initialize if needed
+       [ -d $lxc_dir/$slicefamily ] || btrfs subvolume create $lxc_dir/$slicefamily
+        # xxx what is that ?
        #btrfs subvolume create $lxc_dir/lxc-squeeze-x86_64
         # copy the slice image into the btrfs ?
-       tar -C $sliceimage_dir -cf - $sliceimage | tar -C $lxc_dir -xf -
-        # the original code trashed the ref image that came with an rpm
-       #rm -rf /vservers/lxc-reference-${VERSION}.tgz
-        # this would probably cause the image to be re-created upon yum update
-        # or prevent updates to make it to the node ?
-       #rm -rf $sliceimage_dir/$sliceimage
+       rsync -av $sliceimage_dir/$slicefamily/ $lxc_dir/$slicefamily/
     done
 }