turn service off only when needed
[omf.git] / omf-resctl.spec
1 #
2 # $Id$
3 #
4 %define url $URL$
5
6 # Thierry Parmentelat - INRIA
7 # Copyright (C) 2010 INRIA
8 # License is GPL.
9
10 %define name omf-resctl
11 %define version 5.3
12 %define taglevel 4
13
14 %define plc_name %{name}-%{version}-%{taglevel}
15 %define actual_name omf-resctl-5.3-1ubuntu2-2
16
17 Summary: OMF Resource Controller - for slivers
18 Name: %{name}
19 Version: %{version}
20 Release: %{taglevel}
21 License: GPL
22 Group: System Environment/Base
23 Source0: %{plc_name}.tar.bz2
24 BuildRoot: %{_tmppath}/%{plc_name}-buildroot
25
26 Vendor: NICTA
27 Packager: PlanetLab <devel@planet-lab.org>
28 Distribution: %{pldistro} %{plrelease}
29 URL: %(echo %{url} | cut -d ' ' -f 2)
30 # BuildArch: noarch
31
32 Requires: pciutils  
33 Requires: ruby  
34 Requires: wget  
35 Requires: wireless-tools  
36 Requires: rpmlib(CompressedFileNames) <= 3.0.4-1
37 Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1
38
39 Requires: omf-common  
40 Requires: liblog4r
41 Requires: libxmpp4r
42 Requires: imagezip
43
44 %description 
45 The OMF Resource Controller (RC) is the experiment-side of the
46 Experiment Eontroller (EC) that lets experimenter control their
47 resources. It relies on an XMPP server for exchanging with its EC.
48
49 ####################
50 %define common_actual_name omf-common-5.3-1ubuntu3-2
51
52 %package -n omf-common
53 Summary: OMF common utilities 
54 Group: System Environment/Base
55 %description -n omf-common
56 Provides utilities common to various OMF components
57
58 ####################
59 %define liblog4r_actual_name liblog4r-ruby1.8-1.2-1
60
61 %package -n liblog4r
62 Summary:  A logging library for Ruby
63 Group: System Environment/Base
64 %description -n liblog4r
65 A logging library for Ruby, needed by OMF software
66
67 ####################
68 %define libxmpp4r_actual_name libxmpp4r-ruby1.8-1.0-1
69
70 %package -n libxmpp4r
71 Summary:  XMPP/Jabber library for Ruby
72 Group: System Environment/Base
73 %description -n libxmpp4r
74 An XMPP/Jabber library for Ruby, needed by OMF software
75
76 ####################
77 %define imagezip_actual_name imagezip-1.0.0-3
78
79 %package -n imagezip
80 Summary:  filesystem image compression tool from EMULAB
81 Group: System Environment/Base
82 %description -n imagezip
83 filesystem image compression tool from EMULAB
84
85 ####################
86
87 %prep
88 %setup -n %{plc_name}
89
90 %build
91 rm -rf $RPM_BUILD_ROOT
92
93 mkdir unwrap
94
95 make omf-resctl 
96 (cd unwrap; rpm2cpio ../%{actual_name}.noarch.rpm | cpio -diu)
97 make omf-common
98 (cd unwrap ; rpm2cpio ../%{common_actual_name}.noarch.rpm | cpio -diu)
99 make liblog4r 
100 (cd unwrap; rpm2cpio ../%{liblog4r_actual_name}.noarch.rpm | cpio -diu)
101 make libxmpp4r 
102 (cd unwrap; rpm2cpio ../%{libxmpp4r_actual_name}.noarch.rpm | cpio -diu)
103 make imagezip 
104 (cd unwrap; rpm2cpio ../%{imagezip_actual_name}.i386.rpm | cpio -diu)
105
106 # remove any default config if any
107 rm -f unwrap/etc/omf-resctl-%{version}/omf-resctl.yaml
108
109 # cleanup any svn sequels
110 find unwrap -type d -name .svn -print0 | xargs -0 rm -rf
111
112
113 %install
114 rm -fr $RPM_BUILD_ROOT
115
116 rsync -a unwrap/ $RPM_BUILD_ROOT
117
118 install -D -m 600 omf-resctl.yaml.in $RPM_BUILD_ROOT/etc/omf-resctl-%{version}/omf-resctl.yaml.in
119
120 %clean
121 rm -rf $RPM_BUILD_ROOT
122
123 ####################
124 %files
125 %defattr(-,root,root)
126 /etc
127 /usr/sbin
128 /usr/share/omf-resctl-%{version}
129 /usr/share/doc
130
131 #
132 %post
133 if [ -x /sbin/chkconfig ] ; then
134     /sbin/chkconfig --add omf-resctl-%{version}
135     /sbin/chkconfig omf-resctl-%{version} on
136     service omf-resctl-%{version} restart
137 fi
138
139 %preun
140 # 0 = erase, 1 = upgrade
141 if [ $1 -eq 0 ] ; then
142     service omf-resctl-%{version} stop
143     /sbin/chkconfig omf-resctl-%{version} off
144     /sbin/chkconfig --del omf-resctl-%{version}
145 fi
146
147 ####################
148 %files -n omf-common
149 %defattr(-,root,root)
150 /usr/share/omf-common-%{version}
151 /usr/share/doc/omf-common-%{version}
152
153 #
154 %post -n omf-common
155 ln -s /usr/bin/ruby /usr/bin/ruby1.8
156
157 ####################
158 %files -n liblog4r
159 %defattr(-,root,root)
160 /usr/lib/ruby/1.8/log4r.rb
161 /usr/lib/ruby/1.8/log4r
162 /usr/share/doc/liblog4r-ruby1.8
163
164 ####################
165 %files -n libxmpp4r
166 %defattr(-,root,root)
167 /usr/lib/ruby/1.8/xmpp4r.rb
168 /usr/lib/ruby/1.8/xmpp4r
169 /usr/share/doc/libxmpp4r-ruby1.8
170
171 ####################
172 %files -n imagezip
173 %defattr(-,root,root)
174 /usr/bin/imagedump
175 /usr/bin/imageunzip
176 /usr/bin/imagezip
177 /usr/share/doc/imagezip
178
179 ####################
180 %changelog
181 * Tue May 25 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - omf-5.3-4
182 - fix stupid typo in tag 5.3-3
183
184 * Tue May 25 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - omf-5.3-3
185 - fetch from the tagged omf-5.3-federation-v1.1 - and turn SHA1SUM checking back on again
186
187 * Fri Apr 02 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - omf-5.3-2
188 - package the exp. controller as well for user convenience
189