From 201b6c34c245ce0ad7d60240212f068755d01e72 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 8 Jul 2011 11:41:01 +0200
Subject: [PATCH] htools: switch hbal to the generic binary

In addition, the patch adds a separate Makefile variable for holding
the binary roles to make it more clear what we symlink.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 .gitignore                                        | 1 -
 Makefile.am                                       | 7 ++++++-
 htools/{hbal.hs => Ganeti/HTools/Program/Hbal.hs} | 2 +-
 htools/htools.hs                                  | 2 ++
 4 files changed, 9 insertions(+), 3 deletions(-)
 rename htools/{hbal.hs => Ganeti/HTools/Program/Hbal.hs} (99%)

diff --git a/.gitignore b/.gitignore
index a2ef1c0dd..fa3b3d73b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -98,7 +98,6 @@
 /htools/.hpc
 /htools/coverage
 
-/htools/hbal
 /htools/hscan
 /htools/hspace
 /htools/htools
diff --git a/Makefile.am b/Makefile.am
index 9c7a33a55..c60eccc59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -307,10 +307,10 @@ docrst = \
 	doc/walkthrough.rst
 
 HS_PROGS = \
-	htools/hbal \
 	htools/hscan \
 	htools/hspace \
 	htools/htools
+HS_BIN_ROLES = hbal
 
 HS_ALL_PROGS = $(HS_PROGS) htools/test
 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
@@ -343,6 +343,7 @@ HS_LIB_SRCS = \
 	htools/Ganeti/HTools/Types.hs \
 	htools/Ganeti/HTools/Utils.hs \
 	htools/Ganeti/HTools/Program/Hail.hs \
+	htools/Ganeti/HTools/Program/Hbal.hs \
 	htools/Ganeti/Jobs.hs \
 	htools/Ganeti/Luxi.hs \
 	htools/Ganeti/OpCodes.hs
@@ -455,6 +456,10 @@ install-exec-hook:
 	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
 	$(LN_S) -f $(DESTDIR)$(bindir)/htools \
 		   $(DESTDIR)$(iallocatorsdir)/hail
+	for role in $(HS_BIN_ROLES); do \
+		$(LN_S) -f $(DESTDIR)$(bindir)/htools \
+			   $(DESTDIR)$(bindir)/$$role ; \
+	done
 endif
 
 $(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
diff --git a/htools/hbal.hs b/htools/Ganeti/HTools/Program/Hbal.hs
similarity index 99%
rename from htools/hbal.hs
rename to htools/Ganeti/HTools/Program/Hbal.hs
index 432dfe32c..63048f094 100644
--- a/htools/hbal.hs
+++ b/htools/Ganeti/HTools/Program/Hbal.hs
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
 -}
 
-module Main (main) where
+module Ganeti.HTools.Program.Hbal (main) where
 
 import Control.Concurrent (threadDelay)
 import Control.Exception (bracket)
diff --git a/htools/htools.hs b/htools/htools.hs
index 527e409f0..a2c2b4828 100644
--- a/htools/htools.hs
+++ b/htools/htools.hs
@@ -31,10 +31,12 @@ import System.IO
 
 import Ganeti.HTools.Utils
 import qualified Ganeti.HTools.Program.Hail as Hail
+import qualified Ganeti.HTools.Program.Hbal as Hbal
 
 -- | Supported binaries.
 personalities :: [(String, IO ())]
 personalities = [ ("hail", Hail.main)
+                , ("hbal", Hbal.main)
                 ]
 
 -- | Display usage and exit.
-- 
GitLab