- mark the entire data directory as non-replaceable
[myplc.git] / myplc.spec
1 Vendor: PlanetLab
2 Packager: PlanetLab Central <support@planet-lab.org>
3 Distribution: PlanetLab 3.0
4 URL: http://cvs.planet-lab.org/cvs/myplc
5
6 Summary: PlanetLab Central (PLC) Portable Installation
7 Name: myplc
8 Version: 0.1
9 Release: 1%{?pldistro:.%{pldistro}}%{?date:.%{date}}
10 License: BSD
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 fc2
27 Summary: MyPLC installation based on Fedora Core 2
28 Group: Applications/Systems
29
30 %description fc2
31 This package installs a MyPLC installation based on Fedora Core 2.
32
33 %prep
34 %setup -q
35
36 %build
37 pushd myplc
38 ./build.sh -r 2 -d %{_datadir}
39 # Not until we can get the build server to run Fedora Core 4 or an
40 # updated version of yum.
41 #./build.sh -r 4 -d %{_datadir}
42 popd
43
44 # If run under sudo, allow user to delete the build directory
45 if [ -n "$SUDO_USER" ] ; then
46     chown -R $SUDO_USER .
47     # Some temporary chroot files like /var/empty/sshd and
48     # /usr/bin/sudo get created with non-readable permissions.
49     find . -not -perm +0600 -exec chmod u+rw {} \;
50 fi
51
52 %install
53 rm -rf $RPM_BUILD_ROOT
54
55 pushd myplc
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 #for releasever in 2 4 ; do
59 for releasever in 2 ; do
60     install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/plc/fc$releasever
61     install -D -m 644 fc$releasever.img $RPM_BUILD_ROOT/%{_datadir}/plc/fc$releasever.img
62     find data$releasever | cpio -p -d -u $RPM_BUILD_ROOT/%{_datadir}/plc/
63 done
64 popd
65
66 %clean
67 rm -rf $RPM_BUILD_ROOT
68
69 # If run under sudo, allow user to delete the built RPM
70 if [ -n "$SUDO_USER" ] ; then
71     chown $SUDO_USER %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
72 fi
73
74 %post
75 chkconfig --add plc
76 chkconfig plc on
77
78 %preun
79 # 0 = erase, 1 = upgrade
80 if [ $1 -eq 0 ] ; then
81     chkconfig plc off
82     chkconfig --del plc
83 fi
84
85 %files
86 %defattr(-,root,root,-)
87 %{_sysconfdir}/init.d/plc
88 %config(noreplace) %{_sysconfdir}/sysconfig/plc
89
90 %files fc2
91 %defattr(-,root,root,-)
92 %dir %{_datadir}/plc/fc2
93 %{_datadir}/plc/fc2.img
94 %config(noreplace) %{_datadir}/plc/data2
95
96 %changelog
97 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
98 - Initial build.
99