[lxc-devel] [lxc/master] templates: add squashfs support to lxc-ubuntu-cloud.in
Cypresslin on Github
lxc-bot at linuxcontainers.org
Thu Nov 10 08:51:13 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 429 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161110/4461aae1/attachment.bin>
-------------- next part --------------
From 5d58fc90a675dccb34d6f26cb62c56b58900fe55 Mon Sep 17 00:00:00 2001
From: Po-Hsu Lin <po-hsu.lin at canonical.com>
Date: Thu, 10 Nov 2016 16:48:29 +0800
Subject: [PATCH] templates: add squashfs support to lxc-ubuntu-cloud.in
Add squashfs format file support for lxc-ubuntu-cloud.in
Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
templates/lxc-ubuntu-cloud.in | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
index 58642a9..763b15e 100644
--- a/templates/lxc-ubuntu-cloud.in
+++ b/templates/lxc-ubuntu-cloud.in
@@ -297,7 +297,11 @@ else
[ "$stream" = "daily" ] || echo "You may try with '--stream=daily'"
exit 1
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
filename=`basename $url2`
@@ -327,11 +331,15 @@ do_extract_rootfs() {
echo "Extracting container rootfs"
mkdir -p $rootfs
cd $rootfs
- if [ $in_userns -eq 1 ]; then
- tar --anchored --exclude="dev/*" --numeric-owner -xpf "$cache/$filename"
- mkdir -p $rootfs/dev/pts/
+ if [ "${filename##*.}" = "squashfs" ]; then
+ unsquashfs -n -f -d "$rootfs" "$cache/$filename"
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
}
More information about the lxc-devel
mailing list