- MyPLC 0.4 RC2
[myplc.git] / myplc.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
8 Version: 0.5
9 Release: 2%{?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 %package devel
27 Summary: PlanetLab Central (PLC) Development Environment
28 Group: Development/Tools
29 AutoReqProv: no
30
31 %description devel
32 This package install a complete PlanetLab development environment
33 contained within a chroot jail. The default installation consists of a
34 local CVS repository bootstrapped with a snapshot of all PlanetLab
35 source code, and all the tools necessary to compile it.
36
37 %prep
38 %setup -q
39
40 %build
41 pushd myplc
42 ./build_devel.sh
43 ./build.sh
44 popd
45
46 %install
47 rm -rf $RPM_BUILD_ROOT
48
49 pushd myplc
50
51 #
52 # myplc
53 #
54
55 # Install host startup script and configuration file
56 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
57 install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
58
59 # Create convenient symlink
60 install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}
61 ln -sf /plc/data/etc/planetlab $RPM_BUILD_ROOT/%{_sysconfdir}/planetlab
62
63 # Install root filesystem
64 install -d -m 755 $RPM_BUILD_ROOT/plc/root
65 install -D -m 644 root.img $RPM_BUILD_ROOT/plc/root.img
66
67 # Install data directory
68 find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
69
70 #
71 # myplc-devel
72 #
73
74 # Install host startup script and configuration file
75 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc-devel
76 install -D -m 644 plc-devel.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc-devel
77
78 # Install root filesystem
79 install -d -m 755 $RPM_BUILD_ROOT/plc/devel/root
80 install -D -m 644 devel/root.img $RPM_BUILD_ROOT/plc/devel/root.img
81
82 # Install data directory
83 find devel/data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
84
85 # Make sure /cvs is never upgraded once installed by giving it a
86 # unique name. A hard-linked copy is made in %post.
87 mv $RPM_BUILD_ROOT/plc/devel/data/{cvs,cvs-%{version}-%{release}}
88
89 popd
90
91 %clean
92 rm -rf $RPM_BUILD_ROOT
93
94 # If run under sudo
95 if [ -n "$SUDO_USER" ] ; then
96     # Allow user to delete the build directory
97     chown -R $SUDO_USER .
98     # Some temporary cdroot files like /var/empty/sshd and
99     # /usr/bin/sudo get created with non-readable permissions.
100     find . -not -perm +0600 -exec chmod u+rw {} \;
101     # Allow user to delete the built RPM(s)
102     chown -R $SUDO_USER %{_rpmdir}/%{_arch}
103 fi
104
105 %pre
106 if [ -x %{_sysconfdir}/init.d/plc ] ; then
107     %{_sysconfdir}/init.d/plc stop
108 fi
109
110 # Old versions of myplc used to ship with a bootstrapped database and
111 # /etc/planetlab directory. Including generated files in the manifest
112 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
113 # names from one RPM build to another, it would be rpmsaved and thus
114 # effectively deleted. Now we do not include these files in the
115 # manifest. However, to avoid deleting these files in the process of
116 # upgrading from one of these old versions of myplc, we must back up
117 # the database and /etc/planetlab and restore them after the old
118 # version has been uninstalled in %triggerpostun.
119 #
120 # This code can be removed once all myplc-0.4-1 installations have
121 # been upgraded to at least myplc-0.4-2.
122
123 # 0 = install, 1 = upgrade
124 if [ $1 -gt 0 ] ; then
125     for dir in /var/lib/pgsql/data /etc/planetlab ; do
126         if [ -d /plc/data/$dir ] ; then
127             echo "Preserving /plc/data/$dir"
128             mv /plc/data/$dir /plc/data/$dir.rpmsave
129         fi
130     done
131
132     # Except for the default configuration file and DTD, which really
133     # should be considered for upgrade.
134     mkdir -m 755 -p /plc/data/etc/planetlab
135     mv /plc/data/etc/planetlab.rpmsave/{default_config.xml,plc_config.dtd} \
136        /plc/data/etc/planetlab/ || :
137 fi
138
139 %post
140 if [ -x /sbin/chkconfig ] ; then
141     /sbin/chkconfig --add plc
142     /sbin/chkconfig plc on
143 fi
144
145 # Force a regeneration to take into account new variables
146 touch /plc/data/etc/planetlab/default_config.xml
147
148 %triggerpostun -- %{name}
149 # 0 = erase, 1 = upgrade
150 if [ $1 -gt 0 ] ; then
151     for dir in /var/lib/pgsql/data /etc/planetlab ; do
152         if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
153             echo "Merging /plc/data/$dir"
154             if tar -C /plc/data/$dir.rpmsave -cpf - . | \
155                tar -C /plc/data/$dir -xpf - ; then
156                 rm -rf /plc/data/$dir.rpmsave
157             fi
158         fi
159     done
160 fi    
161
162 %preun
163 # 0 = erase, 1 = upgrade
164 if [ $1 -eq 0 ] ; then
165     %{_sysconfdir}/init.d/plc stop
166     if [ -x /sbin/chkconfig ] ; then
167         /sbin/chkconfig plc off
168         /sbin/chkconfig --del plc
169     fi
170 fi
171
172 %pre devel
173 if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then
174     %{_sysconfdir}/init.d/plc-devel stop
175 fi
176
177 %post devel
178 if [ -x /sbin/chkconfig ] ; then
179     /sbin/chkconfig --add plc-devel
180     /sbin/chkconfig plc-devel on
181 fi
182
183 # If /cvs does not already exist, make a hard-linked copy of this
184 # version's /cvs repository.
185 if [ ! -d /plc/devel/data/cvs ] ; then
186     cp -rl /plc/devel/data/{cvs-%{version}-%{release},cvs}
187 fi
188
189 %preun devel
190 # 0 = erase, 1 = upgrade
191 if [ $1 -eq 0 ] ; then
192     %{_sysconfdir}/init.d/plc-devel stop
193     if [ -x /sbin/chkconfig ] ; then
194         /sbin/chkconfig plc-devel off
195         /sbin/chkconfig --del plc-devel
196     fi
197 fi
198
199 %files
200 %defattr(-,root,root,-)
201 # Host startup script and configuration file
202 %{_sysconfdir}/init.d/plc
203 %{_sysconfdir}/sysconfig/plc
204
205 # Symlink to /etc/planetlab within data directory
206 %{_sysconfdir}/planetlab
207
208 # Root filesystem
209 /plc/root.img
210 /plc/root
211
212 # Data directory
213 %dir /plc/data
214 %config(noreplace) /plc/data/*
215
216 %files devel
217 %defattr(-,root,root,-)
218 # Host startup script and configuration file
219 %{_sysconfdir}/init.d/plc-devel
220 %{_sysconfdir}/sysconfig/plc-devel
221
222 # Root filesystem
223 /plc/devel/root.img
224 /plc/devel/root
225
226 # Data directory
227 %dir /plc/devel/data
228 %config(noreplace) /plc/devel/data/*
229
230 %changelog
231 * Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
232 - MyPLC 0.4 RC2.
233 - Fix many spec files (License replaces Copyright).
234 - Fix kernel build under gcc32 (module verification bug).
235 - Fix vnet build under gcc32
236 - Fix PlanetFlow. MySQL RPM postinstall script no longer starts the
237   server. Also, get hostnames list from PLC_WWW_HOST, not
238   www.planet-lab.org.
239 - Fix pl_mom/bwmon to use cached values if NM is unresponsive
240 - Fix pl_mom/swapmon reset logic to avoid endless loops
241 - Remove ksymoops, add kernel-smp to standard PlanetLab package group
242 - Add kernel-smp boot support to bootmanager
243 - Add badblock search support to bootmanager
244 - Build development environment (myplc-devel). Add support for
245   building myplc itself inside myplc-devel.
246 - Move step-specific initialization to appropriate plc.d scripts
247 - Fix postgresql startup failure when bootstrapping
248 - Allow CA to be configured for each SSL certificate set. Stop doing
249   root CA stuff, this is outside the scope of MyPLC. MyPLC now only
250   generates self-signed certificates, but supports replacement of the
251   self-signed certificates with real certifcates signed by another CA,
252   as long as the CA is specified.
253 - Self-sign the MA/SA SSL certificate (and by extension, the MA/SA API
254   certificate).
255 - pl_mom: Workarounds for when NM queries time out.
256 - plc_api: Honor PLC_MAIL_ENABLED.
257
258 * Wed Jul  6 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-1, 0.5-1
259 - First stable release of MyPLC 0.4 RC1.
260
261 * Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
262 - Basic functionality complete. Consolidate into a single package
263   installed in /plc.
264
265 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
266 - Initial build.
267