start tuning the version #s of the required RPMs
[myplc.git] / myplc-native.spec
1 Vendor: PlanetLab
2 Packager: PlanetLab Central <support@planet-lab.org>
3 Distribution: PlanetLab 4.0
4 URL: http://cvs.planet-lab.org/cvs/myplc
5
6 Summary: PlanetLab Central (PLC) Portable Installation
7 Name: myplc-native
8 Version: 0.5
9 Release: 4%{?pldistro:.%{pldistro}}%{?date:.%{date}}
10 License: PlanetLab
11 Group: Applications/Systems
12 Source0: %{name}-%{version}.tar.gz
13 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
14
15 Requires: bzip2
16 Requires: sendmail-cf
17 Requires: tar 
18 Requires: less
19 Requires: perl-GD
20 Requires: openssl
21 Requires: xmlsec1
22 Requires: gd
23 Requires: expect
24 Requires: php-pgsql
25 Requires: curl
26 Requires: python-pycurl
27 Requires: httpd
28 Requires: rsync
29 Requires: mod_python
30 Requires: mod_ssl
31 Requires: bootmanager
32 Requires: python-devel
33 Requires: SOAPpy
34 Requires: vixie-cron
35 Requires: yum
36 Requires: php-gd
37 Requires: PLCWWW
38 Requires: PLCAPI
39 Requires: PyXML
40 Requires: sendmail
41 Requires: python >= 2.4
42 Requires: createrepo
43 Requires: postgresql-python
44 Requires: cpio
45 Requires: postgresql-server
46 Requires: wget
47 Requires: php
48 Requires: xmlsec1-openssl
49 Requires: postgresql
50 Requires: openssh
51 Requires: cvs
52 Requires: dev
53 Requires: bootcd
54 Requires: dnsmasq
55 Requires: diffutils
56 Requires: gzip
57 Requires: findutils
58
59 %define
60  debug_package %{nil}
61
62 %description
63 MyPLC is a complete PlanetLab Central (PLC) portable installation
64 contained within a chroot jail. The default installation consists of a
65 web server, an XML-RPC API server, a boot server, and a database
66 server: the core components of PLC. The installation may be customized
67 through a graphical interface. All PLC services are started up and
68 shut down through a single System V init script installed in the host
69 system.
70
71 %prep
72 %setup -q
73
74 %build
75 pushd myplc
76 rm -rf $RPM_BUILD_ROOT
77 ./build-native.sh $RPM_BUILD_ROOT
78 popd
79
80 %install
81
82 %clean
83 rm -rf $RPM_BUILD_ROOT
84
85 # If run under sudo
86 if [ -n "$SUDO_USER" ] ; then
87     # Allow user to delete the build directory
88     chown -h -R $SUDO_USER .
89     # Some temporary cdroot files like /var/empty/sshd and
90     # /usr/bin/sudo get created with non-readable permissions.
91     find . -not -perm +0600 -exec chmod u+rw {} \;
92     # Allow user to delete the built RPM(s)
93     chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
94 fi
95
96 %pre
97 if [ -x %{_sysconfdir}/init.d/plc ] ; then
98     %{_sysconfdir}/init.d/plc stop
99 fi
100
101 # Old versions of myplc used to ship with a bootstrapped database and
102 # /etc/planetlab directory. Including generated files in the manifest
103 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
104 # names from one RPM build to another, it would be rpmsaved and thus
105 # effectively deleted. Now we do not include these files in the
106 # manifest. However, to avoid deleting these files in the process of
107 # upgrading from one of these old versions of myplc, we must back up
108 # the database and /etc/planetlab and restore them after the old
109 # version has been uninstalled in %triggerpostun (also in %post, in
110 # case we are force upgrading to the same version).
111 #
112 # This code can be removed once all myplc-0.4-1 installations have
113 # been upgraded to at least myplc-0.4-2.
114
115 # 0 = install, 1 = upgrade
116 if [ $1 -gt 0 ] ; then
117     for dir in /var/lib/pgsql/data /etc/planetlab ; do
118         if [ -d $dir ] ; then
119             echo "Preserving $dir"
120             mkdir -p $dir.rpmsave
121             tar -C $dir -cpf - . | \
122                tar -C $dir.rpmsave -xpf -
123
124             # Except for the default configuration file and DTD, which
125             # really should be considered for upgrade.
126             rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
127         fi
128     done
129 fi
130
131 %post
132 if [ -x /sbin/chkconfig ] ; then
133     /sbin/chkconfig --add plc
134     /sbin/chkconfig plc on
135 fi
136
137 %triggerpostun -- %{name}
138 # 0 = erase, 1 = upgrade
139 if [ $1 -gt 0 ] ; then
140     for dir in /var/lib/pgsql/data /etc/planetlab ; do
141         if [ -d $dir.rpmsave -a -d $dir ] ; then
142             echo "Merging $dir"
143             if tar -C $dir.rpmsave -cpf - . | \
144                tar -C $dir -xpf - ; then
145                 rm -rf $dir.rpmsave
146             fi
147         fi
148     done
149 fi    
150
151 %preun
152 # 0 = erase, 1 = upgrade
153 if [ $1 -eq 0 ] ; then
154     %{_sysconfdir}/init.d/plc stop
155     if [ -x /sbin/chkconfig ] ; then
156         /sbin/chkconfig plc off
157         /sbin/chkconfig --del plc
158     fi
159 fi
160
161 %files
162 %defattr(-,root,root,-)
163 # Host startup script and configuration file
164 /etc/init.d/plc
165 /usr/bin/plc-config
166 /usr/bin/plc-config-tty
167 /usr/bin/db-config
168 /usr/bin/dns-config
169 /usr/bin/gen-sites-xml.py*
170 /usr/bin/gen-slices-xml-05.py*
171 /usr/bin/gen-static-content.py*
172 /etc/plc.d
173 /etc/planetlab
174 /var/www/html/install-rpms/planetlab
175
176 %changelog
177 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
178 - initial build.
179
180