06d71902f56169e38743ace6863b066ba0ed1186
[packages/precise/mcollective.git] / ext / solaris / build
1 #!/opt/csw/bin/gmake -f -d
2 # -*- makefile -*-
3
4 BUILDDIR = solaris/tmp
5 PKG = solaris/pkg
6 DESTDIR = ${CURDIR}/${BUILDDIR}
7 PKGDIR = ${CURDIR}/${PKG}
8 PKGNAME = CSWmcollective
9 VERSION = $(shell cd ../.. ; RUBYLIB=./lib /opt/csw/bin/ruby18 -r mcollective -e 'puts MCollective::VERSION' )
10 # If we checked out from git:
11 ifeq ($(VERSION),@DEVELOPMENT_VERSION@)
12         VERSION = $(shell ggrep "PROJ_VERSION = "  ../../Rakefile | cut -d' ' -f3 | sed -e 's/"//g')
13 endif
14 RELEASE = 1
15 PKGVERSION = ${VERSION}-${RELEASE}\,REV=$(shell date +%Y.%m.%d)
16 RUBY_VERSION = 1.8
17 RUBY_SITE = ${DESTDIR}/opt/csw/lib/ruby/site_ruby/${RUBY_VERSION}
18
19 install:
20         # install directories
21         ginstall -d $(DESTDIR)
22         ginstall -g root -d $(DESTDIR)/opt
23         ginstall -g sys -d $(DESTDIR)/var $(DESTDIR)/var/lock  $(DESTDIR)/etc $(DESTDIR)/etc/opt
24         ginstall -g bin -d $(DESTDIR)/var/opt $(DESTDIR)/var/opt/csw $(DESTDIR)/var/opt/csw/svc $(DESTDIR)/var/opt/csw/svc/manifest $(DESTDIR)/var/opt/csw/svc/manifest/network
25         ginstall -g bin -d $(DESTDIR)/opt/csw/lib $(DESTDIR)/opt/csw/lib/svc $(DESTDIR)/opt/csw/lib/svc/method
26         ginstall -g bin -d $(DESTDIR)/opt/csw $(DESTDIR)/opt/csw/lib $(DESTDIR)/opt/csw/sbin $(DESTDIR)/opt/csw/bin
27         ginstall -g bin -d $(DESTDIR)/opt/csw/lib/ruby $(DESTDIR)/opt/csw/lib/ruby/site_ruby $(DESTDIR)/opt/csw/lib/ruby/site_ruby/$(RUBY_VERSION)
28         ginstall -g bin -d $(DESTDIR)/etc/opt/csw $(DESTDIR)/etc/opt/csw/mcollective
29         ginstall -g bin -d $(DESTDIR)/opt/csw/share $(DESTDIR)/opt/csw/share/mcollective
30
31         # install binaries
32         ginstall -g bin $(CURDIR)/../../bin/mc-* $(DESTDIR)/opt/csw/sbin/
33         ginstall -g bin $(CURDIR)/../../bin/mco $(DESTDIR)/opt/csw/sbin/
34         ginstall -g bin $(CURDIR)/../../bin/mcollectived $(DESTDIR)/opt/csw/sbin/mcollectived
35         # install libraries
36         gcp -a $(CURDIR)/../../lib/* $(RUBY_SITE)/
37         chgrp -R bin $(RUBY_SITE)/
38         # install example config files
39         gcp -a $(CURDIR)/../../etc/* $(DESTDIR)/etc/opt/csw/mcollective/
40         grm $(DESTDIR)/etc/opt/csw/mcollective/ssl/PLACEHOLDER
41         grm $(DESTDIR)/etc/opt/csw/mcollective/ssl/clients/PLACEHOLDER
42         chgrp -R bin $(DESTDIR)/etc/opt/csw/mcollective/
43         # install plugins
44         gcp -a $(CURDIR)/../../plugins $(DESTDIR)/opt/csw/share/mcollective/
45         # install docs 
46         #ginstall -d $(DESTDIR)/opt/csw/doc $(DESTDIR)/opt/csw/doc/mcollective/
47         #gcp -a $(CURDIR)/../../doc/  $(DESTDIR)/opt/cs/doc/mcollective
48
49         ginstall -g bin $(CURDIR)/mcollective.init $(DESTDIR)/opt/csw/lib/svc/method/svc-cswmcollectived
50         ginstall -g bin $(CURDIR)/cswmcollectived.xml $(DESTDIR)/var/opt/csw/svc/manifest/network
51
52         (cat prototype.head; pkgproto $(DESTDIR)=/ ) > solaris/prototype
53         mkdir $(PKGDIR) || true
54         ginstall postinstall solaris/
55         ginstall postremove solaris/
56         ginstall preremove solaris/
57
58         ginstall pkginfo solaris/
59         (echo PKG=${PKGNAME} ) >> solaris/pkginfo
60         (echo VERSION=${PKGVERSION} ) >> solaris/pkginfo
61         (cd solaris/ ; pkgmk -o -d $(PKGDIR))
62         pkgtrans -s $(PKGDIR) $(CURDIR)/$(PKGNAME)-$(PKGVERSION)-`uname -s``uname -r`-all-CSW.pkg $(PKGNAME)
63
64 clean:
65         grm -rf $(DESTDIR)
66         grm -rf $(PKGDIR)
67         grm -f solaris/prototype
68         grm -f $(PKGNAME)-$(SOLARIS_VERSION)-`uname -s``uname -r`-all-CSW.pkg