- stop plc services before upgrading
[myplc.git] / myplc.spec
1 Vendor: PlanetLab
2 Packager: PlanetLab Central <support@planet-lab.org>
3 Distribution: PlanetLab 3.3
4 URL: http://cvs.planet-lab.org/cvs/myplc
5
6 Summary: PlanetLab Central (PLC) Portable Installation
7 Name: myplc
8 Version: 0.2
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 %prep
27 %setup -q
28
29 %build
30 pushd myplc
31 ./build.sh -r 2
32 # Not until we can get the build server to run Fedora Core 4 or an
33 # updated version of yum.
34 #./build.sh -r 4
35 popd
36
37 %install
38 rm -rf $RPM_BUILD_ROOT
39
40 pushd myplc
41
42 # Install host startup script and configuration file
43 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc
44 install -D -m 644 plc.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc
45
46 # Create convenient symlink
47 install -d -m 755 $RPM_BUILD_ROOT/%{_sysconfdir}
48 ln -sf /plc/data/etc/planetlab $RPM_BUILD_ROOT/%{_sysconfdir}/planetlab
49
50 # Install root filesystem
51 install -d -m 755 $RPM_BUILD_ROOT/plc/root
52 install -D -m 644 root.img $RPM_BUILD_ROOT/plc/root.img
53
54 # Install data directory
55 find data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
56
57 popd
58
59 %clean
60 rm -rf $RPM_BUILD_ROOT
61
62 # If run under sudo
63 if [ -n "$SUDO_USER" ] ; then
64     # Allow user to delete the build directory
65     chown -R $SUDO_USER .
66     # Some temporary cdroot files like /var/empty/sshd and
67     # /usr/bin/sudo get created with non-readable permissions.
68     find . -not -perm +0600 -exec chmod u+rw {} \;
69     # Allow user to delete the built RPM(s)
70     chown -R $SUDO_USER %{_rpmdir}/%{_arch}
71 fi
72
73 %pre
74 if [ -x %{_sysconfdir}/init.d/plc ] ; then
75     service plc stop
76 fi
77
78 %post
79 chkconfig --add plc
80 chkconfig plc on
81
82 %preun
83 # 0 = erase, 1 = upgrade
84 if [ $1 -eq 0 ] ; then
85     chkconfig plc off
86     chkconfig --del plc
87 fi
88
89 %files
90 %defattr(-,root,root,-)
91 # Host startup script and configuration file
92 %{_sysconfdir}/init.d/plc
93 %{_sysconfdir}/sysconfig/plc
94
95 # Symlink to /etc/planetlab within data directory
96 %{_sysconfdir}/planetlab
97
98 # Root filesystem
99 /plc/root.img
100 /plc/root
101
102 # Data directory
103 %dir /plc/data
104 %config(noreplace) /plc/data/*
105
106 %changelog
107 * Wed Apr  5 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.2-1
108 - Basic functionality complete. Consolidate into a single package
109   installed in /plc.
110
111 * Fri Mar 17 2006 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.1-1
112 - Initial build.
113