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