[libvirt] [PATCH 0/2] configure: Improve init script choice

If not init script type is explicitly chosen by the user, we try to pick a good default based on the compilation OS. Unfortunately, in that situation our code only really does the right thing for old RHEL releases. Our reporting is sub-par, too. This series makes it so more distributions get the right init script installed by default and improves reporting. Andrea Bolognani (2): configure: Improve --with-init-script=check configure: Add systemd detection to --with-init-script=check configure.ac | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.5.5

If we didn't find a match, either because we're cross compiling or because we're not building on RHEL, we won't install any init script. Make sure this is reported correctly in the configure summary. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index de5f430..4b92e85 100644 --- a/configure.ac +++ b/configure.ac @@ -647,10 +647,19 @@ case "$with_init_script" in none) ;; check) - if test "$cross_compiling" != yes && test -f /etc/redhat-release; then + if test "$cross_compiling" = yes + then + with_init_script=none + fi + if test "$with_init_script" = check && test -f /etc/redhat-release + then init_redhat=yes with_init_script=redhat fi + if test "$with_init_script" = check + then + with_init_script=none + fi ;; *) AC_MSG_ERROR([Unknown initscript flavour $with_init_script]) -- 2.5.5

On Thu, Apr 28, 2016 at 05:54:33PM +0200, Andrea Bolognani wrote:
If we didn't find a match, either because we're cross compiling or because we're not building on RHEL, we won't install any init script.
Make sure this is reported correctly in the configure summary. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
ACK
diff --git a/configure.ac b/configure.ac index de5f430..4b92e85 100644 --- a/configure.ac +++ b/configure.ac @@ -647,10 +647,19 @@ case "$with_init_script" in none) ;; check) - if test "$cross_compiling" != yes && test -f /etc/redhat-release; then + if test "$cross_compiling" = yes + then
We put "then" on the same line as "if" elsewhere in the file. Jan

On Fri, 2016-04-29 at 09:14 +0200, Ján Tomko wrote:
diff --git a/configure.ac b/configure.ac index de5f430..4b92e85 100644 --- a/configure.ac +++ b/configure.ac @@ -647,10 +647,19 @@ case "$with_init_script" in none) ;; check) - if test "$cross_compiling" != yes && test -f /etc/redhat-release; then + if test "$cross_compiling" = yes + then
We put "then" on the same line as "if" elsewhere in the file.
We actually seem to be using both... Having "then" on the same line is closer to what out C code looks like though, so agreed. I'll change it. -- Andrea Bolognani Software Engineer - Virtualization Team

Most distributions, including RHEL, have switched to systemd, so it makes sense for it to be the preferred choice. Our witness for the check is the presence of the /etc/systemd directory on the host. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 4b92e85..6c7afb1 100644 --- a/configure.ac +++ b/configure.ac @@ -651,6 +651,11 @@ case "$with_init_script" in then with_init_script=none fi + if test "$with_init_script" = check && test -d /etc/systemd + then + init_systemd=yes + with_init_script=systemd + fi if test "$with_init_script" = check && test -f /etc/redhat-release then init_redhat=yes -- 2.5.5

On Thu, Apr 28, 2016 at 05:54:34PM +0200, Andrea Bolognani wrote:
Most distributions, including RHEL, have switched to systemd, so it makes sense for it to be the preferred choice.
From "preferred choice" I would expect with_init_script=systemd is the default, but the patch actually does some checking.
Our witness for the check is the presence of the /etc/systemd directory on the host.
Very interesting, this directory actually exists on my Open-RC based Gentoo system.
--- configure.ac | 5 +++++ 1 file changed, 5 insertions(+)
ACK Jan

On Fri, Apr 29, 2016 at 09:24:19AM +0200, Ján Tomko wrote:
On Thu, Apr 28, 2016 at 05:54:34PM +0200, Andrea Bolognani wrote:
Most distributions, including RHEL, have switched to systemd, so it makes sense for it to be the preferred choice.
From "preferred choice" I would expect with_init_script=systemd is the default, but the patch actually does some checking.
Our witness for the check is the presence of the /etc/systemd directory on the host.
Very interesting, this directory actually exists on my Open-RC based Gentoo system.
That's because applications install their startup scripts there. Usually they install scripts for all init systems so that it works everywhere. I don't know where we use this but it seems weird that we need to know which ones to use. If we still need to know then I would expect us to rather check either 'type systemctl' or 'mount -t cgroup | grep name=systemd' or something like that.
--- configure.ac | 5 +++++ 1 file changed, 5 insertions(+)
ACK
Jan
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (3)
-
Andrea Bolognani
-
Ján Tomko
-
Martin Kletzander