fix distroname conditional
[myplc.git] / myplc-devel.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) Development Environment
7 Name: myplc-devel
8 Version: 0.5
9 Release: 3%{?pldistro:.%{pldistro}}%{?date:.%{date}}
10 License: PlanetLab
11 Group: Development/Tools
12 Source0: %{name}-%{version}.tar.gz
13 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
14 AutoReqProv: no
15
16 %define debug_package %{nil}
17
18 %description
19 This package installs a complete PlanetLab development environment
20 contained within a chroot jail. The default installation consists of
21 all the tools necessary to compile MyPLC.
22
23 %prep
24 %setup -q
25
26 %build
27 pushd MyPLC
28 ./build_devel.sh
29 popd
30
31 %install
32 rm -rf $RPM_BUILD_ROOT
33
34 pushd MyPLC
35
36 # Install host startup script and configuration file
37 install -D -m 755 host.init $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/plc-devel
38 install -D -m 644 plc-devel.sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/plc-devel
39
40 # Install root filesystem
41 install -d -m 755 $RPM_BUILD_ROOT/plc/devel/root
42 install -D -m 644 devel/root.img $RPM_BUILD_ROOT/plc/devel/root.img
43
44 # Install data directory
45 find devel/data | cpio -p -d -u $RPM_BUILD_ROOT/plc/
46
47 popd
48
49 %clean
50 rm -rf $RPM_BUILD_ROOT
51
52 # If run under sudo
53 if [ -n "$SUDO_USER" ] ; then
54     # Allow user to delete the build directory
55     chown -h -R $SUDO_USER .
56     # Some temporary cdroot files like /var/empty/sshd and
57     # /usr/bin/sudo get created with non-readable permissions.
58     find . -not -perm +0600 -exec chmod u+rw {} \;
59     # Allow user to delete the built RPM(s)
60     chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
61 fi
62
63 %pre
64 if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then
65     %{_sysconfdir}/init.d/plc-devel stop
66 fi
67
68 %post
69 if [ -x /sbin/chkconfig ] ; then
70     /sbin/chkconfig --add plc-devel
71     /sbin/chkconfig plc-devel on
72 fi
73
74 %preun
75 # 0 = erase, 1 = upgrade
76 if [ $1 -eq 0 ] ; then
77     %{_sysconfdir}/init.d/plc-devel stop
78     if [ -x /sbin/chkconfig ] ; then
79         /sbin/chkconfig plc-devel off
80         /sbin/chkconfig --del plc-devel
81     fi
82 fi
83
84 %files
85 %defattr(-,root,root,-)
86 # Host startup script and configuration file
87 %{_sysconfdir}/init.d/plc-devel
88 %{_sysconfdir}/sysconfig/plc-devel
89
90 # Root filesystem
91 /plc/devel/root.img
92 /plc/devel/root
93
94 # Data directory
95 %dir /plc/devel/data
96 %config(noreplace) /plc/devel/data/*
97
98 %changelog
99 * Fri Jan 19 2007 Mark Huang <mlhuang@CS.Princeton.EDU> - 0.5-3
100 - Initial build.