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