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