6 %define name myplc-native
10 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
12 Summary: PlanetLab Central (PLC) Portable Installation
17 Group: Applications/Systems
18 Source0: %{name}-%{version}.tar.gz
19 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
22 Packager: PlanetLab Central <support@planet-lab.org>
23 Distribution: PlanetLab %{plrelease}
24 URL: %(echo %{url} | cut -d ' ' -f 2)
37 Requires: python-pycurl
38 Requires: python-psycopg2
44 Requires: python-devel
53 Requires: python >= 2.4
55 Requires: postgresql-python
57 Requires: postgresql-server
60 Requires: xmlsec1-openssl
71 %define debug_package %{nil}
74 MyPLC is a complete PlanetLab Central (PLC) portable installation
75 contained within a chroot jail. The default installation consists of a
76 web server, an XML-RPC API server, a boot server, and a database
77 server: the core components of PLC. The installation may be customized
78 through a graphical interface. All PLC services are started up and
79 shut down through a single System V init script installed in the host
87 rm -rf $RPM_BUILD_ROOT
88 ./build-native.sh $RPM_BUILD_ROOT
95 rm -rf $RPM_BUILD_ROOT
98 if [ -n "$SUDO_USER" ] ; then
99 # Allow user to delete the build directory
100 chown -h -R $SUDO_USER .
101 # Some temporary cdroot files like /var/empty/sshd and
102 # /usr/bin/sudo get created with non-readable permissions.
103 find . -not -perm +0600 -exec chmod u+rw {} \;
104 # Allow user to delete the built RPM(s)
105 chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
109 if [ -x %{_sysconfdir}/init.d/plc ] ; then
110 %{_sysconfdir}/init.d/plc stop
113 # Old versions of myplc used to ship with a bootstrapped database and
114 # /etc/planetlab directory. Including generated files in the manifest
115 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
116 # names from one RPM build to another, it would be rpmsaved and thus
117 # effectively deleted. Now we do not include these files in the
118 # manifest. However, to avoid deleting these files in the process of
119 # upgrading from one of these old versions of myplc, we must back up
120 # the database and /etc/planetlab and restore them after the old
121 # version has been uninstalled in %triggerpostun (also in %post, in
122 # case we are force upgrading to the same version).
124 # This code can be removed once all myplc-0.4-1 installations have
125 # been upgraded to at least myplc-0.4-2.
127 # 0 = install, 1 = upgrade
128 if [ $1 -gt 0 ] ; then
129 for dir in /var/lib/pgsql/data /etc/planetlab ; do
130 if [ -d $dir ] ; then
131 echo "Preserving $dir"
132 mkdir -p $dir.rpmsave
133 tar -C $dir -cpf - . | \
134 tar -C $dir.rpmsave -xpf -
136 # Except for the default configuration file and DTD, which
137 # really should be considered for upgrade.
138 rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
144 if [ -x /sbin/chkconfig ] ; then
145 /sbin/chkconfig --add plc
146 /sbin/chkconfig plc on
148 pushd /usr/share/myplc &> /dev/null
149 python plc_config.py build
150 python plc_config.py install
153 %triggerpostun -- %{name}
154 # 0 = erase, 1 = upgrade
155 if [ $1 -gt 0 ] ; then
156 for dir in /var/lib/pgsql/data /etc/planetlab ; do
157 if [ -d $dir.rpmsave -a -d $dir ] ; then
159 if tar -C $dir.rpmsave -cpf - . | \
160 tar -C $dir -xpf - ; then
168 # 0 = erase, 1 = upgrade
169 if [ $1 -eq 0 ] ; then
170 %{_sysconfdir}/init.d/plc stop
171 if [ -x /sbin/chkconfig ] ; then
172 /sbin/chkconfig plc off
173 /sbin/chkconfig --del plc
178 %defattr(-,root,root,-)
179 # Host startup script and configuration file
183 /var/www/html/install-rpms/planetlab
185 /usr/bin/plc-config-tty
189 /usr/bin/clean-empty-dirs.py*
191 /usr/bin/check-ssl-peering.py*
192 /usr/share/myplc/plc_config.py*
195 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>