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 c6a278b1b3ad032e078664a09a42cfcacc5d5a7c 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 | 5 +++++
 1 file changed, 5 insertions(+)

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

From 9a48a5a431be41b83097bb1e918d3f2c83f9e1c8 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 1e641bc172846d0f1353d06849cdc2342aee9d75 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