On 12/31/2012 02:49 PM, Natanael Copa wrote: > This allows us to lxc-create 32 bit guests on x86_64 hosts. > > Signed-off-by: Natanael Copa <nc...@alpinelinux.org>
Comment below, though good enough. Pushed. Acked-by: Stéphane Graber <stgra...@ubuntu.com> > --- > templates/lxc-alpine.in | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > > diff --git a/templates/lxc-alpine.in b/templates/lxc-alpine.in > index 87886f5..5b685b1 100644 > --- a/templates/lxc-alpine.in > +++ b/templates/lxc-alpine.in > @@ -9,7 +9,11 @@ install_alpine() { > else > cp /etc/apk/repositories "$rootfs"/etc/apk/repositories || return 1 > fi > - ${APK:-apk} add -U --initdb --root $rootfs alpine-base > + opt_arch= > + if [ -n "$apk_arch" ]; then > + opt_arch="--arch $apk_arch" > + fi > + ${APK:-apk} add -U --initdb --root $rootfs $opt_arch alpine-base > } > > configure_alpine() { > @@ -68,6 +72,9 @@ copy_configuration() { > > grep -q "^lxc.rootfs" $path/config 2>/dev/null \ > || echo "lxc.rootfs = $rootfs" >> $path/config > + if [ -n "$lxc_arch" ]; then > + echo "lxc.arch = $lxc_arch" >> $path/config > + fi That bit is actually a bit wrong, although consistent with other templates and not actually a problem as lxc won't fail on invalid value. lxc.arch is meant to be the arch personality, as such only four values are valid: { "x86", PER_LINUX32 }, { "i686", PER_LINUX32 }, { "x86_64", PER_LINUX }, { "amd64", PER_LINUX }, It's likely that the introduction of arm64 will require the addition of a pair for that architecture too, but at the moment, allowing lxc.arch to be set to anything but one of those 4 values will cause lxc to ignore the option completely. > cat <<EOF >> $path/config > lxc.tty = 4 > lxc.pts = 1024 > @@ -120,7 +127,7 @@ die() { > > usage() { > cat >&2 <<EOF > -Usage: $(basename $0) [-h|--help] [-r|--repository <url>] > +Usage: $(basename $0) [-h|--help] [-r|--repository <url>] [-a|--arch <arch>] > -p|--path <path> -n|--name <name> > EOF > } > @@ -161,6 +168,11 @@ while [ $# -gt 0 ]; do > repository=$1 > shift > ;; > + -a|--arch) > + optarg_check $opt "$1" > + arch=$1 > + shift > + ;; > --) > break;; > --*=*) > @@ -193,6 +205,18 @@ if [ -z "$rootfs" ]; then > rootfs="${path}/rootfs" > fi > > +lxc_arch=$arch > +apk_arch=$arch > + > +case "$arch" in > + i[3-6]86) > + apk_arch=x86;; > + x86) > + lxc_arch=i686;; > + x86_64|"") ;; > + *) die "unsupported architecture: $arch";; > +esac > + > install_alpine "$rootfs" || die "Failed to install rootfs for $name" > configure_alpine "$rootfs" "$name" || die "Failed to configure $name" > copy_configuration "$path" "$rootfs" "$name" > -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and much more. Keep your Java skills current with LearnJavaNow - 200+ hours of step-by-step video tutorials by Java experts. SALE $49.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122612
_______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel