[lxc-devel] [PATCH] support a custom CentOS repository

Michael H. Warfield mhw at WittsEnd.com
Tue Feb 4 03:45:48 UTC 2014


On Mon, 2014-02-03 at 19:18 -0600, Serge Hallyn wrote: 
> Quoting Harald Dunkel (harri at afaics.de):
> > This change introduces a flag --repo to the lxc-centos template
> > to allow using a local repository (e.g. a loop mounted installer
> > iso on your web server).
> > 
> > Signed-off-by: Harald Dunkel <harri at afaics.de>

> It looks fine to me, but I'm not quite sure whether users ordinarily
> would want such a repo to be an additional repo or a replacement for
> the centos one.  Michael, does this look good to you?

I saw it when it was posted and I've been giving it some thought,
especially in the light of what Dwight and I were discussing over extra
packages and caching (the former of which Oracle does and the later of
which it doesn't).  I've been giving some serious thought along those
lines of how you would provide for caching and additional packages in
combination in a way they don't trip over each other and this has that
glimmer.  It could be especially helpful in combination with an
additional packages option.

When used with something like pkgcacher or some other local networking
package caching mechanism, it answers a question of dealing with
multiple caches for multiple hosts.  I know pkgcacher came out of the
aptget / .deb world but I've used it reasonably well well with yum and
rpm.  The idea of specifying a local repository AND caching the
repository packages and not just constructed container cache is very
attractive.

I see no downside this (and may even add it to the Fedora template) and
it may lead to some other ideas.

Acked-by: Michael H. Warfield <mhw at WittsEnd.com>

Regards,
Mike

> > ---
> >  templates/lxc-centos.in | 14 ++++++++++++--
> >  1 file changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in
> > index 2f0c796..f5f6e53 100644
> > --- a/templates/lxc-centos.in
> > +++ b/templates/lxc-centos.in
> > @@ -364,7 +364,14 @@ download_centos()
> >      # use temporary repository definition
> >      REPO_FILE=$INSTALL_ROOT/etc/yum.repos.d/lxc-centos-temp.repo
> >      mkdir -p $(dirname $REPO_FILE)
> > -    cat <<EOF > $REPO_FILE
> > +    if [ -n "$repo" ]; then
> > +	cat <<EOF > $REPO_FILE
> > +[base]
> > +name=local repository
> > +baseurl="$repo"
> > +EOF
> > +else
> > +	cat <<EOF > $REPO_FILE
> >  [base]
> >  name=CentOS-$release - Base
> >  mirrorlist=http://mirrorlist.centos.org/?release=$release&arch=$basearch&repo=os
> > @@ -373,6 +380,7 @@ mirrorlist=http://mirrorlist.centos.org/?release=$release&arch=$basearch&repo=os
> >  name=CentOS-$release - Updates
> >  mirrorlist=http://mirrorlist.centos.org/?release=$release&arch=$basearch&repo=updates
> >  EOF
> > +    fi
> >  
> >      # create minimal device nodes, needed for "yum install" and "yum update" process
> >      mkdir -p $INSTALL_ROOT/dev
> > @@ -615,13 +623,14 @@ Optional args:
> >    -c,--clean        clean the cache
> >    -R,--release      Centos release for the new container. if the host is Centos, then it will defaultto the host's release.
> >       --fqdn         fully qualified domain name (FQDN) for DNS and system naming
> > +     --repo         repository to use (url)
> >    -a,--arch         Define what arch the container will be [i686,x86_64]
> >    -h,--help         print this help
> >  EOF
> >      return 0
> >  }
> >  
> > -options=$(getopt -o a:hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,arch:,fqdn: -- "$@")
> > +options=$(getopt -o a:hp:n:cR: -l help,path:,rootfs:,name:,clean,release:,repo:,arch:,fqdn: -- "$@")
> >  if [ $? -ne 0 ]; then
> >      usage $(basename $0)
> >      exit 1
> > @@ -638,6 +647,7 @@ do
> >          -n|--name)      name=$2; shift 2;;
> >          -c|--clean)     clean=$2; shift 2;;
> >          -R|--release)   release=$2; shift 2;;
> > +	--repo)		repo="$2"; shift 2;;
> >          -a|--arch)      newarch=$2; shift 2;;
> >          --fqdn)         utsname=$2; shift 2;;
> >          --)             shift 1; break ;;
> > -- 
> > 1.9.rc0.143.g6fd479e
> > 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> 

-- 
Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140203/c2792c60/attachment.pgp>


More information about the lxc-devel mailing list