mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 19:10:17 +00:00
lxc-ubuntu-cloud: various small changes
* ppc64el images now exist and generally function. Instead of failing because an arch isnt in the list, let that check happen by ability to download something. * update the hard coded ubuntu releases to know about 'trusty' and drop no longer supported releases (consistent with behavior when distro-info is available) * shorten the logic that decides if host and container arch are supported. * support skipping "invalid arch" check entirely via undocumented variable UCTEMPLATE_SKIP_ARCH_CHECK. * update usage to reference 'tryreleased' as the default 'stream' * give good error message if user tries 'released' and there is no released version available. Signed-off-by: Scott Moser <smoser@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
6ee257941c
commit
ad3f14ab58
@ -25,6 +25,8 @@ STATE_DIR="@LOCALSTATEDIR@"
|
|||||||
HOOK_DIR="@LXCHOOKDIR@"
|
HOOK_DIR="@LXCHOOKDIR@"
|
||||||
CLONE_HOOK_FN="$HOOK_DIR/ubuntu-cloud-prep"
|
CLONE_HOOK_FN="$HOOK_DIR/ubuntu-cloud-prep"
|
||||||
LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@"
|
LXC_TEMPLATE_CONFIG="@LXCTEMPLATECONFIG@"
|
||||||
|
KNOWN_RELEASES="lucid precise quantal saucy trusty"
|
||||||
|
skip_arch_check=${UCTEMPLATE_SKIP_ARCH_CHECK:-0}
|
||||||
|
|
||||||
if [ -r /etc/default/lxc ]; then
|
if [ -r /etc/default/lxc ]; then
|
||||||
. /etc/default/lxc
|
. /etc/default/lxc
|
||||||
@ -136,7 +138,7 @@ Generic Options
|
|||||||
[ -a | --arch ]: Architecture of container, defaults to host architecture
|
[ -a | --arch ]: Architecture of container, defaults to host architecture
|
||||||
[ -T | --tarball ]: Location of tarball
|
[ -T | --tarball ]: Location of tarball
|
||||||
[ -d | --debug ]: Run with 'set -x' to debug errors
|
[ -d | --debug ]: Run with 'set -x' to debug errors
|
||||||
[ -s | --stream]: Use specified stream rather than 'released'
|
[ -s | --stream]: Use specified stream rather than 'tryreleased'
|
||||||
|
|
||||||
Additionally, clone hooks can be passed through (ie, --userdata). For those,
|
Additionally, clone hooks can be passed through (ie, --userdata). For those,
|
||||||
see:
|
see:
|
||||||
@ -158,7 +160,7 @@ release=precise
|
|||||||
if [ -f /etc/lsb-release ]; then
|
if [ -f /etc/lsb-release ]; then
|
||||||
. /etc/lsb-release
|
. /etc/lsb-release
|
||||||
rels=$(ubuntu-distro-info --supported 2>/dev/null) ||
|
rels=$(ubuntu-distro-info --supported 2>/dev/null) ||
|
||||||
rels="lucid natty oneiric precise quantal raring saucy"
|
rels="$KNOWN_RELEASES"
|
||||||
for r in $rels; do
|
for r in $rels; do
|
||||||
[ "$DISTRIB_CODENAME" = "$r" ] && release="$r"
|
[ "$DISTRIB_CODENAME" = "$r" ] && release="$r"
|
||||||
done
|
done
|
||||||
@ -230,35 +232,13 @@ if [ "$arch" = "i686" ]; then
|
|||||||
arch=i386
|
arch=i386
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $arch != "i386" -a $arch != "amd64" -a $arch != "armhf" -a $arch != "armel" -a $arch != "arm64" -a $arch != "ppc64el" ]; then
|
if [ "$skip_arch_check" = "0" ]; then
|
||||||
echo "Only i386, amd64, armel and armhf are supported by the ubuntu cloud template."
|
case "$hostarch:$arch" in
|
||||||
exit 1
|
$arch:$arch) : ;; # the host == container
|
||||||
fi
|
amd64:i386|arm*:arm*) :;; # supported "cross"
|
||||||
|
*) echo "cannot create '$arch' container on hostarch '$hostarch'";
|
||||||
if [ $hostarch != "i386" -a $hostarch != "amd64" -a $hostarch != "armhf" -a $hostarch != "armel" -a $hostarch != "arm64" -a $hostarch != "ppc64el" ]; then
|
exit 1;;
|
||||||
echo "Only i386, amd64, armel and armhf are supported as host."
|
esac
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $hostarch = "armhf" -o $hostarch = "armel" -o $hostarch = "arm64" ] && \
|
|
||||||
[ $arch != "armhf" -a $arch != "armel" -a $arch != "arm64" ]; then
|
|
||||||
echo "can't create $arch container on $hostarch"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $hostarch = "amd64" -a $arch != "amd64" -a $arch != "i386" ]; then
|
|
||||||
echo "can't create $arch container on $hostarch"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $hostarch = "i386" -a $arch != "i386" ]; then
|
|
||||||
echo "can't create $arch container on $hostarch"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $arch = "arm64" ] && [ $hostarch != "arm64" ]; then
|
|
||||||
echo "can't create $arch container on $hostarch"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$stream" != "daily" -a "$stream" != "released" -a "$stream" != "tryreleased" ]; then
|
if [ "$stream" != "daily" -a "$stream" != "released" -a "$stream" != "tryreleased" ]; then
|
||||||
@ -307,7 +287,11 @@ fi
|
|||||||
if [ -n "$tarball" ]; then
|
if [ -n "$tarball" ]; then
|
||||||
url2="$tarball"
|
url2="$tarball"
|
||||||
else
|
else
|
||||||
url1=`ubuntu-cloudimg-query $release $stream $arch --format "%{url}\n"`
|
if ! url1=`ubuntu-cloudimg-query $release $stream $arch --format "%{url}\n"`; then
|
||||||
|
echo "There is no download available for release=$release, stream=$stream, arch=$arch"
|
||||||
|
[ "$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/'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user