Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Dwight Engen
On Mon, 06 Jan 2014 13:03:12 -0500
"Michael H. Warfield"  wrote:

> On Mon, 2014-01-06 at 12:08 -0500, Dwight Engen wrote: 
> > On Mon, 6 Jan 2014 11:25:11 -0500
> > Stéphane Graber  wrote:
> > 
> > > On Mon, Jan 06, 2014 at 11:19:56AM -0500, Dwight Engen wrote:
> > > > On Fri, 3 Jan 2014 15:07:01 -0500
> > > > Stéphane Graber  wrote:
> > > > 
> > > > > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > > > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn
> > > > > > > wrote:
> > > > > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > > > > This change updates the way init scripts get
> > > > > > > > > installed so that more than one init system can be
> > > > > > > > > supported. Instead of installing the systemd service
> > > > > > > > > file from the spec file, it should be installed at
> > > > > > > > > make install time, so that someone compiling from
> > > > > > > > > source also gets the unit file installed.
> > > > > > > > > 
> > > > > > > > > Update the plamo template to use a lock file not named
> > > > > > > > > just /var/lock/subsys/lxc since the presence of that
> > > > > > > > > file is used by sysv init rc file to know if it
> > > > > > > > > should run the K01lxc script. This also makes it
> > > > > > > > > consistent with the other templates which
> > > > > > > > > use /var/lock/subsys/lxc-$template-name.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Dwight Engen 
> > > > > > > > 
> > > > > > > > I have no objection to this, but I'd appreciate Stéphane
> > > > > > > > taking a closer look.  This might lead the way to
> > > > > > > > putting the upstart scripts for ubuntu upstream as
> > > > > > > > well, which would be a plus.  It also can give us more
> > > > > > > > reasonable and comprehensive testcases if we can know
> > > > > > > > that common distros will have a certain amount of setup.
> > > > > > > > 
> > > > > > > > Acked-by: Serge E. Hallyn 
> > > > > > > 
> > > > > > > I don't think the current proposal is appropriate.
> > > > > > > 
> > > > > > > At least in Ubuntu and Debian, we typically want more
> > > > > > > than one init script to be installed. The way things work
> > > > > > > in Debian based distros is that init scripts for all
> > > > > > > supported init daemons are installed and only the
> > > > > > > relevant ones are used at boot time and by the user (with
> > > > > > > the "service" command).
> > > > > > > 
> > > > > > > As a result, I'd expect an LXC package build on Debian or
> > > > > > > Ubuntu to include the upstart jobs, sysvinit script and
> > > > > > > systemd unit in their usual locations.
> > > > > > 
> > > > > > Drat, I just pushed the commit.
> > > > > > 
> > > > > > So having
> > > > > > 
> > > > > > case $with_distro in
> > > > > > ubuntu)
> > > > > > init_script=upstart,systemd,sysv
> > > > > > ;;
> > > > > > 
> > > > > > and the rest geared to support that, could work here?
> > > > > 
> > > > > And the same for debian) but yes, that'd be fine I think.
> > > > > 
> > > > > I'm also wondering whether non-Debian distros actually have a
> > > > > problem should they all be installed at once, if not, then
> > > > > maybe we can do without the whole --init-script thing and
> > > > > always have them all installed?
> > > > 
> > > > Yeah, Fedora packaging guidelines [1], [2] want either sysv or
> > > > systemd, but not both ("Packagers MUST NOT include SysV
> > > > initscripts in addition to systemd unit files, even in a
> > > > separate $name-sysvinit subpackage as there are corner cases
> > > > where the initscripts can override the systemd unit files.").
> > > > So that is why I had only one of them being installed. I can
> > > > see that it makes sense to install multiple if the distro
> > > > supports it.
> > > > 
> > > > As far as the sysv initscript I provided running on multiple
> > > > distros: It is pretty simple and I tried to make it generic, it
> > > > has both chkconfig and LSB headers. I will admit that I did
> > > > only test it on OracleLinux.
> > > > 
> > > > [1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
> > > > [2] https://fedoraproject.org/wiki/Packaging:Systemd
> > > 
> > > Weird policy but fair enough, can you then add support for a comma
> > > separated list of init systems that Debian, Ubuntu and any similar
> > > distro could use?
> 
> > Sure, I can look into that. I think part of this is because systemd
> > has some compatibility with sysv init scripts, so if you had both
> > installed maybe it would start the service twice? Not sure how
> > upstart handles that since I thought it had sysv init script
> > compatibility too?
> 
> It shouldn't start the service twice.  If the systemd unit file
> exists, it should take precedence and not fall back to the sysv init
> scripts. From reading, it sounds like there may be some unpredictable
> corner cases.  Giving the complexity of systemd, this does not
> s

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Michael H. Warfield
On Mon, 2014-01-06 at 12:08 -0500, Dwight Engen wrote: 
> On Mon, 6 Jan 2014 11:25:11 -0500
> Stéphane Graber  wrote:
> 
> > On Mon, Jan 06, 2014 at 11:19:56AM -0500, Dwight Engen wrote:
> > > On Fri, 3 Jan 2014 15:07:01 -0500
> > > Stéphane Graber  wrote:
> > > 
> > > > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > > > This change updates the way init scripts get installed so
> > > > > > > > that more than one init system can be supported. Instead
> > > > > > > > of installing the systemd service file from the spec
> > > > > > > > file, it should be installed at make install time, so
> > > > > > > > that someone compiling from source also gets the unit
> > > > > > > > file installed.
> > > > > > > > 
> > > > > > > > Update the plamo template to use a lock file not named
> > > > > > > > just /var/lock/subsys/lxc since the presence of that file
> > > > > > > > is used by sysv init rc file to know if it should run the
> > > > > > > > K01lxc script. This also makes it consistent with the
> > > > > > > > other templates which
> > > > > > > > use /var/lock/subsys/lxc-$template-name.
> > > > > > > > 
> > > > > > > > Signed-off-by: Dwight Engen 
> > > > > > > 
> > > > > > > I have no objection to this, but I'd appreciate Stéphane
> > > > > > > taking a closer look.  This might lead the way to putting
> > > > > > > the upstart scripts for ubuntu upstream as well, which
> > > > > > > would be a plus.  It also can give us more reasonable and
> > > > > > > comprehensive testcases if we can know that common distros
> > > > > > > will have a certain amount of setup.
> > > > > > > 
> > > > > > > Acked-by: Serge E. Hallyn 
> > > > > > 
> > > > > > I don't think the current proposal is appropriate.
> > > > > > 
> > > > > > At least in Ubuntu and Debian, we typically want more than one
> > > > > > init script to be installed. The way things work in Debian
> > > > > > based distros is that init scripts for all supported init
> > > > > > daemons are installed and only the relevant ones are used at
> > > > > > boot time and by the user (with the "service" command).
> > > > > > 
> > > > > > As a result, I'd expect an LXC package build on Debian or
> > > > > > Ubuntu to include the upstart jobs, sysvinit script and
> > > > > > systemd unit in their usual locations.
> > > > > 
> > > > > Drat, I just pushed the commit.
> > > > > 
> > > > > So having
> > > > > 
> > > > > case $with_distro in
> > > > >   ubuntu)
> > > > >   init_script=upstart,systemd,sysv
> > > > >   ;;
> > > > > 
> > > > > and the rest geared to support that, could work here?
> > > > 
> > > > And the same for debian) but yes, that'd be fine I think.
> > > > 
> > > > I'm also wondering whether non-Debian distros actually have a
> > > > problem should they all be installed at once, if not, then maybe
> > > > we can do without the whole --init-script thing and always have
> > > > them all installed?
> > > 
> > > Yeah, Fedora packaging guidelines [1], [2] want either sysv or
> > > systemd, but not both ("Packagers MUST NOT include SysV initscripts
> > > in addition to systemd unit files, even in a separate
> > > $name-sysvinit subpackage as there are corner cases where the
> > > initscripts can override the systemd unit files."). So that is why
> > > I had only one of them being installed. I can see that it makes
> > > sense to install multiple if the distro supports it.
> > > 
> > > As far as the sysv initscript I provided running on multiple
> > > distros: It is pretty simple and I tried to make it generic, it has
> > > both chkconfig and LSB headers. I will admit that I did only test
> > > it on OracleLinux.
> > > 
> > > [1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
> > > [2] https://fedoraproject.org/wiki/Packaging:Systemd
> > 
> > Weird policy but fair enough, can you then add support for a comma
> > separated list of init systems that Debian, Ubuntu and any similar
> > distro could use?

> Sure, I can look into that. I think part of this is because systemd has
> some compatibility with sysv init scripts, so if you had both installed
> maybe it would start the service twice? Not sure how upstart handles
> that since I thought it had sysv init script compatibility too?

It shouldn't start the service twice.  If the systemd unit file exists,
it should take precedence and not fall back to the sysv init scripts.
From reading, it sounds like there may be some unpredictable corner
cases.  Giving the complexity of systemd, this does not surprise me
though I'm at a loss to think of any readily.

I'm sure they're buried in some of the inconsistent ways systemd handled
certain services...  One glaring example in my personal experience is
the inconsistent way in which systemd handles IPsec VPN's vs OpenVPN
vpn's.  IPsec is handled

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Stéphane Graber
On Mon, Jan 06, 2014 at 12:08:49PM -0500, Dwight Engen wrote:
> On Mon, 6 Jan 2014 11:25:11 -0500
> Stéphane Graber  wrote:
> 
> > On Mon, Jan 06, 2014 at 11:19:56AM -0500, Dwight Engen wrote:
> > > On Fri, 3 Jan 2014 15:07:01 -0500
> > > Stéphane Graber  wrote:
> > > 
> > > > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > > > This change updates the way init scripts get installed so
> > > > > > > > that more than one init system can be supported. Instead
> > > > > > > > of installing the systemd service file from the spec
> > > > > > > > file, it should be installed at make install time, so
> > > > > > > > that someone compiling from source also gets the unit
> > > > > > > > file installed.
> > > > > > > > 
> > > > > > > > Update the plamo template to use a lock file not named
> > > > > > > > just /var/lock/subsys/lxc since the presence of that file
> > > > > > > > is used by sysv init rc file to know if it should run the
> > > > > > > > K01lxc script. This also makes it consistent with the
> > > > > > > > other templates which
> > > > > > > > use /var/lock/subsys/lxc-$template-name.
> > > > > > > > 
> > > > > > > > Signed-off-by: Dwight Engen 
> > > > > > > 
> > > > > > > I have no objection to this, but I'd appreciate Stéphane
> > > > > > > taking a closer look.  This might lead the way to putting
> > > > > > > the upstart scripts for ubuntu upstream as well, which
> > > > > > > would be a plus.  It also can give us more reasonable and
> > > > > > > comprehensive testcases if we can know that common distros
> > > > > > > will have a certain amount of setup.
> > > > > > > 
> > > > > > > Acked-by: Serge E. Hallyn 
> > > > > > 
> > > > > > I don't think the current proposal is appropriate.
> > > > > > 
> > > > > > At least in Ubuntu and Debian, we typically want more than one
> > > > > > init script to be installed. The way things work in Debian
> > > > > > based distros is that init scripts for all supported init
> > > > > > daemons are installed and only the relevant ones are used at
> > > > > > boot time and by the user (with the "service" command).
> > > > > > 
> > > > > > As a result, I'd expect an LXC package build on Debian or
> > > > > > Ubuntu to include the upstart jobs, sysvinit script and
> > > > > > systemd unit in their usual locations.
> > > > > 
> > > > > Drat, I just pushed the commit.
> > > > > 
> > > > > So having
> > > > > 
> > > > > case $with_distro in
> > > > >   ubuntu)
> > > > >   init_script=upstart,systemd,sysv
> > > > >   ;;
> > > > > 
> > > > > and the rest geared to support that, could work here?
> > > > 
> > > > And the same for debian) but yes, that'd be fine I think.
> > > > 
> > > > I'm also wondering whether non-Debian distros actually have a
> > > > problem should they all be installed at once, if not, then maybe
> > > > we can do without the whole --init-script thing and always have
> > > > them all installed?
> > > 
> > > Yeah, Fedora packaging guidelines [1], [2] want either sysv or
> > > systemd, but not both ("Packagers MUST NOT include SysV initscripts
> > > in addition to systemd unit files, even in a separate
> > > $name-sysvinit subpackage as there are corner cases where the
> > > initscripts can override the systemd unit files."). So that is why
> > > I had only one of them being installed. I can see that it makes
> > > sense to install multiple if the distro supports it.
> > > 
> > > As far as the sysv initscript I provided running on multiple
> > > distros: It is pretty simple and I tried to make it generic, it has
> > > both chkconfig and LSB headers. I will admit that I did only test
> > > it on OracleLinux.
> > > 
> > > [1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
> > > [2] https://fedoraproject.org/wiki/Packaging:Systemd
> > 
> > Weird policy but fair enough, can you then add support for a comma
> > separated list of init systems that Debian, Ubuntu and any similar
> > distro could use?
> 
> Sure, I can look into that. I think part of this is because systemd has
> some compatibility with sysv init scripts, so if you had both installed
> maybe it would start the service twice? Not sure how upstart handles
> that since I thought it had sysv init script compatibility too?

Upstart won't start any sysvinit script which has a matching upstart
job. I believe this is simply based on the name by default but some init
scripts also specifically look for upstart and exit 0 if it's found
(though we're trying to discourage that approach and instead have the
source lsb functions do that check centrally).

> 
> > > 
> > > > 
> > > > > 
> > > > > > > 
> > > > > > > > ---
> > > > > > > >  configure.ac   | 45
> > > > > > > > +++
> > > > > > > > lxc.spec.in| 27 +++

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Dwight Engen
On Mon, 6 Jan 2014 11:25:11 -0500
Stéphane Graber  wrote:

> On Mon, Jan 06, 2014 at 11:19:56AM -0500, Dwight Engen wrote:
> > On Fri, 3 Jan 2014 15:07:01 -0500
> > Stéphane Graber  wrote:
> > 
> > > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > > This change updates the way init scripts get installed so
> > > > > > > that more than one init system can be supported. Instead
> > > > > > > of installing the systemd service file from the spec
> > > > > > > file, it should be installed at make install time, so
> > > > > > > that someone compiling from source also gets the unit
> > > > > > > file installed.
> > > > > > > 
> > > > > > > Update the plamo template to use a lock file not named
> > > > > > > just /var/lock/subsys/lxc since the presence of that file
> > > > > > > is used by sysv init rc file to know if it should run the
> > > > > > > K01lxc script. This also makes it consistent with the
> > > > > > > other templates which
> > > > > > > use /var/lock/subsys/lxc-$template-name.
> > > > > > > 
> > > > > > > Signed-off-by: Dwight Engen 
> > > > > > 
> > > > > > I have no objection to this, but I'd appreciate Stéphane
> > > > > > taking a closer look.  This might lead the way to putting
> > > > > > the upstart scripts for ubuntu upstream as well, which
> > > > > > would be a plus.  It also can give us more reasonable and
> > > > > > comprehensive testcases if we can know that common distros
> > > > > > will have a certain amount of setup.
> > > > > > 
> > > > > > Acked-by: Serge E. Hallyn 
> > > > > 
> > > > > I don't think the current proposal is appropriate.
> > > > > 
> > > > > At least in Ubuntu and Debian, we typically want more than one
> > > > > init script to be installed. The way things work in Debian
> > > > > based distros is that init scripts for all supported init
> > > > > daemons are installed and only the relevant ones are used at
> > > > > boot time and by the user (with the "service" command).
> > > > > 
> > > > > As a result, I'd expect an LXC package build on Debian or
> > > > > Ubuntu to include the upstart jobs, sysvinit script and
> > > > > systemd unit in their usual locations.
> > > > 
> > > > Drat, I just pushed the commit.
> > > > 
> > > > So having
> > > > 
> > > > case $with_distro in
> > > > ubuntu)
> > > > init_script=upstart,systemd,sysv
> > > > ;;
> > > > 
> > > > and the rest geared to support that, could work here?
> > > 
> > > And the same for debian) but yes, that'd be fine I think.
> > > 
> > > I'm also wondering whether non-Debian distros actually have a
> > > problem should they all be installed at once, if not, then maybe
> > > we can do without the whole --init-script thing and always have
> > > them all installed?
> > 
> > Yeah, Fedora packaging guidelines [1], [2] want either sysv or
> > systemd, but not both ("Packagers MUST NOT include SysV initscripts
> > in addition to systemd unit files, even in a separate
> > $name-sysvinit subpackage as there are corner cases where the
> > initscripts can override the systemd unit files."). So that is why
> > I had only one of them being installed. I can see that it makes
> > sense to install multiple if the distro supports it.
> > 
> > As far as the sysv initscript I provided running on multiple
> > distros: It is pretty simple and I tried to make it generic, it has
> > both chkconfig and LSB headers. I will admit that I did only test
> > it on OracleLinux.
> > 
> > [1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
> > [2] https://fedoraproject.org/wiki/Packaging:Systemd
> 
> Weird policy but fair enough, can you then add support for a comma
> separated list of init systems that Debian, Ubuntu and any similar
> distro could use?

Sure, I can look into that. I think part of this is because systemd has
some compatibility with sysv init scripts, so if you had both installed
maybe it would start the service twice? Not sure how upstart handles
that since I thought it had sysv init script compatibility too?

> > 
> > > 
> > > > 
> > > > > > 
> > > > > > > ---
> > > > > > >  configure.ac   | 45
> > > > > > > +++
> > > > > > > lxc.spec.in| 27 +++--
> > > > > > > src/lxc/Makefile.am| 44
> > > > > > > +- src/lxc/lxc.sysvinit
> > > > > > > | 64 ++
> > > > > > > templates/lxc-plamo.in |  4 ++-- 5 files changed, 174
> > > > > > > insertions(+), 10 deletions(-) create mode 100755
> > > > > > > src/lxc/lxc.sysvinit
> > > > > > > 
> > > > > > > diff --git a/configure.ac b/configure.ac
> > > > > > > index 4c5f002..2d24937 100644
> > > > > > > --- a/configure.ac
> > > > > > > +++ b/configure.ac
> > > > > > > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$wi

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Dwight Engen
On Fri, 3 Jan 2014 15:07:01 -0500
Stéphane Graber  wrote:

> On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > This change updates the way init scripts get installed so
> > > > > that more than one init system can be supported. Instead of
> > > > > installing the systemd service file from the spec file, it
> > > > > should be installed at make install time, so that someone
> > > > > compiling from source also gets the unit file installed.
> > > > > 
> > > > > Update the plamo template to use a lock file not named just
> > > > > /var/lock/subsys/lxc since the presence of that file is used
> > > > > by sysv init rc file to know if it should run the K01lxc
> > > > > script. This also makes it consistent with the other
> > > > > templates which use /var/lock/subsys/lxc-$template-name.
> > > > > 
> > > > > Signed-off-by: Dwight Engen 
> > > > 
> > > > I have no objection to this, but I'd appreciate Stéphane taking
> > > > a closer look.  This might lead the way to putting the upstart
> > > > scripts for ubuntu upstream as well, which would be a plus.  It
> > > > also can give us more reasonable and comprehensive testcases if
> > > > we can know that common distros will have a certain amount of
> > > > setup.
> > > > 
> > > > Acked-by: Serge E. Hallyn 
> > > 
> > > I don't think the current proposal is appropriate.
> > > 
> > > At least in Ubuntu and Debian, we typically want more than one
> > > init script to be installed. The way things work in Debian based
> > > distros is that init scripts for all supported init daemons are
> > > installed and only the relevant ones are used at boot time and by
> > > the user (with the "service" command).
> > > 
> > > As a result, I'd expect an LXC package build on Debian or Ubuntu
> > > to include the upstart jobs, sysvinit script and systemd unit in
> > > their usual locations.
> > 
> > Drat, I just pushed the commit.
> > 
> > So having
> > 
> > case $with_distro in
> > ubuntu)
> > init_script=upstart,systemd,sysv
> > ;;
> > 
> > and the rest geared to support that, could work here?
> 
> And the same for debian) but yes, that'd be fine I think.
> 
> I'm also wondering whether non-Debian distros actually have a problem
> should they all be installed at once, if not, then maybe we can do
> without the whole --init-script thing and always have them all
> installed?

