- treat /etc/sysconfig/plc as a noreplace config file
[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%{?pldistro:.%{pldistro}}%{?date:.%{date}}
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 pushd myplc
35 ./build.sh -r %{releasever} -d %{_datadir}
36 popd
37
38 # If run under sudo, allow user to delete the build directory
39 if [ -n "$SUDO_USER" ] ; then
40     chown -R $SUDO_USER .
41     # Some temporary chroot files like /var/empty/sshd and
42     # /usr/bin/sudo get created with non-readable permissions.
43     find . -not -perm +0600 -exec chmod u+rw {} \;
44 fi
45
46 %install
47 rm -rf $RPM_BUILD_ROOT
48
49 pushd myplc
50 install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/plc/fc%{releasever}
51 install -D -m 644 fc%{releasever}.img $RPM_BUILD_ROOT/%{_datadir}/plc/fc%{releasever}.img
52 find data%{releasever} | cpio -p -d -u $RPM_BUILD_ROOT/%{_datadir}/plc/
53 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
54 install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
55 popd
56
57 %clean
58 rm -rf $RPM_BUILD_ROOT
59
60 # If run under sudo, allow user to delete the built RPM
61 if [ -n "$SUDO_USER" ] ; then
62     chown $SUDO_USER %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
63 fi
64
65 %post
66 chkconfig --add plc
67 chkconfig plc on
68
69 %preun
70 # 0 = erase, 1 = upgrade
71 if [ $1 -eq 0 ] ; then
72     chkconfig plc off
73     chkconfig --del plc
74 fi
75
76 %files
77 %defattr(-,root,root,-)
78 %dir %{_datadir}/plc/fc%{releasever}
79 %{_datadir}/plc/fc%{releasever}.img
80 %{_datadir}/plc/data%{releasever}
81 %{_sysconfdir}/init.d/plc
82 %config(noreplace) %{_sysconfdir}/sysconfig/plc
83
84 %changelog
85 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
86 - Initial build.
87