]>
Commit | Line | Data |
---|---|---|
5e97c3fc | 1 | # |
2 | # lxc: linux Container library | |
3 | # | |
4 | # (C) Copyright IBM Corp. 2007, 2008 | |
5 | # | |
6 | # Authors: | |
7 | # Daniel Lezcano <dlezcano at fr.ibm.com> | |
8 | # | |
9 | # This library is free software; you can redistribute it and/or | |
10 | # modify it under the terms of the GNU Lesser General Public | |
11 | # License as published by the Free Software Foundation; either | |
12 | # version 2.1 of the License, or (at your option) any later version. | |
13 | # | |
14 | # This library is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | # Lesser General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU Lesser General Public | |
20 | # License along with this library; if not, write to the Free Software | |
21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | ||
23 | %define _unpackaged_files_terminate_build 0 | |
24 | ||
25 | %define RELEASE 1 | |
26 | %define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE: %RELEASE} | |
27 | ||
28 | # | |
29 | # Arguments that can be passed to the rpm builder: | |
30 | # | |
31 | # --define 'confargs <extra args to configure args>' (def. '') | |
32 | # | |
33 | ||
34 | %{!?confargs: %{expand:%%define confargs ''}} | |
35 | ||
36 | # What kernel are we building for? | |
37 | %{!?kernel: %{expand:%%define kernel %(uname -r)}} | |
38 | ||
39 | %define _prefix /usr | |
40 | ||
41 | Name: @PACKAGE@ | |
42 | Version: @VERSION@ | |
43 | Release: %{rel} | |
44 | Packager: <dlezcano@fr.ibm.com> | |
45 | URL: http://lxc.sourceforge.net | |
46 | Summary: %name | |
47 | Group: Applications/System | |
48 | License: LGPL | |
49 | Source: %name/%name-%version.tar.gz | |
50 | BuildRoot: %_tmppath/%name-%version-root | |
51 | ||
52 | %description | |
805415fc | 53 | |
54 | The package "%name" provides the command lines to create and manage | |
55 | containers. It contains a full featured container with the isolation | |
56 | / virtualization of the pids, the ipc, the utsname, the mount points, | |
57 | /proc, /sys, the network and it takes into account the control groups. | |
58 | It is very light, flexible, and provides a set of tools around the | |
59 | container like the monitoring with asynchronous events notification, | |
60 | or the freeze of the container. This package is useful to create | |
61 | Virtual Private Server, or to run isolated applications like bash or | |
62 | sshd. | |
5e97c3fc | 63 | |
64 | %package devel | |
65 | Release: %{rel} | |
66 | Summary: development library for %{name} | |
805415fc | 67 | Requires: libcap |
5e97c3fc | 68 | Group: Application/System |
69 | ||
70 | %description devel | |
805415fc | 71 | The %{name}-devel package contains header files and library needed for |
72 | development of containers | |
5e97c3fc | 73 | |
74 | %prep | |
75 | %setup -q | |
76 | ||
77 | %build | |
693dcea5 | 78 | |
79 | # I don't understand why but I have to specify this prefix :( | |
13832f48 | 80 | %configure $args %{confargs} --prefix=/ |
5e97c3fc | 81 | |
82 | ncpus=`egrep -c "^cpu[0-9]+" /proc/stat || :` | |
83 | make -j$ncpus | |
84 | ||
85 | %install | |
86 | rm -rf %{buildroot} | |
805415fc | 87 | |
5e97c3fc | 88 | %makeinstall |
89 | ||
90 | %clean | |
91 | rm -rf %{buildroot} | |
92 | ||
93 | %post | |
805415fc | 94 | if [ -d /var/lxc ]; then |
95 | for i in $(ls -1 /var/lxc); do | |
96 | chmod -fR go-rwx /var/lxc/$i | |
97 | done | |
98 | mv /var/lxc /var/lxc.rpm-$$ | |
99 | fi | |
100 | ||
101 | mkdir -p /var/lxc | |
102 | ||
103 | if [ -d /var/lxc.rpm-$$ ]; then | |
104 | for i in $(ls -1 /var/lxc.rpm-$$); do | |
105 | cp -a /var/lxc.rpm-$$/$i /var/lxc | |
106 | done | |
107 | fi | |
108 | ||
109 | chmod ugo+w /var/lxc | |
110 | ||
693dcea5 | 111 | PATH=$PATH:/usr/sbin:/sbin |
112 | ||
113 | which setcap 2>&1 > /dev/null | |
114 | RES=$? | |
115 | ||
116 | if [ $RES != 0 ]; then | |
117 | echo -e "\t********************WARNING*************************" | |
118 | echo -e "\t* The 'setcap' command was not found, this is not *" | |
119 | echo -e "\t* a problem and the 'lxc' package is installed but *" | |
120 | echo -e "\t* you will have to run the 'lxc' commands as root. *" | |
121 | echo -e "\t* If you wish to run these commands as a non-root *" | |
122 | echo -e "\t* user, you will need to install libcap-2 package *" | |
6ebc80f8 | 123 | echo -e "\t* and reinstall lxc *" |
693dcea5 | 124 | echo -e "\t****************************************************" |
125 | else | |
13832f48 | 126 | setcap cap_setpcap,cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep \ |
127 | %{_bindir}/lxc-execute && \ | |
128 | setcap cap_setpcap,cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep \ | |
129 | %{_bindir}/lxc-start && \ | |
130 | setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep \ | |
131 | %{_bindir}/lxc-restart && \ | |
132 | setcap cap_net_admin,cap_net_raw,cap_sys_admin,cap_dac_override=ep \ | |
133 | %{_bindir}/lxc-unshare && \ | |
134 | setcap cap_sys_admin=ep \ | |
135 | %{_bindir}/lxc-init && | |
136 | setcap cap_sys_admin=ep \ | |
137 | %{_bindir}/lxc-netstat | |
693dcea5 | 138 | fi |
139 | ||
5e97c3fc | 140 | |
141 | %files | |
142 | %defattr(-,root,root) | |
143 | %{_sysconfdir}/%{name}/* | |
c2cc9f0a | 144 | %{_libdir}/*.so* |
5e97c3fc | 145 | %{_bindir}/* |
d823d5b9 | 146 | %{_mandir}/* |
5e97c3fc | 147 | |
148 | %files devel | |
149 | %defattr(-,root,root) | |
150 | %{_includedir}/%{name}/* | |
151 | %{_libdir}/*.a | |
152 | ||
c2cc9f0a | 153 | %post devel |
c2cc9f0a | 154 | |
5e97c3fc | 155 | %changelog |
b4915399 | 156 | |
b4915399 | 157 | * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - Version 0.1.0 |
5e97c3fc | 158 | - Initial RPM release. |
159 | ||
160 | # Local variables: | |
161 | # mode: shell-script | |
162 | # sh-shell: rpm | |
163 | # end: |