Yeah, Fedora packaging guidelines [1], [2] want either sysv or systemd,
but not both ("Packagers MUST NOT include SysV initscripts in addition
to systemd unit files, even in a separate $name-sysvinit subpackage as
there are corner cases where the initscripts can override the systemd
unit files."). So that is why I had only one of them being installed. I
can see that it makes sense to install multiple if the distro supports
it.

As far as the sysv initscript I provided running on multiple distros:
It is pretty simple and I tried to make it generic, it has both
chkconfig and LSB headers. I will admit that I did only test it on
OracleLinux.

[1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
[2] https://fedoraproject.org/wiki/Packaging:Systemd

> 
> > 
> > > > 
> > > > > ---
> > > > >  configure.ac   | 45
> > > > > +++ lxc.spec.in|
> > > > > 27 +++-- src/lxc/Makefile.am| 44
> > > > > +- src/lxc/lxc.sysvinit   |
> > > > > 64 ++
> > > > > templates/lxc-plamo.in |  4 ++-- 5 files changed, 174
> > > > > insertions(+), 10 deletions(-) create mode 100755
> > > > > src/lxc/lxc.sysvinit
> > > > > 
> > > > > diff --git a/configure.ac b/configure.ac
> > > > > index 4c5f002..2d24937 100644
> > > > > --- a/configure.ac
> > > > > +++ b/configure.ac
> > > > > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> > > > >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" =
> > > > > "xdebian" -o x"$with_distro" = "xubuntu"])
> > > > > AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" =
> > > > > "xubuntu"]) +# Check for init system type
> > > > > +AC_MSG_CHECKING([for init system type])
> > > > > +AC_ARG_WITH([init-script],
> > > > > +
> > > > > [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > > > > + [Type of init script to install:
> > > > > sysv, systemd, upstart,
> > > > > +  distro, none
> > > > > @<:@default=distro@:>@])],[],[with_init_script=distro]) +case
> > > > > "$with_init_script" in
> > > > > + sysv)
> > > > > + init_script=sysv
> > > > > + ;;
> > > > > + systemd)
> > > > > + init_script=systemd
> > > > > + ;;
> > > > > + upstart)
> > > > > + init_script=upstart
> > > > > + ;;
> > > > > + none)
> > > > > +

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-06 Thread Stéphane Graber
On Mon, Jan 06, 2014 at 11:19:56AM -0500, Dwight Engen wrote:
> On Fri, 3 Jan 2014 15:07:01 -0500
> Stéphane Graber  wrote:
> 
> > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > This change updates the way init scripts get installed so
> > > > > > that more than one init system can be supported. Instead of
> > > > > > installing the systemd service file from the spec file, it
> > > > > > should be installed at make install time, so that someone
> > > > > > compiling from source also gets the unit file installed.
> > > > > > 
> > > > > > Update the plamo template to use a lock file not named just
> > > > > > /var/lock/subsys/lxc since the presence of that file is used
> > > > > > by sysv init rc file to know if it should run the K01lxc
> > > > > > script. This also makes it consistent with the other
> > > > > > templates which use /var/lock/subsys/lxc-$template-name.
> > > > > > 
> > > > > > Signed-off-by: Dwight Engen 
> > > > > 
> > > > > I have no objection to this, but I'd appreciate Stéphane taking
> > > > > a closer look.  This might lead the way to putting the upstart
> > > > > scripts for ubuntu upstream as well, which would be a plus.  It
> > > > > also can give us more reasonable and comprehensive testcases if
> > > > > we can know that common distros will have a certain amount of
> > > > > setup.
> > > > > 
> > > > > Acked-by: Serge E. Hallyn 
> > > > 
> > > > I don't think the current proposal is appropriate.
> > > > 
> > > > At least in Ubuntu and Debian, we typically want more than one
> > > > init script to be installed. The way things work in Debian based
> > > > distros is that init scripts for all supported init daemons are
> > > > installed and only the relevant ones are used at boot time and by
> > > > the user (with the "service" command).
> > > > 
> > > > As a result, I'd expect an LXC package build on Debian or Ubuntu
> > > > to include the upstart jobs, sysvinit script and systemd unit in
> > > > their usual locations.
> > > 
> > > Drat, I just pushed the commit.
> > > 
> > > So having
> > > 
> > > case $with_distro in
> > >   ubuntu)
> > >   init_script=upstart,systemd,sysv
> > >   ;;
> > > 
> > > and the rest geared to support that, could work here?
> > 
> > And the same for debian) but yes, that'd be fine I think.
> > 
> > I'm also wondering whether non-Debian distros actually have a problem
> > should they all be installed at once, if not, then maybe we can do
> > without the whole --init-script thing and always have them all
> > installed?
> 
> Yeah, Fedora packaging guidelines [1], [2] want either sysv or systemd,
> but not both ("Packagers MUST NOT include SysV initscripts in addition
> to systemd unit files, even in a separate $name-sysvinit subpackage as
> there are corner cases where the initscripts can override the systemd
> unit files."). So that is why I had only one of them being installed. I
> can see that it makes sense to install multiple if the distro supports
> it.
> 
> As far as the sysv initscript I provided running on multiple distros:
> It is pretty simple and I tried to make it generic, it has both
> chkconfig and LSB headers. I will admit that I did only test it on
> OracleLinux.
> 
> [1] https://fedoraproject.org/wiki/Packaging:SysVInitScript
> [2] https://fedoraproject.org/wiki/Packaging:Systemd

Weird policy but fair enough, can you then add support for a comma
separated list of init systems that Debian, Ubuntu and any similar
distro could use?

> 
> > 
> > > 
> > > > > 
> > > > > > ---
> > > > > >  configure.ac   | 45
> > > > > > +++ lxc.spec.in|
> > > > > > 27 +++-- src/lxc/Makefile.am| 44
> > > > > > +- src/lxc/lxc.sysvinit   |
> > > > > > 64 ++
> > > > > > templates/lxc-plamo.in |  4 ++-- 5 files changed, 174
> > > > > > insertions(+), 10 deletions(-) create mode 100755
> > > > > > src/lxc/lxc.sysvinit
> > > > > > 
> > > > > > diff --git a/configure.ac b/configure.ac
> > > > > > index 4c5f002..2d24937 100644
> > > > > > --- a/configure.ac
> > > > > > +++ b/configure.ac
> > > > > > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> > > > > >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" =
> > > > > > "xdebian" -o x"$with_distro" = "xubuntu"])
> > > > > > AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" =
> > > > > > "xubuntu"]) +# Check for init system type
> > > > > > +AC_MSG_CHECKING([for init system type])
> > > > > > +AC_ARG_WITH([init-script],
> > > > > > +
> > > > > > [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > > > > > +   [Type of init script to install:
> > > > > > sysv, systemd, upstart,
> > > > > > +distro, none
> > > > > > 

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-03 Thread Stéphane Graber
On Fri, Jan 03, 2014 at 03:44:53PM -0600, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgra...@ubuntu.com):
> > On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > > This change updates the way init scripts get installed so that more
> > > > > > than one init system can be supported. Instead of installing the
> > > > > > systemd service file from the spec file, it should be installed at
> > > > > > make install time, so that someone compiling from source also gets
> > > > > > the unit file installed.
> > > > > > 
> > > > > > Update the plamo template to use a lock file not named just
> > > > > > /var/lock/subsys/lxc since the presence of that file is used by
> > > > > > sysv init rc file to know if it should run the K01lxc script. This
> > > > > > also makes it consistent with the other templates which use
> > > > > > /var/lock/subsys/lxc-$template-name.
> > > > > > 
> > > > > > Signed-off-by: Dwight Engen 
> > > > > 
> > > > > I have no objection to this, but I'd appreciate Stéphane taking
> > > > > a closer look.  This might lead the way to putting the upstart
> > > > > scripts for ubuntu upstream as well, which would be a plus.  It
> > > > > also can give us more reasonable and comprehensive testcases if
> > > > > we can know that common distros will have a certain amount of
> > > > > setup.
> > > > > 
> > > > > Acked-by: Serge E. Hallyn 
> > > > 
> > > > I don't think the current proposal is appropriate.
> > > > 
> > > > At least in Ubuntu and Debian, we typically want more than one init
> > > > script to be installed. The way things work in Debian based distros is
> > > > that init scripts for all supported init daemons are installed and only
> > > > the relevant ones are used at boot time and by the user (with the
> > > > "service" command).
> > > > 
> > > > As a result, I'd expect an LXC package build on Debian or Ubuntu to
> > > > include the upstart jobs, sysvinit script and systemd unit in their
> > > > usual locations.
> > > 
> > > Drat, I just pushed the commit.
> > > 
> > > So having
> > > 
> > > case $with_distro in
> > >   ubuntu)
> > >   init_script=upstart,systemd,sysv
> > >   ;;
> > > 
> > > and the rest geared to support that, could work here?
> > 
> > And the same for debian) but yes, that'd be fine I think.
> > 
> > I'm also wondering whether non-Debian distros actually have a problem
> > should they all be installed at once, if not, then maybe we can do
> > without the whole --init-script thing and always have them all
> > installed?
> 
> Of course one problem is that the init script contents for the same
> init system for different distros may have to be different.  Someone
> may finagle fedora into running upstart, but ubuntu's lxc-net.conf
> probably wouldn't work on fedora.  (Then again, as I look at it,
> it actually just might...)

