[Lxc-users] lxc-ubuntu: Base arch detection code on debootstrap's with some additions when we don't have dpkg or udpkg
Stéphane Graber
stgraber at ubuntu.com
Thu Jun 23 17:36:24 UTC 2011
On Thu, 2011-06-23 at 11:19 -0500, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> >
> > Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> > ---
> > templates/lxc-ubuntu.in | 24 ++++++++++++++++++------
> > 1 files changed, 18 insertions(+), 6 deletions(-)
> >
> > diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
> > index 2a20c7d..4f75336 100644
> > --- a/templates/lxc-ubuntu.in
> > +++ b/templates/lxc-ubuntu.in
> > @@ -391,15 +391,27 @@ eval set -- "$options"
> >
> > release=lucid
> > bindhome=
> > -arch=$(arch)
> > -trim_container=0
> > -if [ "$arch" == "x86_64" ]; then arch=amd64
> > -fi
> >
> > -if [ "$arch" == "i386" ]; then
> > - arch=i686
> > +# Code taken from debootstrap
> > +if [ "$arch" != "" ]; then
> > + true
>
> My only objection here is that I don't think we want to support passing
> arch in through the environment. Now that we support passing it in through
> command line, supporting environment as well seems a bit too magic.
>
> What do you think?
>
> The rest looks good, thanks.
Agreed, the initial "if" statement comes from debootstrap's code and
should indeed be dropped. We can already set the value with --arch/-a.
>
> > +elif [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then
> > + arch=`/usr/bin/dpkg --print-architecture`
> > +elif type udpkg >/dev/null 2>&1 && udpkg --print-architecture >/dev/null 2>&1; then
> > + arch=`/usr/bin/udpkg --print-architecture`
> > +else
> > + arch=$(arch)
> > + if [ "$arch" = "i686" ]; then
> > + arch="i386"
> > + elif [ "$arch" = "x86_64" ]; then
> > + arch="amd64"
> > + elif [ "$arch" = "armv7l" ]; then
> > + arch="armel"
> > + fi
> > fi
> >
> > +trim_container=0
> > +
> > hostarch=$arch
> > while true
> > do
> > --
> > 1.7.5.4
> >
> >
> > ------------------------------------------------------------------------------
> > Simplify data backup and recovery for your virtual environment with vRanger.
> > Installation's a snap, and flexible recovery options mean your data is safe,
> > secure and there when you need it. Data protection magic?
> > Nope - It's vRanger. Get your free trial download today.
> > http://p.sf.net/sfu/quest-sfdev2dev
> > _______________________________________________
> > Lxc-users mailing list
> > Lxc-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/lxc-users
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110623/a139e01c/attachment.pgp>
More information about the lxc-users
mailing list