From c6b8babacd15f2f2cc578ea72ec341f2827b85d1 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 25 Sep 2007 11:41:20 +0000
Subject: [PATCH] Add configure option for init.d/ssh script. This is useful
 for distributions with the script named differently than Debian.

Reviewed-by: ultrotter
---
 configure.ac    | 9 +++++++++
 lib/Makefile.am | 3 +++
 lib/backend.py  | 3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 64fa9a1b1..589271c1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,15 @@ AC_INIT(ganeti, 1.2b2, ganeti@googlegroups.com)
 AC_CONFIG_AUX_DIR(autotools)
 AM_INIT_AUTOMAKE([foreign tar-ustar])
 
+# --with-ssh-initscript=...
+AC_ARG_WITH([ssh-initscript],
+  [AS_HELP_STRING([--with-ssh-initscript],
+    [SSH init script to use (default is /etc/init.d/ssh)]
+  )],
+  [initd_ssh="$withval"],
+  [initd_ssh="/etc/init.d/ssh"])
+AC_SUBST(INITD_SSH, $initd_ssh)
+
 # Check common programs
 AC_PROG_INSTALL
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c32cf6eeb..c4e4fcd03 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,7 @@
 CLEANFILES = $(nodist_pkgpython_PYTHON) *.py[oc]
 
+INITD_SSH = @INITD_SSH@
+
 nodist_pkgpython_PYTHON = _autoconf.py
 pkgpython_PYTHON = __init__.py backend.py cli.py cmdlib.py config.py \
 	objects.py errors.py logger.py ssh.py utils.py rpc.py \
@@ -13,4 +15,5 @@ _autoconf.py: Makefile
 	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
 	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
 	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
+	  echo "INITD_SSH = '$(INITD_SSH)'"; \
 	} > $@
diff --git a/lib/backend.py b/lib/backend.py
index 24374d344..33daa2327 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -41,6 +41,7 @@ from ganeti import constants
 from ganeti import bdev
 from ganeti import objects
 from ganeti import ssconf
+from ganeti import _autoconf
 
 
 def StartMaster():
@@ -120,7 +121,7 @@ def AddNode(dsa, dsapub, rsa, rsapub, sshkey, sshpub):
   finally:
     f.close()
 
-  utils.RunCmd(["/etc/init.d/ssh", "restart"])
+  utils.RunCmd([_autoconf.INITD_SSH, "restart"])
 
   return True
 
-- 
GitLab