Yeah, I'm planning on upstreaming our upstart jobs and apparmor profiles
before rc1 but I'll need to do a proper review to confirm those have at
least a remote chance of working on another distro.

I suspect most distros will still overwrite the upstream init scripts
with their own, as they may want to tweak some of the start conditions
or change some of the content to better integrate with their init system
(different LSB version, slightly different hooks, ...).

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com


signature.asc
Description: Digital signature
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-03 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com):
> On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > > This change updates the way init scripts get installed so that more
> > > > > than one init system can be supported. Instead of installing the
> > > > > systemd service file from the spec file, it should be installed at
> > > > > make install time, so that someone compiling from source also gets
> > > > > the unit file installed.
> > > > > 
> > > > > Update the plamo template to use a lock file not named just
> > > > > /var/lock/subsys/lxc since the presence of that file is used by
> > > > > sysv init rc file to know if it should run the K01lxc script. This
> > > > > also makes it consistent with the other templates which use
> > > > > /var/lock/subsys/lxc-$template-name.
> > > > > 
> > > > > Signed-off-by: Dwight Engen 
> > > > 
> > > > I have no objection to this, but I'd appreciate Stéphane taking
> > > > a closer look.  This might lead the way to putting the upstart
> > > > scripts for ubuntu upstream as well, which would be a plus.  It
> > > > also can give us more reasonable and comprehensive testcases if
> > > > we can know that common distros will have a certain amount of
> > > > setup.
> > > > 
> > > > Acked-by: Serge E. Hallyn 
> > > 
> > > I don't think the current proposal is appropriate.
> > > 
> > > At least in Ubuntu and Debian, we typically want more than one init
> > > script to be installed. The way things work in Debian based distros is
> > > that init scripts for all supported init daemons are installed and only
> > > the relevant ones are used at boot time and by the user (with the
> > > "service" command).
> > > 
> > > As a result, I'd expect an LXC package build on Debian or Ubuntu to
> > > include the upstart jobs, sysvinit script and systemd unit in their
> > > usual locations.
> > 
> > Drat, I just pushed the commit.
> > 
> > So having
> > 
> > case $with_distro in
> > ubuntu)
> > init_script=upstart,systemd,sysv
> > ;;
> > 
> > and the rest geared to support that, could work here?
> 
> And the same for debian) but yes, that'd be fine I think.
> 
> I'm also wondering whether non-Debian distros actually have a problem
> should they all be installed at once, if not, then maybe we can do
> without the whole --init-script thing and always have them all
> installed?

