Make it easier to have deployment-specific db-config additions.
[myplc.git] / myplc-native.spec
1 #
2 # $Id$
3 #
4 %define url $URL$
5
6 %define name myplc-native
7 %define version 4.2
8 %define taglevel 18
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 BuildArch: noarch
21
22 Vendor: PlanetLab
23 Packager: PlanetLab Central <support@planet-lab.org>
24 Distribution: PlanetLab %{plrelease}
25 URL: %(echo %{url} | cut -d ' ' -f 2)
26
27 Requires: bzip2
28 Requires: sendmail-cf
29 Requires: tar 
30 Requires: less
31 Requires: perl-GD
32 Requires: openssl
33 Requires: xmlsec1
34 Requires: gd
35 Requires: expect
36 Requires: php-pgsql
37 Requires: curl
38 Requires: python-pycurl
39 Requires: python-psycopg2
40 Requires: httpd
41 Requires: rsync
42 Requires: mod_python
43 Requires: mod_ssl
44 Requires: bootmanager
45 Requires: python-devel
46 Requires: SOAPpy
47 Requires: vixie-cron
48 Requires: yum
49 Requires: php-gd
50 Requires: PyXML
51 Requires: sendmail
52 Requires: python >= 2.4
53 Requires: createrepo
54 Requires: postgresql-python
55 Requires: cpio
56 Requires: postgresql-server
57 Requires: wget
58 Requires: php
59 Requires: xmlsec1-openssl
60 Requires: postgresql
61 Requires: openssh
62 Requires: bootcd-%{pldistro}-%{_arch}
63 Requires: dnsmasq
64 Requires: diffutils
65 Requires: gzip
66 Requires: vim-minimal
67 Requires: findutils
68 # planetlab stuff
69 Requires: PLCWWW
70 Requires: nodeconfig
71 Requires: PLCAPI
72 Requires: bootstrapfs-%{pldistro}-%{_arch}
73 Requires: myplc-docs
74
75 # argh - ugly - we might wish to use something from build/config.%{pldistro} instead
76 %if "%{pldistro}" == "onelab"
77 Requires: dummynet_image
78 %endif
79
80 Provides: myplc
81
82 %define debug_package %{nil}
83
84 %description
85 MyPLC is a complete PlanetLab Central (PLC) portable installation
86 contained within a chroot jail. The default installation consists of a
87 web server, an XML-RPC API server, a boot server, and a database
88 server: the core components of PLC. The installation may be customized
89 through a graphical interface. All PLC services are started up and
90 shut down through a single System V init script installed in the host
91 system.
92
93 %prep
94 %setup -q
95
96 %build
97 pushd MyPLC
98 rm -rf $RPM_BUILD_ROOT
99 ./build-native.sh %{pldistro} $RPM_BUILD_ROOT
100 popd
101
102 %install
103
104
105 %clean
106 rm -rf $RPM_BUILD_ROOT
107
108 # If run under sudo
109 if [ -n "$SUDO_USER" ] ; then
110     # Allow user to delete the build directory
111     chown -h -R $SUDO_USER .
112     # Some temporary cdroot files like /var/empty/sshd and
113     # /usr/bin/sudo get created with non-readable permissions.
114     find . -not -perm +0600 -exec chmod u+rw {} \;
115     # Allow user to delete the built RPM(s)
116     [ -d %{_rpmdir}/noarch ] && chown -h -R $SUDO_USER %{_rpmdir}/noarch
117 fi
118
119 %pre
120 if [ -x %{_sysconfdir}/init.d/plc ] ; then
121     %{_sysconfdir}/init.d/plc stop
122 fi
123
124 # Old versions of myplc used to ship with a bootstrapped database and
125 # /etc/planetlab directory. Including generated files in the manifest
126 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
127 # names from one RPM build to another, it would be rpmsaved and thus
128 # effectively deleted. Now we do not include these files in the
129 # manifest. However, to avoid deleting these files in the process of
130 # upgrading from one of these old versions of myplc, we must back up
131 # the database and /etc/planetlab and restore them after the old
132 # version has been uninstalled in %triggerpostun (also in %post, in
133 # case we are force upgrading to the same version).
134 #
135 # This code can be removed once all myplc-0.4-1 installations have
136 # been upgraded to at least myplc-0.4-2.
137
138 # 0 = install, 1 = upgrade
139 if [ $1 -gt 0 ] ; then
140     for dir in /var/lib/pgsql/data /etc/planetlab ; do
141         if [ -d $dir ] ; then
142             echo "Preserving $dir"
143             mkdir -p $dir.rpmsave
144             tar -C $dir -cpf - . | \
145                tar -C $dir.rpmsave -xpf -
146
147             # Except for the default configuration file and DTD, which
148             # really should be considered for upgrade.
149             rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
150         fi
151     done
152 fi
153
154 %post
155 if [ -x /sbin/chkconfig ] ; then
156     /sbin/chkconfig --add plc
157     /sbin/chkconfig plc on
158 fi
159 pushd /usr/share/myplc &> /dev/null
160 python plc_config.py build
161 python plc_config.py install
162 popd &> /dev/null
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 $dir.rpmsave -a -d $dir ] ; then
169             echo "Merging $dir"
170             if tar -C $dir.rpmsave -cpf - . | \
171                tar -C $dir -xpf - ; then
172                 rm -rf $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 %files
189 %defattr(-,root,root,-)
190 # Host startup script and configuration file
191 /etc/myplc-release
192 /etc/init.d/plc
193 /etc/plc.d
194 /etc/planetlab
195 /etc/plc_sliceinitscripts/sirius
196 /etc/support-scripts/gen_aliases.py*
197 /etc/support-scripts/renew_reminder.py*
198 /usr/bin/plc-config
199 /usr/bin/plc-config-tty
200 /usr/bin/db-config
201 /usr/bin/dns-config
202 /usr/bin/plc-map.py*
203 /usr/bin/clean-empty-dirs.py*
204 /usr/bin/mtail.py*
205 /usr/bin/check-ssl-peering.py*
206 /usr/share/myplc
207
208 %changelog
209 * Wed Sep 03 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-18
210 - onelab distro requires the dummynet_image package with myplc-native
211 - (onelab distro does not build chroot-myplc anymore)
212
213 * Fri Aug 01 2008 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - MyPLC-4.2-17
214 - Remove iptables conf_file.  Now in iptables module.
215 - Arch specific download directory now in /data for chrooted myplc
216 - Vim now a dependency in myplc. :-)
217
218 * Fri Jul 04 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-16
219 - yum config on nodes improved -- see https://svn.planet-lab.org/ticket/342
220 - also does not create any repo under /var/www/html/install-rpms, to prevent conflicts with noderepo
221
222 * Tue May 20 2008 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - MyPLC-4.2-15
223 - Removed proper ops from planetflow slice.
224
225 * Wed May 14 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-14
226 - myplc-native requires myplc-docs
227 - fixed doc build by locating locally installed DTDs at build-time
228
229 * Sun May 11 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-13
230 - turn myplc-docs off for now
231
232 * Sat May 10 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-12
233 - figures in doc package
234
235 * Fri May 09 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-11
236 - no more doc packaged outside of myplc-docs - doc/ cleaned up 
237 - chroot packaging does not have docs anymore
238 - 'cvs' and 'dev' not required from myplc-native anymore
239 - cosmetic change in kml output
240
241 * Thu May 08 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-10
242 - defaults for *_IP conf vars now void, expect more accurate /etc/hosts
243 - gethostbyname uses python rather than perl (hope this shrinks deps) 
244 - doc: reviewed myplc doc - deprecated everything related to myplc-devel
245 - doc: packaging doc in myplc-native (myplc&PLCAPI) & removed target files from svn
246 - make sync now works towards vserver-based myplc only 
247
248 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-9
249
250 - added vsys 'pfmount' script to the default netflow slice attributes.
251
252
253 * Thu Apr 24 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-8
254 - plc.d/bootcd step altered for handling legacy bootcd smooth migration
255 - to new bootcd packaging
256
257 * Wed Apr 23 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-7
258 - changes needed for bootcd 4.2 : new, possible multiple, installation locations, and new rpm name
259
260 * Tue Apr 22 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-6
261 - packaging of mplc-release in myplc-native
262 - sudoers.php is new to PlanetLabConf (needs nodeconfig-4.2-4)
263 - resolv file in /etc/resolv.conf, not plc_resolv.conf
264 - improved sirius script
265 - remove the 'driver' node-network-setting that was unused, and new 'Multihome' category
266 - expires more properly set 
267
268 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-4 MyPLC-4.2-5
269
270
271 * Wed Mar 26 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-3 MyPLC-4.2-4
272 - renew_reminder script moved to support-scripts/
273 - gen-aliases script added in support-scripts/
274 - sirius initscript moved to plc_sliceinitscripts (formerly inlined in db-config)
275 - plc-map script : no javascript for googlemap anymore, see new plc-kml script instead
276 - nodefamily-aware (creates legacy symlink /var/www/html/install-rpms/planetlab)
277 - new native slice attributes 'capabilities', 'vsys' and 'codemux'
278 - new setting 'Mom list address' for sending emails to a separate destination
279 - starts rsyslogd/syslogd as appropriate
280 - expects nodeconfig package (former PlanetLabConf/ dir from PLCWWW)
281 - convenience generation of yum.conf in resulting image based on build/mirroring
282
283 * Thu Feb 14 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.2-2 myplc-4.2-3
284 - refresh-peer.py removed (duplicate with PLCAPI)
285 - plc.d/ scripts cleaned up
286 - sirius initscript updated
287 - slice auto renewal fixed
288
289 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
290 - initial build.