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