Of course one problem is that the init script contents for the same
init system for different distros may have to be different.  Someone
may finagle fedora into running upstart, but ubuntu's lxc-net.conf
probably wouldn't work on fedora.  (Then again, as I look at it,
it actually just might...)
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-03 Thread Stéphane Graber
On Fri, Jan 03, 2014 at 02:00:25PM -0600, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgra...@ubuntu.com):
> > On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > > This change updates the way init scripts get installed so that more
> > > > than one init system can be supported. Instead of installing the
> > > > systemd service file from the spec file, it should be installed at
> > > > make install time, so that someone compiling from source also gets
> > > > the unit file installed.
> > > > 
> > > > Update the plamo template to use a lock file not named just
> > > > /var/lock/subsys/lxc since the presence of that file is used by
> > > > sysv init rc file to know if it should run the K01lxc script. This
> > > > also makes it consistent with the other templates which use
> > > > /var/lock/subsys/lxc-$template-name.
> > > > 
> > > > Signed-off-by: Dwight Engen 
> > > 
> > > I have no objection to this, but I'd appreciate Stéphane taking
> > > a closer look.  This might lead the way to putting the upstart
> > > scripts for ubuntu upstream as well, which would be a plus.  It
> > > also can give us more reasonable and comprehensive testcases if
> > > we can know that common distros will have a certain amount of
> > > setup.
> > > 
> > > Acked-by: Serge E. Hallyn 
> > 
> > I don't think the current proposal is appropriate.
> > 
> > At least in Ubuntu and Debian, we typically want more than one init
> > script to be installed. The way things work in Debian based distros is
> > that init scripts for all supported init daemons are installed and only
> > the relevant ones are used at boot time and by the user (with the
> > "service" command).
> > 
> > As a result, I'd expect an LXC package build on Debian or Ubuntu to
> > include the upstart jobs, sysvinit script and systemd unit in their
> > usual locations.
> 
> Drat, I just pushed the commit.
> 
> So having
> 
> case $with_distro in
>   ubuntu)
>   init_script=upstart,systemd,sysv
>   ;;
> 
> and the rest geared to support that, could work here?

