File 0001-Set-sys.bindir-to-usr-sbin-expect-cf-components-ther.patch of Package cfengine

From a3126babc502c7e79b866c3db04e92bd7cfa7bbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Thu, 30 Jul 2015 10:48:47 +0200
Subject: [PATCH 1/3] Set sys.bindir to /usr/sbin, expect cf-*components there

That's where the /var/cfengine/bin/* symlinks point to and where
the systemd .service files expect the daemons.

This path is used in 'processes' of
masterfiles/update/update_processes.cf:enable_cfengine_agents
---
 libenv/sysinfo.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libenv/sysinfo.c b/libenv/sysinfo.c
index 7c20d9263108..8bea42c7f7a7 100644
--- a/libenv/sysinfo.c
+++ b/libenv/sysinfo.c
@@ -589,8 +589,7 @@ static void GetNameInfo3(EvalContext *ctx)
     EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "masterdir", GetMasterDir(), CF_DATA_TYPE_STRING, "source=agent");
     EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "inputdir", GetInputDir(), CF_DATA_TYPE_STRING, "source=agent");
 
-    snprintf(workbuf, CF_BUFSIZE, "%s%cbin", workdir, FILE_SEPARATOR);
-    EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "bindir", workbuf, CF_DATA_TYPE_STRING, "source=agent");
+    EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "bindir", "/usr/sbin", CF_DATA_TYPE_STRING, "source=agent");
 
     snprintf(workbuf, CF_BUFSIZE, "%s%cfailsafe.cf", GetInputDir(), FILE_SEPARATOR);
     EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "failsafe_policy_path", workbuf, CF_DATA_TYPE_STRING, "source=agent");
@@ -635,7 +634,7 @@ static void GetNameInfo3(EvalContext *ctx)
                      components[i]);
         }
 #else
-        snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s", workdir, FILE_SEPARATOR, FILE_SEPARATOR, components[i]);
+        snprintf(name, CF_MAXVARSIZE - 1, "/usr/sbin/%s", components[i]);
 #endif
 
         have_component[i] = false;
@@ -660,7 +659,7 @@ static void GetNameInfo3(EvalContext *ctx)
         snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s.exe", workdir, FILE_SEPARATOR, FILE_SEPARATOR,
                  components[1]);
 #else
-        snprintf(name, CF_MAXVARSIZE - 1, "%s%cbin%c%s", workdir, FILE_SEPARATOR, FILE_SEPARATOR, components[1]);
+        snprintf(name, CF_MAXVARSIZE - 1, "/usr/sbin/%s", components[1]);
 #endif
 
         if (stat(name, &sb) != -1)
-- 
2.15.0