2
0
mirror of git://github.com/lxc/lxc synced 2025-08-30 05:42:30 +00:00

Merge pull request #1289 from Cypresslin/ubuntu-cloud-squashfs

templates: add squashfs support to lxc-ubuntu-cloud.in
This commit is contained in:
Christian Brauner 2016-11-10 09:29:23 -05:00 committed by GitHub
commit bedea59739

View File

@ -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
}