And the same for debian) but yes, that'd be fine I think.

I'm also wondering whether non-Debian distros actually have a problem
should they all be installed at once, if not, then maybe we can do
without the whole --init-script thing and always have them all
installed?

> 
> > > 
> > > > ---
> > > >  configure.ac   | 45 +++
> > > >  lxc.spec.in| 27 +++--
> > > >  src/lxc/Makefile.am| 44 +-
> > > >  src/lxc/lxc.sysvinit   | 64 
> > > > ++
> > > >  templates/lxc-plamo.in |  4 ++--
> > > >  5 files changed, 174 insertions(+), 10 deletions(-)
> > > >  create mode 100755 src/lxc/lxc.sysvinit
> > > > 
> > > > diff --git a/configure.ac b/configure.ac
> > > > index 4c5f002..2d24937 100644
> > > > --- a/configure.ac
> > > > +++ b/configure.ac
> > > > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> > > >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o 
> > > > x"$with_distro" = "xubuntu"])
> > > >  AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
> > > >  
> > > > +# Check for init system type
> > > > +AC_MSG_CHECKING([for init system type])
> > > > +AC_ARG_WITH([init-script],
> > > > +   [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > > > +   [Type of init script to install: sysv, 
> > > > systemd, upstart,
> > > > +distro, none 
> > > > @<:@default=distro@:>@])],[],[with_init_script=distro])
> > > > +case "$with_init_script" in
> > > > +   sysv)
> > > > +   init_script=sysv
> > > > +   ;;
> > > > +   systemd)
> > > > +   init_script=systemd
> > > > +   ;;
> > > > +   upstart)
> > > > +   init_script=upstart
> > > > +   ;;
> > > > +   none)
> > > > +   ;;
> > > > +   distro)
> > > > +   case $with_distro in
> > > > +   fedora)
> > > > +   init_script=systemd
> > > > +   ;;
> > > > +   redhat|centos|oracle|oracleserver)
> > > > +   init_script=sysv
> > > > +   ;;
> > > > +   ubuntu)
> > > > +   init_script=upstart
> > > > +   ;;
> > > > +   *)
> > > > +   echo -n "Linux distribution init system 
> > > > unknown, defaulting to sysv"
> > > > +   init_script=sysv
> > > > +   ;;
> > > > +   esac
> > > > +   ;;
> > > > +   *)
> > > > +   AC_MSG_ERROR([Unknown init system type 
> > > > $with_init_script])
> > > > +   

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-03 Thread Serge Hallyn
Quoting Stéphane Graber (stgra...@ubuntu.com):
> On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> > Quoting Dwight Engen (dwight.en...@oracle.com):
> > > This change updates the way init scripts get installed so that more
> > > than one init system can be supported. Instead of installing the
> > > systemd service file from the spec file, it should be installed at
> > > make install time, so that someone compiling from source also gets
> > > the unit file installed.
> > > 
> > > Update the plamo template to use a lock file not named just
> > > /var/lock/subsys/lxc since the presence of that file is used by
> > > sysv init rc file to know if it should run the K01lxc script. This
> > > also makes it consistent with the other templates which use
> > > /var/lock/subsys/lxc-$template-name.
> > > 
> > > Signed-off-by: Dwight Engen 
> > 
> > I have no objection to this, but I'd appreciate Stéphane taking
> > a closer look.  This might lead the way to putting the upstart
> > scripts for ubuntu upstream as well, which would be a plus.  It
> > also can give us more reasonable and comprehensive testcases if
> > we can know that common distros will have a certain amount of
> > setup.
> > 
> > Acked-by: Serge E. Hallyn 
> 
> I don't think the current proposal is appropriate.
> 
> At least in Ubuntu and Debian, we typically want more than one init
> script to be installed. The way things work in Debian based distros is
> that init scripts for all supported init daemons are installed and only
> the relevant ones are used at boot time and by the user (with the
> "service" command).
> 
> As a result, I'd expect an LXC package build on Debian or Ubuntu to
> include the upstart jobs, sysvinit script and systemd unit in their
> usual locations.

