- add myplc-devel subpackage
[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 popd
86
87 %clean
88 rm -rf $RPM_BUILD_ROOT
89
90 # If run under sudo
91 if [ -n "$SUDO_USER" ] ; then
92     # Allow user to delete the build directory
93     chown -R $SUDO_USER .
94     # Some temporary cdroot files like /var/empty/sshd and
95     # /usr/bin/sudo get created with non-readable permissions.
96     find . -not -perm +0600 -exec chmod u+rw {} \;
97     # Allow user to delete the built RPM(s)
98     chown -R $SUDO_USER %{_rpmdir}/%{_arch}
99 fi
100
101 %pre
102 if [ -x %{_sysconfdir}/init.d/plc ] ; then
103     %{_sysconfdir}/init.d/plc stop
104 fi
105
106 # Old versions of myplc used to ship with a bootstrapped database and
107 # /etc/planetlab directory. Including generated files in the manifest
108 # was dangerous; if /plc/data/var/lib/pgsql/data/base/1/16676 changed
109 # names from one RPM build to another, it would be rpmsaved and thus
110 # effectively deleted. Now we do not include these files in the
111 # manifest. However, to avoid deleting these files in the process of
112 # upgrading from one of these old versions of myplc, we must back up
113 # the database and /etc/planetlab and restore them after the old
114 # version has been uninstalled in %triggerpostun.
115
116 # 0 = install, 1 = upgrade
117 if [ $1 -gt 0 ] ; then
118     for dir in /var/lib/pgsql/data /etc/planetlab ; do
119         if [ -d /plc/data/$dir ] ; then
120             echo "Preserving /plc/data/$dir"
121             mv /plc/data/$dir /plc/data/$dir.rpmsave
122         fi
123     done
124
125     # Except for the default configuration file and DTD, which really
126     # should be considered for upgrade.
127     mkdir -m 755 -p /plc/data/etc/planetlab
128     mv /plc/data/etc/planetlab.rpmsave/{default_config.xml,plc_config.dtd} \
129        /plc/data/etc/planetlab/ || :
130 fi
131
132 %post
133 if [ -x /sbin/chkconfig ] ; then
134     /sbin/chkconfig --add plc
135     /sbin/chkconfig plc on
136 fi
137
138 # Force a regeneration to take into account new variables
139 touch /plc/data/etc/planetlab/default_config.xml
140
141 %triggerpostun -- %{name}
142 # 0 = erase, 1 = upgrade
143 if [ $1 -gt 0 ] ; then
144     for dir in /var/lib/pgsql/data /etc/planetlab ; do
145         if [ -d /plc/data/$dir.rpmsave -a -d /plc/data/$dir ] ; then
146             echo "Merging /plc/data/$dir"
147             if tar -C /plc/data/$dir.rpmsave -cpf - . | \
148                tar -C /plc/data/$dir -xpf - ; then
149                 rm -rf /plc/data/$dir.rpmsave
150             fi
151         fi
152     done
153 fi    
154
155 %preun
156 # 0 = erase, 1 = upgrade
157 if [ $1 -eq 0 ] ; then
158     %{_sysconfdir}/init.d/plc stop
159     if [ -x /sbin/chkconfig ] ; then
160         /sbin/chkconfig plc off
161         /sbin/chkconfig --del plc
162     fi
163 fi
164
165 %pre devel
166 if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then
167     %{_sysconfdir}/init.d/plc-devel stop
168 fi
169
170 # 0 = install, 1 = upgrade
171 if [ $1 -gt 0 ] ; then
172     # Never overwrite /cvs
173     if [ -d /plc/devel/data/cvs ] ; then
174         echo "Preserving /plc/devel/data/cvs"
175         mv /plc/devel/data/cvs /plc/devel/data/cvs.rpmsave
176     fi
177 fi
178
179 %post devel
180 if [ -x /sbin/chkconfig ] ; then
181     /sbin/chkconfig --add plc-devel
182     /sbin/chkconfig plc-devel on
183 fi
184
185 %triggerpostun -- %{name}
186 # 0 = erase, 1 = upgrade
187 if [ $1 -gt 0 ] ; then
188     if [ -d /plc/devel/data/cvs.rpmsave ] ; then
189         echo "Restoring /plc/devel/data/cvs"
190         mv /plc/devel/data/cvs /plc/devel/data/cvs.%{version}-%{release}
191         mv /plc/devel/data/cvs.rpmsave /plc/devel/data/cvs
192     fi
193 fi    
194
195 %preun devel
196 # 0 = erase, 1 = upgrade
197 if [ $1 -eq 0 ] ; then
198     %{_sysconfdir}/init.d/plc-devel stop
199     if [ -x /sbin/chkconfig ] ; then
200         /sbin/chkconfig plc-devel off
201         /sbin/chkconfig --del plc-devel
202     fi
203 fi
204
205 %files
206 %defattr(-,root,root,-)
207 # Host startup script and configuration file
208 %{_sysconfdir}/init.d/plc
209 %{_sysconfdir}/sysconfig/plc
210
211 # Symlink to /etc/planetlab within data directory
212 %{_sysconfdir}/planetlab
213
214 # Root filesystem
215 /plc/root.img
216 /plc/root
217
218 # Data directory
219 %dir /plc/data
220 %config(noreplace) /plc/data/*
221
222 %files devel
223 %defattr(-,root,root,-)
224 # Host startup script and configuration file
225 %{_sysconfdir}/init.d/plc-devel
226 %{_sysconfdir}/sysconfig/plc-devel
227
228 # Root filesystem
229 /plc/devel/root.img
230 /plc/devel/root
231
232 # Data directory
233 %dir /plc/devel/data
234 %config(noreplace) /plc/devel/data/*
235
236 %changelog
237 * Thu Jul 13 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-2, 0.5-2
238 - MyPLC 0.4 RC2.
239 - Build development environment (myplc-devel). Add support for
240   building myplc itself inside myplc-devel.
241 - Move step-specific initialization to appropriate plc.d scripts
242 - Fix postgresql startup failure when bootstrapping
243 - Allow CA to be configured for each SSL certificate set. Stop doing
244   root CA stuff, this is outside the scope of MyPLC. MyPLC now only
245   generates self-signed certificates, but supports replacement of the
246   self-signed certificates with real certifcates signed by another CA,
247   as long as the CA is specified.
248 - Self-sign the MA/SA SSL certificate (and by extension, the MA/SA API
249   certificate).
250 - pl_mom: Workarounds for when NM queries time out.
251 - plc_api: Honor PLC_MAIL_ENABLED.
252
253 * Wed Jul  6 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.4-1, 0.5-1
254 - First stable release of MyPLC 0.4 RC1.
255
256 * Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
257 - Basic functionality complete. Consolidate into a single package
258   installed in /plc.
259
260 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
261 - Initial build.
262