From c4e5d11ebd8831169b0adf11f8e562c1e742e179 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Nov 2011 12:19:22 +0100
Subject: [PATCH] Adapt daemon-util to ENABLE_CONFD

We still allow explicit shutdown of confd, but we prevent manual
or automatic start-up.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 daemons/daemon-util.in | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
index 819fd6bb5..04ddc25c5 100644
--- a/daemons/daemon-util.in
+++ b/daemons/daemon-util.in
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 
-# Copyright (C) 2009 Google Inc.
+# Copyright (C) 2009, 2011 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,9 +29,12 @@ DAEMONS=(
   ganeti-noded
   ganeti-masterd
   ganeti-rapi
-  ganeti-confd
   )
 
+if [[ "@CUSTOM_ENABLE_CONFD@" == True ]]; then
+  DAEMONS+=( ganeti-confd )
+fi
+
 NODED_ARGS=
 MASTERD_ARGS=
 CONFD_ARGS=
@@ -163,6 +166,12 @@ start() {
 
   local name="$1"; shift
 
+  if [[ "$name" == ganeti-confd &&
+        "@CUSTOM_ENABLE_CONFD@" == False ]]; then
+    echo 'ganeti-confd disabled at build time' >&2
+    return 1
+  fi
+
   # Convert daemon name to uppercase after removing "ganeti-" prefix
   local plain_name=${name#ganeti-}
   local ucname=$(tr a-z A-Z <<<$plain_name)
-- 
GitLab