MyPLC: portable self-contained PLC installation
[myplc.git] / myplc.spec
1 # Fedora Core release version to base the installation on. Currently
2 # supported: 2, 4.
3 %define releasever 2
4
5 Vendor: PlanetLab
6 Packager: PlanetLab Central <support@planet-lab.org>
7 Distribution: PlanetLab 3.0
8 URL: http://cvs.planet-lab.org/cvs/myplc
9
10 Summary: PlanetLab Central (PLC) Portable Installation
11 Name: myplc
12 Version: %{releasever}.0
13 Release: 1
14 License: BSD
15 Group: Applications/Systems
16 Source0: %{name}-%{version}.tar.gz
17 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
18
19 %define debug_package %{nil}
20
21 %description
22 MyPLC is a complete PlanetLab Central (PLC) portable installation
23 contained within a chroot jail. The default installation consists of a
24 web server, an XML-RPC API server, a boot server, and a database
25 server: the core components of PLC. The installation may be customized
26 through a graphical interface. All PLC services are started up and
27 shut down through a single System V init script installed in the host
28 system.
29
30 %prep
31 %setup -q
32
33 %build
34 cd myplc
35 ./build.sh -r %{releasever} -d %{_datadir}
36
37 # If run under sudo, allow user to delete the build directory
38 if [ -n "$SUDO_USER" ] ; then
39     chown -R $SUDO_USER .
40     # Some temporary chroot files like /var/empty/sshd and
41     # /usr/bin/sudo get created with non-readable permissions.
42     find . -not -perm +0600 -exec chmod u+rw {} \;
43 fi
44
45 %install
46 rm -rf $RPM_BUILD_ROOT
47
48 cd myplc
49 install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/plc/fc%{releasever}
50 install -D -m 644 fc%{releasever}.img $RPM_BUILD_ROOT/%{_datadir}/plc/fc%{releasever}.img
51 find data%{releasever} | cpio -p -d -u $RPM_BUILD_ROOT/%{_datadir}/plc/
52 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
53 install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
54
55 %clean
56 rm -rf $RPM_BUILD_ROOT
57
58 # If run under sudo, allow user to delete the built RPM
59 if [ -n "$SUDO_USER" ] ; then
60     chown $SUDO_USER %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
61 fi
62
63 %post
64 chkconfig --add plc
65 chkconfig plc on
66
67 %preun
68 # 0 = erase, 1 = upgrade
69 if [ $1 -eq 0 ] ; then
70     chkconfig plc off
71     chkconfig --del plc
72 fi
73
74 %files
75 %defattr(-,root,root,-)
76 %dir %{_datadir}/plc/fc%{releasever}
77 %{_datadir}/plc/fc%{releasever}.img
78 %{_datadir}/plc/data%{releasever}
79 %{_sysconfdir}/init.d/plc
80 %{_sysconfdir}/sysconfig/plc
81
82 %changelog
83 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
84 - Initial build.
85