]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ubuntu-cloud: Replace .tar.gz by .tar.xz and don't auto-generate missing tarballs
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 14 Oct 2015 02:07:04 +0000 (19:07 -0700)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 6 Nov 2015 19:53:30 +0000 (14:53 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
templates/lxc-ubuntu-cloud.in

index 551537067741cbf83b5fcde1b88c584645741b21..9b5da6d867467a38242ff4899f395bbcbf509fa9 100644 (file)
@@ -299,7 +299,7 @@ else
         [ "$stream" = "daily" ] || echo "You may try with '--stream=daily'"
         exit
     fi
-    url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/'`
+    url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/' -e 's/.tar.gz/.tar.xz/'`
 fi
 
 filename=`basename $url2`
@@ -309,44 +309,6 @@ wgetcleanup()
     rm -f $filename
 }
 
-buildcleanup()
-{
-    cd $rootfs
-    umount -l $cache/$xdir || true
-    rm -rf $cache
-}
-
-# if the release doesn't have a *-rootfs.tar.gz, then create one from the
-# cloudimg.tar.gz by extracting the .img, mounting it loopback, and creating
-# a tarball from the mounted image.
-build_root_tgz()
-{
-    url=$1
-    filename=$2
-
-    xdir=`mktemp -d -p .`
-    tarname=`basename $url`
-    imgname="$release-*-cloudimg-$arch.img"
-    trap buildcleanup EXIT SIGHUP SIGINT SIGTERM
-    if [ $flushcache -eq 1 -o ! -f $cache/$tarname ]; then
-        rm -f $tarname
-        echo "Downloading cloud image from $url"
-        wget $url || { echo "Couldn't find cloud image $url."; exit 1; }
-    fi
-    echo "Creating new cached cloud image rootfs"
-    tar --wildcards -zxf "$tarname" "$imgname"
-    mount -o loop $imgname $xdir
-    (cd $xdir; tar --numeric-owner -cpzf "../$filename" .)
-    umount $xdir
-    rm -f $tarname $imgname
-    rmdir $xdir
-    echo "New cloud image cache created"
-    trap EXIT
-    trap SIGHUP
-    trap SIGINT
-    trap SIGTERM
-}
-
 do_extract_rootfs() {
 
     cd $cache
@@ -357,7 +319,7 @@ do_extract_rootfs() {
 
     trap wgetcleanup EXIT SIGHUP SIGINT SIGTERM
     if [ ! -f $filename ]; then
-        wget $url2 || build_root_tgz $url1 $filename
+        wget $url2
     fi
     trap EXIT
     trap SIGHUP
@@ -368,10 +330,10 @@ do_extract_rootfs() {
     mkdir -p $rootfs
     cd $rootfs
     if [ $in_userns -eq 1 ]; then
-        tar --anchored --exclude="dev/*" --numeric-owner -xpzf "$cache/$filename"
+        tar --anchored --exclude="dev/*" --numeric-owner -xpJf "$cache/$filename"
         mkdir -p $rootfs/dev/pts/
     else
-        tar --numeric-owner -xpzf "$cache/$filename"
+        tar --numeric-owner -xpJf "$cache/$filename"
     fi
 }