[libvirt] [PATCH] Don't install sysctl file on non-Linux hosts

From: "Daniel P. Berrange" <berrange@redhat.com> * configure.ac: Set WITH_SYSCTL only on Linux hosts * daemon/Makefile.am: Conditionalize install-sysctl using WITH_SYSCTL Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Cc: Jason Helfman <jhelfman@e-e.com> --- configure.ac | 25 +++++++++++++++++++++++++ daemon/Makefile.am | 5 +++++ 2 files changed, 30 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 0e83019..3f5b3ff 100644 --- a/configure.ac +++ b/configure.ac @@ -403,6 +403,31 @@ AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_UPSTART], test "$init_upstart" = "yes") AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes") AC_MSG_RESULT($with_init_script) + +AC_MSG_CHECKING([for whether to install sysctl config]) +AC_ARG_WITH([sysctl], + [AC_HELP_STRING([--with-sysctl@<:@=yes/no@:>@], + [Whether to install sysctl configs @<:@default=auto@:>@])], + [],[with_sysctl=check]) + +if test "$with_sysctl" = "yes" || test "$with_sysctl" = "check" +then + case $host in + *-*-linux*) + with_sysctl=yes + ;; + **) + if test "$with_sysctl" = "yes"; then + AC_MSG_ERROR([No sysctl configuration supported for $host]) + else + with_sysctl=no + fi + ;; + esac +fi +AM_CONDITIONAL([WITH_SYSCTL], test "$with_sysctl" = "yes") +AC_MSG_RESULT($with_sysctl) + dnl RHEL-5 has a peculiar version of Xen, which requires some special casing AC_ARG_WITH([rhel5-api], [AC_HELP_STRING([--with-rhel5-api=@<:@ARG@:>@], diff --git a/daemon/Makefile.am b/daemon/Makefile.am index db4abf5..391cd99 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -256,6 +256,7 @@ uninstall-sysconfig: rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd rmdir $(DESTDIR)$(sysconfdir)/sysconfig || : +if WITH_SYSCTL install-sysctl: $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysctl.d $(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \ @@ -264,6 +265,10 @@ install-sysctl: uninstall-sysctl: rm -f $(DESTDIR)$(sysconfdir)/sysctl.d/libvirtd rmdir $(DESTDIR)$(sysconfdir)/sysctl.d || : +else +install-sysctl: +uninstall-sysctl: +endif if LIBVIRT_INIT_SCRIPT_RED_HAT -- 1.7.7.6

On Wed, Apr 04, 2012 at 11:17:35 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
* configure.ac: Set WITH_SYSCTL only on Linux hosts * daemon/Makefile.am: Conditionalize install-sysctl using WITH_SYSCTL
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Cc: Jason Helfman <jhelfman@e-e.com> --- configure.ac | 25 +++++++++++++++++++++++++ daemon/Makefile.am | 5 +++++ 2 files changed, 30 insertions(+), 0 deletions(-)
ACK Jirka

On Wed, Apr 04, 2012 at 02:44:40PM +0200, Jiri Denemark thus spake:
On Wed, Apr 04, 2012 at 11:17:35 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
* configure.ac: Set WITH_SYSCTL only on Linux hosts * daemon/Makefile.am: Conditionalize install-sysctl using WITH_SYSCTL
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Cc: Jason Helfman <jhelfman@e-e.com> --- configure.ac | 25 +++++++++++++++++++++++++ daemon/Makefile.am | 5 +++++ 2 files changed, 30 insertions(+), 0 deletions(-)
ACK
Jirka
Thanks! This is slightly off-topic, but on-topic, as well. At FreeBSD, we don't unconditionally add variables to sysctl.conf, but rather suggest variables to be added in a post-install message on packages and ports for the operator to employ at their discretion. Either way, having the ability to turn on and off, is nice. Thanks again, Daniel! -jgh -- Jason Helfman System Administrator experts-exchange.com http://www.experts-exchange.com/M_4830110.html E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5
participants (3)
-
Daniel P. Berrange
-
Jason Helfman
-
Jiri Denemark