From: Thierry Parmentelat Date: Wed, 11 Apr 2012 22:06:28 +0000 (+0200) Subject: more upgrade-friendly X-Git-Tag: sliceimage-5.1-1~4 X-Git-Url: http://git.onelab.eu/?p=sliceimage.git;a=commitdiff_plain;h=02d28af5a0cc9cacfcb3197005d0b3d8cf4dc7ed more upgrade-friendly --- diff --git a/initscripts/lxc-sliceimage b/initscripts/lxc-sliceimage index 5026900..e17f838 100755 --- a/initscripts/lxc-sliceimage +++ b/initscripts/lxc-sliceimage @@ -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 }