Drat, I just pushed the commit.

So having

case $with_distro in
ubuntu)
init_script=upstart,systemd,sysv
;;

and the rest geared to support that, could work here?

> > 
> > > ---
> > >  configure.ac   | 45 +++
> > >  lxc.spec.in| 27 +++--
> > >  src/lxc/Makefile.am| 44 +-
> > >  src/lxc/lxc.sysvinit   | 64 
> > > ++
> > >  templates/lxc-plamo.in |  4 ++--
> > >  5 files changed, 174 insertions(+), 10 deletions(-)
> > >  create mode 100755 src/lxc/lxc.sysvinit
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index 4c5f002..2d24937 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> > >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o 
> > > x"$with_distro" = "xubuntu"])
> > >  AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
> > >  
> > > +# Check for init system type
> > > +AC_MSG_CHECKING([for init system type])
> > > +AC_ARG_WITH([init-script],
> > > + [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > > + [Type of init script to install: sysv, systemd, 
> > > upstart,
> > > +  distro, none 
> > > @<:@default=distro@:>@])],[],[with_init_script=distro])
> > > +case "$with_init_script" in
> > > + sysv)
> > > + init_script=sysv
> > > + ;;
> > > + systemd)
> > > + init_script=systemd
> > > + ;;
> > > + upstart)
> > > + init_script=upstart
> > > + ;;
> > > + none)
> > > + ;;
> > > + distro)
> > > + case $with_distro in
> > > + fedora)
> > > + init_script=systemd
> > > + ;;
> > > + redhat|centos|oracle|oracleserver)
> > > + init_script=sysv
> > > + ;;
> > > + ubuntu)
> > > + init_script=upstart
> > > + ;;
> > > + *)
> > > + echo -n "Linux distribution init system 
> > > unknown, defaulting to sysv"
> > > + init_script=sysv
> > > + ;;
> > > + esac
> > > + ;;
> > > + *)
> > > + AC_MSG_ERROR([Unknown init system type $with_init_script])
> > > + ;;
> > > +esac
> > > +AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
> > > +AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" = "systemd")
> > > +AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test "$init_script" = "upstart")
> > > +AC_MSG_RESULT($init_script)
> > > +
> > >  # Allow disabling rpath
> > >  AC_ARG_ENABLE([rpath],
> > >   [AC_HELP_STRING([--enable-rpath], [set rpath in executables 
> > > [default=no]])],
> > > @@ -610,6 +654,7 @@ cat << EOF
> > >  Environment:
> > >   - compiler: $CC
> > >   - distribution: $with_distro
> > > + - init script type: $init_script
> > >   - rpath: $enable_rpath
> > >   - GnuTLS: $enable_gnutls
> > >  
> > > diff --git a/lxc.spec.in b/lxc.spec.in
> > > index 6814ad7..b977c8c 10064

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-03 Thread Stéphane Graber
On Thu, Jan 02, 2014 at 11:09:25AM -0600, Serge Hallyn wrote:
> Quoting Dwight Engen (dwight.en...@oracle.com):
> > This change updates the way init scripts get installed so that more
> > than one init system can be supported. Instead of installing the
> > systemd service file from the spec file, it should be installed at
> > make install time, so that someone compiling from source also gets
> > the unit file installed.
> > 
> > Update the plamo template to use a lock file not named just
> > /var/lock/subsys/lxc since the presence of that file is used by
> > sysv init rc file to know if it should run the K01lxc script. This
> > also makes it consistent with the other templates which use
> > /var/lock/subsys/lxc-$template-name.
> > 
> > Signed-off-by: Dwight Engen 
> 
> I have no objection to this, but I'd appreciate Stéphane taking
> a closer look.  This might lead the way to putting the upstart
> scripts for ubuntu upstream as well, which would be a plus.  It
> also can give us more reasonable and comprehensive testcases if
> we can know that common distros will have a certain amount of
> setup.
> 
> Acked-by: Serge E. Hallyn 

I don't think the current proposal is appropriate.

At least in Ubuntu and Debian, we typically want more than one init
script to be installed. The way things work in Debian based distros is
that init scripts for all supported init daemons are installed and only
the relevant ones are used at boot time and by the user (with the
"service" command).

As a result, I'd expect an LXC package build on Debian or Ubuntu to
include the upstart jobs, sysvinit script and systemd unit in their
usual locations.

> 
> > ---
> >  configure.ac   | 45 +++
> >  lxc.spec.in| 27 +++--
> >  src/lxc/Makefile.am| 44 +-
> >  src/lxc/lxc.sysvinit   | 64 
> > ++
> >  templates/lxc-plamo.in |  4 ++--
> >  5 files changed, 174 insertions(+), 10 deletions(-)
> >  create mode 100755 src/lxc/lxc.sysvinit
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 4c5f002..2d24937 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o 
> > x"$with_distro" = "xubuntu"])
> >  AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
> >  
> > +# Check for init system type
> > +AC_MSG_CHECKING([for init system type])
> > +AC_ARG_WITH([init-script],
> > +   [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > +   [Type of init script to install: sysv, systemd, 
> > upstart,
> > +distro, none 
> > @<:@default=distro@:>@])],[],[with_init_script=distro])
> > +case "$with_init_script" in
> > +   sysv)
> > +   init_script=sysv
> > +   ;;
> > +   systemd)
> > +   init_script=systemd
> > +   ;;
> > +   upstart)
> > +   init_script=upstart
> > +   ;;
> > +   none)
> > +   ;;
> > +   distro)
> > +   case $with_distro in
> > +   fedora)
> > +   init_script=systemd
> > +   ;;
> > +   redhat|centos|oracle|oracleserver)
> > +   init_script=sysv
> > +   ;;
> > +   ubuntu)
> > +   init_script=upstart
> > +   ;;
> > +   *)
> > +   echo -n "Linux distribution init system 
> > unknown, defaulting to sysv"
> > +   init_script=sysv
> > +   ;;
> > +   esac
> > +   ;;
> > +   *)
> > +   AC_MSG_ERROR([Unknown init system type $with_init_script])
> > +   ;;
> > +esac
> > +AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
> > +AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" = "systemd")
> > +AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test "$init_script" = "upstart")
> > +AC_MSG_RESULT($init_script)
> > +
> >  # Allow disabling rpath
> >  AC_ARG_ENABLE([rpath],
> > [AC_HELP_STRING([--enable-rpath], [set rpath in executables 
> > [default=no]])],
> > @@ -610,6 +654,7 @@ cat << EOF
> >  Environment:
> >   - compiler: $CC
> >   - distribution: $with_distro
> > + - init script type: $init_script
> >   - rpath: $enable_rpath
> >   - GnuTLS: $enable_gnutls
> >  
> > diff --git a/lxc.spec.in b/lxc.spec.in
> > index 6814ad7..b977c8c 100644
> > --- a/lxc.spec.in
> > +++ b/lxc.spec.in
> > @@ -23,6 +23,17 @@
> >  %global with_python %{?_with_python: 1} %{?!_with_python: 0}
> >  %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
> >  
> > +# Set with_systemd on distros that use it, so we can install the service
> > +# file, otherwise the sysvinit script will be installed
> > +%if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_versio

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-02 Thread Dwight Engen
On Thu, 2 Jan 2014 11:09:25 -0600
Serge Hallyn  wrote:

> Quoting Dwight Engen (dwight.en...@oracle.com):
> > This change updates the way init scripts get installed so that more
> > than one init system can be supported. Instead of installing the
> > systemd service file from the spec file, it should be installed at
> > make install time, so that someone compiling from source also gets
> > the unit file installed.
> > 
> > Update the plamo template to use a lock file not named just
> > /var/lock/subsys/lxc since the presence of that file is used by
> > sysv init rc file to know if it should run the K01lxc script. This
> > also makes it consistent with the other templates which use
> > /var/lock/subsys/lxc-$template-name.
> > 
> > Signed-off-by: Dwight Engen 
> 
> I have no objection to this, but I'd appreciate Stéphane taking
> a closer look.  This might lead the way to putting the upstart
> scripts for ubuntu upstream as well, which would be a plus.  It

Yeah I left a placeholder in there for putting an upstart script in but
didn't actually pull the one from Ubuntu's dpkg stuff, as I wasn't sure
you wanted it in upstream or not.

> also can give us more reasonable and comprehensive testcases if
> we can know that common distros will have a certain amount of
> setup.
> 
> Acked-by: Serge E. Hallyn 
> 
> > ---
> >  configure.ac   | 45 +++
> >  lxc.spec.in| 27 +++--
> >  src/lxc/Makefile.am| 44 +-
> >  src/lxc/lxc.sysvinit   | 64
> > ++
> > templates/lxc-plamo.in |  4 ++-- 5 files changed, 174
> > insertions(+), 10 deletions(-) create mode 100755
> > src/lxc/lxc.sysvinit
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 4c5f002..2d24937 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
> >  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o
> > x"$with_distro" = "xubuntu"]) AM_CONDITIONAL([DISTRO_UBUNTU], [test
> > "x$with_distro" = "xubuntu"]) 
> > +# Check for init system type
> > +AC_MSG_CHECKING([for init system type])
> > +AC_ARG_WITH([init-script],
> > +   [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> > +   [Type of init script to install: sysv,
> > systemd, upstart,
> > +distro, none
> > @<:@default=distro@:>@])],[],[with_init_script=distro]) +case
> > "$with_init_script" in
> > +   sysv)
> > +   init_script=sysv
> > +   ;;
> > +   systemd)
> > +   init_script=systemd
> > +   ;;
> > +   upstart)
> > +   init_script=upstart
> > +   ;;
> > +   none)
> > +   ;;
> > +   distro)
> > +   case $with_distro in
> > +   fedora)
> > +   init_script=systemd
> > +   ;;
> > +   redhat|centos|oracle|oracleserver)
> > +   init_script=sysv
> > +   ;;
> > +   ubuntu)
> > +   init_script=upstart
> > +   ;;
> > +   *)
> > +   echo -n "Linux distribution init
> > system unknown, defaulting to sysv"
> > +   init_script=sysv
> > +   ;;
> > +   esac
> > +   ;;
> > +   *)
> > +   AC_MSG_ERROR([Unknown init system type
> > $with_init_script])
> > +   ;;
> > +esac
> > +AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
> > +AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" =
> > "systemd") +AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test
> > "$init_script" = "upstart") +AC_MSG_RESULT($init_script)
> > +
> >  # Allow disabling rpath
> >  AC_ARG_ENABLE([rpath],
> > [AC_HELP_STRING([--enable-rpath], [set rpath in
> > executables [default=no]])], @@ -610,6 +654,7 @@ cat << EOF
> >  Environment:
> >   - compiler: $CC
> >   - distribution: $with_distro
> > + - init script type: $init_script
> >   - rpath: $enable_rpath
> >   - GnuTLS: $enable_gnutls
> >  
> > diff --git a/lxc.spec.in b/lxc.spec.in
> > index 6814ad7..b977c8c 100644
> > --- a/lxc.spec.in
> > +++ b/lxc.spec.in
> > @@ -23,6 +23,17 @@
> >  %global with_python %{?_with_python: 1} %{?!_with_python: 0}
> >  %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
> >  
> > +# Set with_systemd on distros that use it, so we can install the
> > service +# file, otherwise the sysvinit script will be installed
> > +%if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >=
> > 1210 +%global with_systemd 1
> > +%define init_script systemd
> > +BuildRequires: systemd-units
> > +%else
> > +%global with_systemd 0
> > +%define init_script sysv
> > +%endif
> > +
> >  # RPM needs alpha/beta/rc in Release: not Version: to ensure smooth
> >  # package upgrades from alpha->beta->rc->release. For more info
> > see: #

Re: [lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2014-01-02 Thread Serge Hallyn
Quoting Dwight Engen (dwight.en...@oracle.com):
> This change updates the way init scripts get installed so that more
> than one init system can be supported. Instead of installing the
> systemd service file from the spec file, it should be installed at
> make install time, so that someone compiling from source also gets
> the unit file installed.
> 
> Update the plamo template to use a lock file not named just
> /var/lock/subsys/lxc since the presence of that file is used by
> sysv init rc file to know if it should run the K01lxc script. This
> also makes it consistent with the other templates which use
> /var/lock/subsys/lxc-$template-name.
> 
> Signed-off-by: Dwight Engen 

I have no objection to this, but I'd appreciate Stéphane taking
a closer look.  This might lead the way to putting the upstart
scripts for ubuntu upstream as well, which would be a plus.  It
also can give us more reasonable and comprehensive testcases if
we can know that common distros will have a certain amount of
setup.

Acked-by: Serge E. Hallyn 

> ---
>  configure.ac   | 45 +++
>  lxc.spec.in| 27 +++--
>  src/lxc/Makefile.am| 44 +-
>  src/lxc/lxc.sysvinit   | 64 
> ++
>  templates/lxc-plamo.in |  4 ++--
>  5 files changed, 174 insertions(+), 10 deletions(-)
>  create mode 100755 src/lxc/lxc.sysvinit
> 
> diff --git a/configure.ac b/configure.ac
> index 4c5f002..2d24937 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
>  AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o 
> x"$with_distro" = "xubuntu"])
>  AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
>  
> +# Check for init system type
> +AC_MSG_CHECKING([for init system type])
> +AC_ARG_WITH([init-script],
> + [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
> + [Type of init script to install: sysv, systemd, 
> upstart,
> +  distro, none 
> @<:@default=distro@:>@])],[],[with_init_script=distro])
> +case "$with_init_script" in
> + sysv)
> + init_script=sysv
> + ;;
> + systemd)
> + init_script=systemd
> + ;;
> + upstart)
> + init_script=upstart
> + ;;
> + none)
> + ;;
> + distro)
> + case $with_distro in
> + fedora)
> + init_script=systemd
> + ;;
> + redhat|centos|oracle|oracleserver)
> + init_script=sysv
> + ;;
> + ubuntu)
> + init_script=upstart
> + ;;
> + *)
> + echo -n "Linux distribution init system 
> unknown, defaulting to sysv"
> + init_script=sysv
> + ;;
> + esac
> + ;;
> + *)
> + AC_MSG_ERROR([Unknown init system type $with_init_script])
> + ;;
> +esac
> +AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
> +AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" = "systemd")
> +AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test "$init_script" = "upstart")
> +AC_MSG_RESULT($init_script)
> +
>  # Allow disabling rpath
>  AC_ARG_ENABLE([rpath],
>   [AC_HELP_STRING([--enable-rpath], [set rpath in executables 
> [default=no]])],
> @@ -610,6 +654,7 @@ cat << EOF
>  Environment:
>   - compiler: $CC
>   - distribution: $with_distro
> + - init script type: $init_script
>   - rpath: $enable_rpath
>   - GnuTLS: $enable_gnutls
>  
> diff --git a/lxc.spec.in b/lxc.spec.in
> index 6814ad7..b977c8c 100644
> --- a/lxc.spec.in
> +++ b/lxc.spec.in
> @@ -23,6 +23,17 @@
>  %global with_python %{?_with_python: 1} %{?!_with_python: 0}
>  %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
>  
> +# Set with_systemd on distros that use it, so we can install the service
> +# file, otherwise the sysvinit script will be installed
> +%if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
> +%global with_systemd 1
> +%define init_script systemd
> +BuildRequires: systemd-units
> +%else
> +%global with_systemd 0
> +%define init_script sysv
> +%endif
> +
>  # RPM needs alpha/beta/rc in Release: not Version: to ensure smooth
>  # package upgrades from alpha->beta->rc->release. For more info see:
>  # 
> http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease
> @@ -94,7 +105,8 @@ PATH=$PATH:/usr/sbin:/sbin %configure $args \
>  %if %{with_python}
>--enable-python \
>  %endif
> -  --disable-rpath
> +  --disable-rpath \
> +  --with-init-script=%{init_script}
>  make %{?_smp_mflags}
>  
>  %install
> @@ -102,11 +114,6 @@ rm -rf %{buildroot}
>  make install DESTDIR=%{buil

[lxc-devel] [PATCH 2/2] add lxc-autostart support for sysv init systems

2013-12-31 Thread Dwight Engen
This change updates the way init scripts get installed so that more
than one init system can be supported. Instead of installing the
systemd service file from the spec file, it should be installed at
make install time, so that someone compiling from source also gets
the unit file installed.

Update the plamo template to use a lock file not named just
/var/lock/subsys/lxc since the presence of that file is used by
sysv init rc file to know if it should run the K01lxc script. This
also makes it consistent with the other templates which use
/var/lock/subsys/lxc-$template-name.

Signed-off-by: Dwight Engen 
---
 configure.ac   | 45 +++
 lxc.spec.in| 27 +++--
 src/lxc/Makefile.am| 44 +-
 src/lxc/lxc.sysvinit   | 64 ++
 templates/lxc-plamo.in |  4 ++--
 5 files changed, 174 insertions(+), 10 deletions(-)
 create mode 100755 src/lxc/lxc.sysvinit

diff --git a/configure.ac b/configure.ac
index 4c5f002..2d24937 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,50 @@ AC_MSG_RESULT([$with_distro])
 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o 
x"$with_distro" = "xubuntu"])
 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
 
