URL: https://github.com/SSSD/sssd/pull/47
Author: jhrozek
 Title: #47: BUILD: Fix build without /sbin/service installed on the build host
Action: synchronized

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/47/head:pr47
git checkout pr47
From ece168576cad2dded3bb7a506b2ade05677120ec Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Tue, 11 Oct 2016 20:41:02 +0200
Subject: [PATCH 1/4] BUILD: Not having /sbin/service is not fatal

If the target platform does not have the service executable, we must not
fail the build, but proceed, just disabling the sssctl functionality.
---
 src/external/service.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/external/service.m4 b/src/external/service.m4
index f475f26..709c204 100644
--- a/src/external/service.m4
+++ b/src/external/service.m4
@@ -7,7 +7,7 @@ AC_DEFUN([CHECK_SERVICE_EXECUTABLE],
         AC_MSG_RESULT(yes)
       else
         AC_MSG_RESULT([no])
-        AC_MSG_ERROR([the service executable is not available])
+        AC_MSG_WARN([the service executable is not available])
       fi
     ]
 )

From 7cb08671ee9abe6a64d28e2292944a3f72dc55bd Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Tue, 11 Oct 2016 20:48:44 +0200
Subject: [PATCH 2/4] RPM: Require initscripts on non-systemd platforms

In order for sssctl to work on platforms that do not use systemd, we
need to BuildRequire initscripts so that they are pulled in during build
and also Require them for sssd-tools so that the binary can be invoked.
---
 contrib/sssd.spec.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 40e4454..591e0c9 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -197,7 +197,6 @@ BuildRequires: nss_wrapper
 BuildRequires: libnl3-devel
 %if (0%{?use_systemd} == 1)
 BuildRequires: systemd-devel
-%endif
 %if (0%{?with_cifs_utils_plugin} == 1)
 BuildRequires: cifs-utils-devel
 %endif
@@ -296,6 +295,9 @@ Requires: python3-sssdconfig = %{version}-%{release}
 Requires: python2-sss = %{version}-%{release}
 Requires: python2-sssdconfig = %{version}-%{release}
 %endif
+%if (0%{?use_systemd} == 0)
+Requires: /sbin/service
+%endif
 
 %description tools
 Provides userspace tools for manipulating users, groups, and nested groups in

From 50f6909270ed53b3cb92b468c0dc23f6820e82eb Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Thu, 13 Oct 2016 13:39:37 +0200
Subject: [PATCH 3/4] sssctl: Fix a typo in preprocessor macro

---
 src/tools/sssctl/sssctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/sssctl/sssctl.c b/src/tools/sssctl/sssctl.c
index 1035a73..b0510e6 100644
--- a/src/tools/sssctl/sssctl.c
+++ b/src/tools/sssctl/sssctl.c
@@ -128,7 +128,7 @@ static errno_t sssctl_manage_service(enum sssctl_svc_action action)
     case SSSCTL_SVC_RESTART:
         return sssctl_systemd_restart();
     }
-#elif HAVE_SERVICE
+#elif defined(HAVE_SERVICE)
     switch (action) {
     case SSSCTL_SVC_START:
         return sssctl_run_command(SERVICE_PATH" sssd start");

From d297f01ec743948d02e4227685c7a871cbeb2d56 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhro...@redhat.com>
Date: Fri, 14 Oct 2016 10:54:24 +0200
Subject: [PATCH 4/4] BUILD: Only search for service in /sbin and /usr/sbin

---
 src/external/service.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/external/service.m4 b/src/external/service.m4
index 709c204..b69760f 100644
--- a/src/external/service.m4
+++ b/src/external/service.m4
@@ -1,5 +1,5 @@
 AC_DEFUN([CHECK_SERVICE_EXECUTABLE],
-    [ AC_PATH_PROG(SERVICE, service)
+    [ AC_PATH_PROG([SERVICE], [service], [], [/sbin:/usr/sbin])
       AC_MSG_CHECKING(for the executable \"service\")
       if test -x "$SERVICE"; then
         AC_DEFINE(HAVE_SERVICE, 1, [Whether the service command is available])
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to