Various tweaks for myplc-native (not thoroughly tested yet) :
[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 9
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: cvs
63 Requires: dev
64 Requires: bootcd-%{pldistro}-%{_arch}
65 Requires: dnsmasq
66 Requires: diffutils
67 Requires: gzip
68 Requires: findutils
69 # planetlab stuff
70 Requires: PLCWWW
71 Requires: nodeconfig
72 Requires: PLCAPI
73 Requires: bootstrapfs-%{pldistro}-%{_arch}
74
75 Provides: myplc
76
77 %define debug_package %{nil}
78
79 %description
80 MyPLC is a complete PlanetLab Central (PLC) portable installation
81 contained within a chroot jail. The default installation consists of a
82 web server, an XML-RPC API server, a boot server, and a database
83 server: the core components of PLC. The installation may be customized
84 through a graphical interface. All PLC services are started up and
85 shut down through a single System V init script installed in the host
86 system.
87
88 %prep
89 %setup -q
90
91 %build
92 pushd MyPLC
93 rm -rf $RPM_BUILD_ROOT
94 ./build-native.sh %{pldistro} $RPM_BUILD_ROOT
95 popd
96
97 %install
98
99
100 %clean
101 rm -rf $RPM_BUILD_ROOT
102
103 # If run under sudo
104 if [ -n "$SUDO_USER" ] ; then
105     # Allow user to delete the build directory
106     chown -h -R $SUDO_USER .
107     # Some temporary cdroot files like /var/empty/sshd and
108     # /usr/bin/sudo get created with non-readable permissions.
109     find . -not -perm +0600 -exec chmod u+rw {} \;
110     # Allow user to delete the built RPM(s)
111     chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
112 fi
113
114 %pre
115 if [ -x %{_sysconfdir}/init.d/plc ] ; then
116     %{_sysconfdir}/init.d/plc stop
117 fi
118
119 # Old versions of myplc used to ship with a bootstrapped database and
120 # /etc/planetlab directory. Including generated files in the manifest
121 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
122 # names from one RPM build to another, it would be rpmsaved and thus
123 # effectively deleted. Now we do not include these files in the
124 # manifest. However, to avoid deleting these files in the process of
125 # upgrading from one of these old versions of myplc, we must back up
126 # the database and /etc/planetlab and restore them after the old
127 # version has been uninstalled in %triggerpostun (also in %post, in
128 # case we are force upgrading to the same version).
129 #
130 # This code can be removed once all myplc-0.4-1 installations have
131 # been upgraded to at least myplc-0.4-2.
132
133 # 0 = install, 1 = upgrade
134 if [ $1 -gt 0 ] ; then
135     for dir in /var/lib/pgsql/data /etc/planetlab ; do
136         if [ -d $dir ] ; then
137             echo "Preserving $dir"
138             mkdir -p $dir.rpmsave
139             tar -C $dir -cpf - . | \
140                tar -C $dir.rpmsave -xpf -
141
142             # Except for the default configuration file and DTD, which
143             # really should be considered for upgrade.
144             rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
145         fi
146     done
147 fi
148
149 %post
150 if [ -x /sbin/chkconfig ] ; then
151     /sbin/chkconfig --add plc
152     /sbin/chkconfig plc on
153 fi
154 pushd /usr/share/myplc &> /dev/null
155 python plc_config.py build
156 python plc_config.py install
157 # build drupal docs - this is crappy but at least we keep PLCAPI out
158 # also, we copy everythong in the same place
159 mkdir -p /var/www/html/planetlab/doc
160 if [ -f /usr/share/plc_api/doc/PLCAPI.html ] ; then
161     cp /usr/share/plc_api/doc/PLCAPI.{html,pdf} /var/www/html/planetlab/doc
162     ./docbook2drupal.sh "PLCAPI Documentation" \
163         /var/www/html/planetlab/doc/PLCAPI.html \
164         /var/www/html/planetlab/doc/plcapi.php
165 fi || :
166 # same for the PLCAPI doc
167 if [ -f /usr/share/myplc/doc/myplc.html ] ; then
168     cp /usr/share/myplc/doc/myplc.{html,pdf} /var/www/html/planetlab/doc
169     ./docbook2drupal.sh "Myplc User Guide" \
170         /var/www/html/planetlab/doc/myplc.html \
171         /var/www/html/planetlab/doc/myplc.php
172 fi || :
173
174 popd &> /dev/null
175
176 %triggerpostun -- %{name}
177 # 0 = erase, 1 = upgrade
178 if [ $1 -gt 0 ] ; then
179     for dir in /var/lib/pgsql/data /etc/planetlab ; do
180         if [ -d $dir.rpmsave -a -d $dir ] ; then
181             echo "Merging $dir"
182             if tar -C $dir.rpmsave -cpf - . | \
183                tar -C $dir -xpf - ; then
184                 rm -rf $dir.rpmsave
185             fi
186         fi
187     done
188 fi    
189
190 %preun
191 # 0 = erase, 1 = upgrade
192 if [ $1 -eq 0 ] ; then
193     %{_sysconfdir}/init.d/plc stop
194     if [ -x /sbin/chkconfig ] ; then
195         /sbin/chkconfig plc off
196         /sbin/chkconfig --del plc
197     fi
198 fi
199
200 %files
201 %defattr(-,root,root,-)
202 # Host startup script and configuration file
203 /etc/myplc-release
204 /etc/init.d/plc
205 /etc/plc.d
206 /etc/planetlab
207 /etc/plc_sliceinitscripts/sirius
208 /etc/support-scripts/gen_aliases.py*
209 /etc/support-scripts/renew_reminder.py*
210 /usr/bin/plc-config
211 /usr/bin/plc-config-tty
212 /usr/bin/db-config
213 /usr/bin/dns-config
214 /usr/bin/plc-map.py*
215 /usr/bin/clean-empty-dirs.py*
216 /usr/bin/mtail.py*
217 /usr/bin/check-ssl-peering.py*
218 /usr/share/myplc
219 /var/www/html/install-rpms/%{pldistro}-%{_arch}
220 /var/www/html/install-rpms/planetlab
221 /var/www/html/planetlab/doc/
222
223 %changelog
224 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-9
225
226 - added vsys 'pfmount' script to the default netflow slice attributes.
227
228
229 * Thu Apr 24 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-8
230 - plc.d/bootcd step altered for handling legacy bootcd smooth migration
231 - to new bootcd packaging
232
233 * Wed Apr 23 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-7
234 - changes needed for bootcd 4.2 : new, possible multiple, installation locations, and new rpm name
235
236 * Tue Apr 22 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-6
237 - packaging of mplc-release in myplc-native
238 - sudoers.php is new to PlanetLabConf (needs nodeconfig-4.2-4)
239 - resolv file in /etc/resolv.conf, not plc_resolv.conf
240 - improved sirius script
241 - remove the 'driver' node-network-setting that was unused, and new 'Multihome' category
242 - expires more properly set 
243
244 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-4 MyPLC-4.2-5
245
246
247 * Wed Mar 26 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-3 MyPLC-4.2-4
248 - renew_reminder script moved to support-scripts/
249 - gen-aliases script added in support-scripts/
250 - sirius initscript moved to plc_sliceinitscripts (formerly inlined in db-config)
251 - plc-map script : no javascript for googlemap anymore, see new plc-kml script instead
252 - nodefamily-aware (creates legacy symlink /var/www/html/install-rpms/planetlab)
253 - new native slice attributes 'capabilities', 'vsys' and 'codemux'
254 - new setting 'Mom list address' for sending emails to a separate destination
255 - starts rsyslogd/syslogd as appropriate
256 - expects nodeconfig package (former PlanetLabConf/ dir from PLCWWW)
257 - convenience generation of yum.conf in resulting image based on build/mirroring
258
259 * Thu Feb 14 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-4.2-2 myplc-4.2-3
260 - refresh-peer.py removed (duplicate with PLCAPI)
261 - plc.d/ scripts cleaned up
262 - sirius initscript updated
263 - slice auto renewal fixed
264
265 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
266 - initial build.