No need to include the content from new_plc_www in the RPM, as this will come from...
[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 %define debug_package %{nil}
16
17 %description
18 MyPLC is a complete PlanetLab Central (PLC) portable installation
19 contained within a chroot jail. The default installation consists of a
20 web server, an XML-RPC API server, a boot server, and a database
21 server: the core components of PLC. The installation may be customized
22 through a graphical interface. All PLC services are started up and
23 shut down through a single System V init script installed in the host
24 system.
25
26 %prep
27 %setup -q
28
29 %build
30 pushd myplc
31 rm -rf $RPM_BUILD_ROOT
32 ./build-native.sh $RPM_BUILD_ROOT
33 popd
34
35 %install
36
37 %clean
38 rm -rf $RPM_BUILD_ROOT
39
40 # If run under sudo
41 if [ -n "$SUDO_USER" ] ; then
42     # Allow user to delete the build directory
43     chown -h -R $SUDO_USER .
44     # Some temporary cdroot files like /var/empty/sshd and
45     # /usr/bin/sudo get created with non-readable permissions.
46     find . -not -perm +0600 -exec chmod u+rw {} \;
47     # Allow user to delete the built RPM(s)
48     chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
49 fi
50
51 %pre
52 if [ -x %{_sysconfdir}/init.d/plc ] ; then
53     %{_sysconfdir}/init.d/plc stop
54 fi
55
56 # Old versions of myplc used to ship with a bootstrapped database and
57 # /etc/planetlab directory. Including generated files in the manifest
58 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
59 # names from one RPM build to another, it would be rpmsaved and thus
60 # effectively deleted. Now we do not include these files in the
61 # manifest. However, to avoid deleting these files in the process of
62 # upgrading from one of these old versions of myplc, we must back up
63 # the database and /etc/planetlab and restore them after the old
64 # version has been uninstalled in %triggerpostun (also in %post, in
65 # case we are force upgrading to the same version).
66 #
67 # This code can be removed once all myplc-0.4-1 installations have
68 # been upgraded to at least myplc-0.4-2.
69
70 # 0 = install, 1 = upgrade
71 if [ $1 -gt 0 ] ; then
72     for dir in /var/lib/pgsql/data /etc/planetlab ; do
73         if [ -d $dir ] ; then
74             echo "Preserving $dir"
75             mkdir -p $dir.rpmsave
76             tar -C $dir -cpf - . | \
77                tar -C $dir.rpmsave -xpf -
78
79             # Except for the default configuration file and DTD, which
80             # really should be considered for upgrade.
81             rm -f $dir.rpmsave/{default_config.xml,plc_config.dtd}
82         fi
83     done
84 fi
85
86 %post
87 if [ -x /sbin/chkconfig ] ; then
88     /sbin/chkconfig --add plc
89     /sbin/chkconfig plc on
90 fi
91
92 %triggerpostun -- %{name}
93 # 0 = erase, 1 = upgrade
94 if [ $1 -gt 0 ] ; then
95     for dir in /var/lib/pgsql/data /etc/planetlab ; do
96         if [ -d $dir.rpmsave -a -d $dir ] ; then
97             echo "Merging $dir"
98             if tar -C $dir.rpmsave -cpf - . | \
99                tar -C $dir -xpf - ; then
100                 rm -rf $dir.rpmsave
101             fi
102         fi
103     done
104 fi    
105
106 %preun
107 # 0 = erase, 1 = upgrade
108 if [ $1 -eq 0 ] ; then
109     %{_sysconfdir}/init.d/plc stop
110     if [ -x /sbin/chkconfig ] ; then
111         /sbin/chkconfig plc off
112         /sbin/chkconfig --del plc
113     fi
114 fi
115
116 %files
117 %defattr(-,root,root,-)
118 # Host startup script and configuration file
119 /etc/init.d/plc
120 /usr/bin/plc-config
121 /usr/bin/plc-config-tty
122 /usr/bin/db-config
123 /usr/bin/dns-config
124 /usr/bin/gen-sites-xml.py*
125 /usr/bin/gen-slices-xml-05.py*
126 /usr/bin/gen-static-content.py*
127 /etc/plc.d
128 /etc/planetlab
129 /var/www/html/install-rpms/planetlab
130
131 %changelog
132 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
133 - initial build.