+# Check for init system type
+AC_MSG_CHECKING([for init system type])
+AC_ARG_WITH([init-script],
+   [AC_HELP_STRING([--with-init-script@<:@=TYPE@:>@],
+   [Type of init script to install: sysv, systemd, 
upstart,
+distro, none 
@<:@default=distro@:>@])],[],[with_init_script=distro])
+case "$with_init_script" in
+   sysv)
+   init_script=sysv
+   ;;
+   systemd)
+   init_script=systemd
+   ;;
+   upstart)
+   init_script=upstart
+   ;;
+   none)
+   ;;
+   distro)
+   case $with_distro in
+   fedora)
+   init_script=systemd
+   ;;
+   redhat|centos|oracle|oracleserver)
+   init_script=sysv
+   ;;
+   ubuntu)
+   init_script=upstart
+   ;;
+   *)
+   echo -n "Linux distribution init system 
unknown, defaulting to sysv"
+   init_script=sysv
+   ;;
+   esac
+   ;;
+   *)
+   AC_MSG_ERROR([Unknown init system type $with_init_script])
+   ;;
+esac
+AM_CONDITIONAL([INIT_SCRIPT_SYSV], test "$init_script" = "sysv")
+AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_script" = "systemd")
+AM_CONDITIONAL([INIT_SCRIPT_UPSTART], test "$init_script" = "upstart")
+AC_MSG_RESULT($init_script)
+
 # Allow disabling rpath
 AC_ARG_ENABLE([rpath],
[AC_HELP_STRING([--enable-rpath], [set rpath in executables 
[default=no]])],
@@ -610,6 +654,7 @@ cat << EOF
 Environment:
  - compiler: $CC
  - distribution: $with_distro
+ - init script type: $init_script
  - rpath: $enable_rpath
  - GnuTLS: $enable_gnutls
 
diff --git a/lxc.spec.in b/lxc.spec.in
index 6814ad7..b977c8c 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -23,6 +23,17 @@
 %global with_python %{?_with_python: 1} %{?!_with_python: 0}
 %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
 
+# Set with_systemd on distros that use it, so we can install the service
+# file, otherwise the sysvinit script will be installed
+%if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
+%global with_systemd 1
+%define init_script systemd
+BuildRequires: systemd-units
+%else
+%global with_systemd 0
+%define init_script sysv
+%endif
+
 # RPM needs alpha/beta/rc in Release: not Version: to ensure smooth
 # package upgrades from alpha->beta->rc->release. For more info see:
 # http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease
@@ -94,7 +105,8 @@ PATH=$PATH:/usr/sbin:/sbin %configure $args \
 %if %{with_python}
   --enable-python \
 %endif
-  --disable-rpath
+  --disable-rpath \
+  --with-init-script=%{init_script}
 make %{?_smp_mflags}
 
 %install
@@ -102,11 +114,6 @@ rm -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
 
-# Install some of our systemd stuff...
-install -d -m 755 %{buildroot}/lib/systemd/system
-install -c -m 644 src/lxc/lxc.service %{buildroot}/lib/systemd/system
-install -c -m 755 src/lxc/lxc-devsetup %{buildroot}/%{_libexecdir}/%{name}
-
 %clean
 rm -rf %{buildroot}
 
@@ -136,7 +143,11 @@ rm -rf %{buildroot}
 %{_datadir}/lxc/*
 %config(noreplace) %{_sysconfdir}/lxc/*
 
-/lib/systemd/system/*
+%if %{with_systemd}
+%{_unitdir}/lxc.service
+%else
+%{_sysconfdir}/rc.d/init.d/lxc
+%endif
 
 %files libs
 %defattr(-,r