[lxc-devel] [PATCH] lxc-plamo: various small changes

Stéphane Graber stgraber at ubuntu.com
Fri Feb 7 14:47:25 UTC 2014


On Fri, Feb 07, 2014 at 08:28:28AM -0600, Serge Hallyn wrote:
> Quoting TAMUKI Shoichi (tamuki at linet.gr.jp):
> > - Change redirection of fd 200 to 9
> 
> Why?

I can't remember the details but this was done a while back for all
templates as fd 200 was somehow failing on some platform/shell/distro
(as I said, can't remember the details).

> 
> > - Fix to fit with change of init script
> > - Change option order (trivial)
> > 
> > Signed-off-by: TAMUKI Shoichi <tamuki at linet.gr.jp>
> > ---
> >  templates/lxc-plamo.in | 24 ++++++++++++------------
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/templates/lxc-plamo.in b/templates/lxc-plamo.in
> > index 1db5645..8fd5a09 100644
> > --- a/templates/lxc-plamo.in
> > +++ b/templates/lxc-plamo.in
> > @@ -112,7 +112,7 @@ copy_plamo() {
> >  install_plamo() {
> >    mkdir -p @LOCALSTATEDIR@/lock/subsys
> >    (
> > -    if ! flock -n 200 ; then
> > +    if ! flock -n 9 ; then
> >        echo "Cache repository is busy."
> >        return 1
> >      fi
> > @@ -143,7 +143,7 @@ install_plamo() {
> >        return 1
> >      fi
> >      return 0
> > -  ) 200> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
> > +  ) 9> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
> >  }
> >  
> >  configure_plamo() {
> > @@ -215,7 +215,7 @@ configure_plamo() {
> >  	EOF
> >    # /etc/rc.d/rc.M
> >    ed - $rootfs/etc/rc.d/rc.M <<- "EOF"
> > -	269,270d
> > +	280,281d
> 
> This seems needlessly fragile.  Would you be able to influence
> upstream to give you a better way to do this?  Worst case, some
> markers in comments so you could at least do
> 
> 	/MARK1/,/MARK2/d
> 
> or, far better, have rc.M look through /proc/1/environ for
> 'container=lxc' so that you don't have to do t his at all.
> 
> >  	56,82d
> >  	31,38d
> >  	w
> > @@ -285,7 +285,7 @@ cleanup() {
> >    [ -d $dlcache -a -d $rtcache ] || return 0
> >    # lock, so we won't purge while someone is creating a repository
> >    (
> > -    if ! flock -n 200 ; then
> > +    if ! flock -n 9 ; then
> >        echo "Cache repository is busy."
> >        return 1
> >      fi
> > @@ -293,17 +293,17 @@ cleanup() {
> >      rm -rf --one-file-system $dlcache $rtcache || return 1
> >      echo "Done."
> >      return 0
> > -  ) 200> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
> > +  ) 9> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
> >  }
> >  
> >  usage() {
> >    cat <<- EOF
> >  	$prog [-h|--help] -p|--path=<path> -n|--name=<name> --rootfs=<rootfs>
> > -	          [--clean] [-r|--release=<release>] [-b|--bindhome=<user>]
> > -	          [-a|--arch=<arch>]
> > +	          [--clean] [-r|--release=<release>] [-a|--arch=<arch>]
> > +	          [-b|--bindhome=<user>]
> 
> This is just churn...  as is the rest of this.  It may be trivial,
> but if you ever might have other parties contributing, you'll be
> causing them heartache as they have to keep manually rebasing their
> patches.
> 
> >  	release: $release
> > -	bindhome: bind <user>'s home into the container
> >  	arch: x86 or x86_64: defaults to host arch
> > +	bindhome: bind <user>'s home into the container
> >  	EOF
> >  }
> >  
> > @@ -311,10 +311,10 @@ prog=`basename $0`
> >  path="" ; name="" ; rootfs=""
> >  clean=0
> >  release=${release:-5.x}
> > -bindhome=""
> >  arch=`uname -m | sed 's/i.86/x86/'` ; hostarch=$arch
> > -sopts=hp:n:cr:b:a:
> > -lopts=help,path:,name:,rootfs:,clean,release:,bindhome:,arch:
> > +bindhome=""
> > +sopts=hp:n:cr:a:b:
> > +lopts=help,path:,name:,rootfs:,clean,release:,arch:,bindhome:
> >  if ! options=`getopt -o $sopts -l $lopts -- "$@"` ; then
> >    usage
> >    exit 1
> > @@ -328,8 +328,8 @@ while true ; do
> >    --rootfs) rootfs=$2 ; shift 2 ;;
> >    -c|--clean) clean=1 ; shift 1 ;;
> >    -r|--release) release=$2 ; shift 2 ;;
> > -  -b|--bindhome) bindhome=$2 ; shift 2 ;;
> >    -a|--arch) arch=$2 ; shift 2 ;;
> > +  -b|--bindhome) bindhome=$2 ; shift 2 ;;
> >    --) shift 1 ; break ;;
> >    *) break ;;
> >    esac
> > -- 
> > 1.8.4.4
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140207/afea3b93/attachment.pgp>


More information about the lxc-devel mailing list