Commit 5d58fc90 by Po-Hsu Lin

templates: add squashfs support to lxc-ubuntu-cloud.in

Add squashfs format file support for lxc-ubuntu-cloud.in Signed-off-by: 's avatarPo-Hsu Lin <po-hsu.lin@canonical.com>
parent 7a8082f4
...@@ -297,7 +297,11 @@ else ...@@ -297,7 +297,11 @@ else
[ "$stream" = "daily" ] || echo "You may try with '--stream=daily'" [ "$stream" = "daily" ] || echo "You may try with '--stream=daily'"
exit 1 exit 1
fi fi
url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/' -e 's/.tar.gz/.tar.xz/'` if [ "$release" = "precise" ] || [ "$release" = "trusty" ]; then
url2=`echo $url1 | sed -e 's/.tar.gz/-root\0/' -e 's/.tar.gz/.tar.xz/'`
else
url2=`echo $url1 | sed -e 's/.tar.gz/.squashfs/'`
fi
fi fi
filename=`basename $url2` filename=`basename $url2`
...@@ -327,11 +331,15 @@ do_extract_rootfs() { ...@@ -327,11 +331,15 @@ do_extract_rootfs() {
echo "Extracting container rootfs" echo "Extracting container rootfs"
mkdir -p $rootfs mkdir -p $rootfs
cd $rootfs cd $rootfs
if [ $in_userns -eq 1 ]; then if [ "${filename##*.}" = "squashfs" ]; then
tar --anchored --exclude="dev/*" --numeric-owner -xpf "$cache/$filename" unsquashfs -n -f -d "$rootfs" "$cache/$filename"
mkdir -p $rootfs/dev/pts/
else else
tar --numeric-owner -xpf "$cache/$filename" if [ $in_userns -eq 1 ]; then
tar --anchored --exclude="dev/*" --numeric-owner -xpf "$cache/$filename"
mkdir -p $rootfs/dev/pts/
else
tar --numeric-owner -xpf "$cache/$filename"
fi
fi fi
} }
......
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