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