summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2008-10-14 17:25:02 +1100
committerMartin Schwenke <martin@meltin.net>2008-10-14 17:25:02 +1100
commit7222bcb6ac05a872bc31a9483bf83865811a0df0 (patch)
treef4eff5e4879cfd788bff783dc9c9408076618ace /Makefile
parent86f11ca93bbc4a96f651ddff142a0e06ec7ce514 (diff)
downloadautocluster-7222bcb6ac05a872bc31a9483bf83865811a0df0.tar.gz
autocluster-7222bcb6ac05a872bc31a9483bf83865811a0df0.tar.xz
autocluster-7222bcb6ac05a872bc31a9483bf83865811a0df0.zip
Add --with-release option to allow kickstart and yum templates to be
specified in one fell swoop. Add releases directory containing some config files to support this. Add Makefile to allow "make install" (also "make dist", generation of debian/changelog and autocluster.spec). Add RPM spec file template and debian subdirectory to allows building of packages. Add magic comments to main autocluster script to allow installation directory to be substituted. Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 46 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5b27907
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,46 @@
+version = 0.1.$$(date '+%Y%m%d')
+
+prefix = /usr/local
+datadir = ${prefix}/share/autocluster
+bindir = ${prefix}/bin
+DESTDIR =
+
+datas = base config.default config.sample host_setup imacros releases \
+ templates
+scripts = vircmd waitfor autocluster
+hacks = autocluster.hack
+docs = README examples
+genpkg = debian/changelog autocluster.spec
+
+all: $(hacks)
+
+autocluster.hack: autocluster
+ sed -e '/##BEGIN-INSTALLDIR-MAGIC##/i \
+installdir=$(datadir)' -e '/##BEGIN-INSTALLDIR-MAGIC##/,/##END-INSTALLDIR-MAGIC##/d' $< > $@
+
+install: all
+ mkdir -p $(DESTDIR)$(datadir)
+ cp -a $(datas) $(DESTDIR)$(datadir)/
+ mkdir -p $(DESTDIR)$(bindir)
+ install -m 755 vircmd waitfor $(DESTDIR)$(bindir)
+ install -m 755 autocluster.hack $(DESTDIR)$(bindir)/autocluster
+
+debian/changelog: debian/changelog.in
+ sed -e "s/@@DATE@@/$$(date '+%a, %e %b %Y %T %z')/" -e "s/@@VERSION@@/$(version)/" $< > $@ || rm -f $@
+
+autocluster.spec: autocluster.spec.in
+ sed -e "s/@@VERSION@@/$(version)/" $< > $@ || rm -f $@
+
+dist: $(genpkg)
+ here=$$PWD && \
+ foo=$$(mktemp -d) && \
+ t=autocluster-$(version) && \
+ mkdir -p $${foo}/$${t} && \
+ cp -a Makefile $(datas) $(scripts) $(docs) $(genpkg) $${foo}/$${t} && \
+ cd $${foo} && \
+ tar cz --exclude="*~" -f $${here}/$${t}.tar.gz $${t} && \
+ cd $${here} && \
+ rm -r $${foo}
+
+clean:
+ rm -f $(hacks) $(genpkg)