- fix version number, bump release number, added changelog
[myplc.git] / myplc.spec
1 Vendor: PlanetLab
2 Packager: PlanetLab Central <support@planet-lab.org>
3 Distribution: PlanetLab 4.0
4 URL: http://cvs.planet-lab.org/cvs/myplc
5
6 Summary: PlanetLab Central (PLC) Portable Installation
7 Name: myplc
8 Version: 0.4
9 Release: 3%{?pldistro:.%{pldistro}}%{?date:.%{date}}
10 License: PlanetLab
11 Group: Applications/Systems
12 Source0: %{name}-%{version}.tar.gz
13 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
14
15 # for preventing myplc-devel from being built
16 # *should* support invokation like rpmbuild --define "build_level 0" 
17 # *but* this does not seem to work : so just set to 0 here
18 %{!?build_level: %define build_devel 1}
19
20 %define debug_package %{nil}
21
22 %description
23 MyPLC is a complete PlanetLab Central (PLC) portable installation
24 contained within a chroot jail. The default installation consists of a
25 web server, an XML-RPC API server, a boot server, and a database
26 server: the core components of PLC. The installation may be customized
27 through a graphical interface. All PLC services are started up and
28 shut down through a single System V init script installed in the host
29 system.
30
31 %if %{build_devel}
32 %package devel
33 Summary: PlanetLab Central (PLC) Development Environment
34 Group: Development/Tools
35 AutoReqProv: no
36 %endif
37
38 %if %{build_devel}
39 %description devel
40 This package install a complete PlanetLab development environment
41 contained within a chroot jail. The default installation consists of a
42 local CVS repository bootstrapped with a snapshot of all PlanetLab
43 source code, and all the tools necessary to compile it.
44 %endif
45
46 %prep
47 %setup -q
48
49 %build
50 pushd myplc
51 %if %{build_devel}
52 echo -n "XXXXXXXXXXXXXXX myplc::build_devel " ; date
53 ./build_devel.sh %{?cvstag:-t %{cvstag}}
54 %endif
55 echo -n "XXXXXXXXXXXXXXX myplc::build " ; date
56 ./build.sh %{?cvstag:-t %{cvstag}}
57 echo -n "XXXXXXXXXXXXXXX myplc::endbuild " ; date
58 popd
59
60 %install
61 rm -rf $RPM_BUILD_ROOT
62
63 pushd myplc
64
65 #
66 # myplc
67 #
68
69 # Install host startup script and configuration file
70 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
71 install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
72
73 # Create convenient symlink
74 install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}
75 ln -sf /plc/data/etc/planetlab $RPM_BUILD_ROOT/%{_sysconfdir}/planetlab
76
77 # Install root filesystem
78 install -d -m 755 $RPM_BUILD_ROOT/plc/root
79 install -D -m 644 root.img $RPM_BUILD_ROOT/plc/root.img
80
81 # Install data directory
82 find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
83
84 #
85 # myplc-devel
86 #
87
88 %if %{build_devel}
89
90 # Install host startup script and configuration file
91 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc-devel
92 install -D -m 644 plc-devel.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc-devel
93
94 # Install root filesystem
95 install -d -m 755 $RPM_BUILD_ROOT/plc/devel/root
96 install -D -m 644 devel/root.img $RPM_BUILD_ROOT/plc/devel/root.img
97
98 # Install data directory
99 find devel/data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
100
101 # Make sure /cvs is never upgraded once installed by giving it a
102 # unique name. A hard-linked copy is made in %post.
103 mv $RPM_BUILD_ROOT/plc/devel/data/{cvs,cvs-%{version}-%{release}}
104
105 %endif
106
107 popd
108
109 %clean
110 rm -rf $RPM_BUILD_ROOT
111
112 # If run under sudo
113 if [ -n "$SUDO_USER" ] ; then
114     # Allow user to delete the build directory
115     chown -R $SUDO_USER .
116     # Some temporary cdroot files like /var/empty/sshd and
117     # /usr/bin/sudo get created with non-readable permissions.
118     find . -not -perm +0600 -exec chmod u+rw {} \;
119     # Allow user to delete the built RPM(s)
120     chown -R $SUDO_USER %{_rpmdir}/%{_arch}
121 fi
122
123 %pre
124 if [ -x %{_sysconfdir}/init.d/plc ] ; then
125     %{_sysconfdir}/init.d/plc stop
126 fi
127
128 # Old versions of myplc used to ship with a bootstrapped database and
129 # /etc/planetlab directory. Including generated files in the manifest
130 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
131 # names from one RPM build to another, it would be rpmsaved and thus
132 # effectively deleted. Now we do not include these files in the
133 # manifest. However, to avoid deleting these files in the process of
134 # upgrading from one of these old versions of myplc, we must back up
135 # the database and /etc/planetlab and restore them after the old
136 # version has been uninstalled in %triggerpostun (also in %post, in
137 # case we are force upgrading to the same version).
138 #
139 # This code can be removed once all myplc-0.4-1 installations have
140 # been upgraded to at least myplc-0.4-2.
141
142 # 0 = install, 1 = upgrade
143 if [ $1 -gt 0 ] ; then
144     for dir in /var/lib/pgsql/data /etc/planetlab ; do
145         if [ -d /plc/data/$dir ] ; then
146             echo "Preserving /plc/data/$dir"
147             mkdir -p /plc/data/$dir.rpmsave
148             tar -C /plc/data/$dir -cpf - . | \
149                tar -C /plc/data/$dir.rpmsave -xpf -
150
151             # Except for the default configuration file and DTD, which
152             # really should be considered for upgrade.
153             rm -f /plc/data/$dir.rpmsave/{default_config.xml,plc_config.dtd}
154         fi
155     done
156 fi
157
158 %post
159 if [ -x /sbin/chkconfig ] ; then
160     /sbin/chkconfig --add plc
161     /sbin/chkconfig plc on
162 fi
163
164 %triggerpostun -- %{name}
165 # 0 = erase, 1 = upgrade
166 if [ $1 -gt 0 ] ; then
167     for dir in /var/lib/pgsql/data /etc/planetlab ; do
168         if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
169             echo "Merging /plc/data/$dir"
170             if tar -C /plc/data/$dir.rpmsave -cpf - . | \
171                tar -C /plc/data/$dir -xpf - ; then
172                 rm -rf /plc/data/$dir.rpmsave
173             fi
174         fi
175     done
176 fi    
177
178 %preun
179 # 0 = erase, 1 = upgrade
180 if [ $1 -eq 0 ] ; then
181     %{_sysconfdir}/init.d/plc stop
182     if [ -x /sbin/chkconfig ] ; then
183         /sbin/chkconfig plc off
184         /sbin/chkconfig --del plc
185     fi
186 fi
187
188 %if %{build_devel}
189 %pre devel
190 if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then
191     %{_sysconfdir}/init.d/plc-devel stop
192 fi
193 %endif
194
195 %if %{build_devel}
196 %post devel
197 if [ -x /sbin/chkconfig ] ; then
198     /sbin/chkconfig --add plc-devel
199     /sbin/chkconfig plc-devel on
200 fi
201
202 # If /cvs does not already exist, make a hard-linked copy of this
203 # version's /cvs repository.
204 if [ ! -d /plc/devel/data/cvs ] ; then
205     cp -rl /plc/devel/data/{cvs-%{version}-%{release},cvs}
206 fi
207 %endif
208
209 %if %{build_devel}
210 %preun devel
211 # 0 = erase, 1 = upgrade
212 if [ $1 -eq 0 ] ; then
213     %{_sysconfdir}/init.d/plc-devel stop
214     if [ -x /sbin/chkconfig ] ; then
215         /sbin/chkconfig plc-devel off
216         /sbin/chkconfig --del plc-devel
217     fi
218 fi
219 %endif
220
221 %files
222 %defattr(-,root,root,-)
223 # Host startup script and configuration file
224 %{_sysconfdir}/init.d/plc
225 %{_sysconfdir}/sysconfig/plc
226
227 # Symlink to /etc/planetlab within data directory
228 %{_sysconfdir}/planetlab
229
230 # Root filesystem
231 /plc/root.img
232 /plc/root
233
234 # Data directory
235 %dir /plc/data
236 %config(noreplace) /plc/data/*
237
238 %if %{build_devel}
239 %files devel
240 %defattr(-,root,root,-)
241 # Host startup script and configuration file
242 %{_sysconfdir}/init.d/plc-devel
243 %{_sysconfdir}/sysconfig/plc-devel
244
245 # Root filesystem
246 /plc/devel/root.img
247 /plc/devel/root
248
249 # Data directory
250 %dir /plc/devel/data
251 %config(noreplace) /plc/devel/data/*
252 %endif
253
254 %changelog
255 * Tue Aug 22 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-3, 0.5-3
256 - MyPLC 0.4 RC3.
257 - Fix upgrade path from RC1.
258 - Always regenerate plc_config.xml at first startup
259 - Upgrade kernel, iptables, vnet to 2.6.17-1.2142_FC4-3.planetlab
260 - Minor PlanetFlow fixes
261 - pl_mom/swapmon: Minor fixes
262 - bootcd: Added Supermicro IPMI support
263 - bootmanager: Cleanup, fixed check for new disks
264
265 * Wed Aug 09 2006 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
266 - introduces variable %{build_devel} to allow custom sites to skip building
267   the myplc-devel package.
268
269 * Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
270 - MyPLC 0.4 RC2.
271 - Fix many spec files (License replaces Copyright).
272 - Fix kernel build under gcc32 (module verification bug).
273 - Fix vnet build under gcc32
274 - Fix PlanetFlow. MySQL RPM postinstall script no longer starts the
275   server. Also, get hostnames list from PLC_WWW_HOST, not
276   www.planet-lab.org.
277 - Fix pl_mom/bwmon to use cached values if NM is unresponsive
278 - Fix pl_mom/swapmon reset logic to avoid endless loops
279 - Remove ksymoops, add kernel-smp to standard PlanetLab package group
280 - Add kernel-smp boot support to bootmanager
281 - Add badblock search support to bootmanager
282 - Build development environment (myplc-devel). Add support for
283   building myplc itself inside myplc-devel.
284 - Move step-specific initialization to appropriate plc.d scripts
285 - Fix postgresql startup failure when bootstrapping
286 - Allow CA to be configured for each SSL certificate set. Stop doing
287   root CA stuff, this is outside the scope of MyPLC. MyPLC now only
288   generates self-signed certificates, but supports replacement of the
289   self-signed certificates with real certifcates signed by another CA,
290   as long as the CA is specified.
291 - Self-sign the MA/SA SSL certificate (and by extension, the MA/SA API
292   certificate).
293 - pl_mom: Workarounds for when NM queries time out.
294 - plc_api: Honor PLC_MAIL_ENABLED.
295
296 * Wed Jul  6 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-1, 0.5-1
297 - First stable release of MyPLC 0.4 RC1.
298
299 * Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
300 - Basic functionality complete. Consolidate into a single package
301   installed in /plc.
302
303 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
304 - Initial build.
305