]>
Commit | Line | Data |
---|---|---|
1 | %define rcver rc1 | |
2 | Summary: Tools and library to control and monitor control groups | |
3 | Summary(pl.UTF-8): Narzędzia i biblioteka do kontrolowania i monitorowania grup kontroli | |
4 | Name: libcgroup | |
5 | Version: 0.40 | |
6 | Release: 0.%{rcver}.1 | |
7 | License: LGPL v2+ | |
8 | Group: Libraries | |
9 | Source0: http://downloads.sourceforge.net/libcg/%{name}-%{version}.%{rcver}.tar.bz2 | |
10 | # Source0-md5: 979624adc559f534b34099f4dba7576d | |
11 | Source1: cgconfig.init | |
12 | Source2: cgred.init | |
13 | Source3: cgconfig.service | |
14 | Source4: cgred.service | |
15 | Source5: cgred.sysconfig | |
16 | Patch0: %{name}-pam.patch | |
17 | Patch1: %{name}-conf.patch | |
18 | URL: http://libcg.sourceforge.net/ | |
19 | BuildRequires: autoconf >= 2.61 | |
20 | BuildRequires: automake | |
21 | BuildRequires: bison | |
22 | BuildRequires: flex | |
23 | BuildRequires: libstdc++-devel | |
24 | BuildRequires: libtool | |
25 | BuildRequires: pam-devel | |
26 | BuildRequires: rpmbuild(macros) >= 1.626 | |
27 | Requires(post): /sbin/ldconfig | |
28 | Requires(post,preun): /sbin/chkconfig | |
29 | Requires(postun): /usr/sbin/groupdel | |
30 | Requires(pre): /usr/bin/getgid | |
31 | Requires(pre): /usr/sbin/groupadd | |
32 | Requires(post,preun,postun): systemd-units >= 38 | |
33 | Requires: procps | |
34 | Requires: rc-scripts | |
35 | Requires: systemd-units >= 38 | |
36 | Provides: group(cgred) | |
37 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
38 | ||
39 | %define _exec_prefix %{nil} | |
40 | %define _libdir %{_prefix}/%{_lib} | |
41 | ||
42 | %description | |
43 | Control groups infrastructure. The tools and library help manipulate, | |
44 | control, administrate and monitor control groups and the associated | |
45 | controllers. | |
46 | ||
47 | %description -l pl.UTF-8 | |
48 | Ten pakiet stanowi infrastrukturę grup kontroli (cgroups). Narzędzia i | |
49 | biblioteka pomagają modyfikować, sterować, administrować i modyfikować | |
50 | grupy kontroli i powiązane z nimi kontrolery. | |
51 | ||
52 | %package devel | |
53 | Summary: Header files for cgroup library | |
54 | Summary(pl.UTF-8): Pliki nagłówkowe biblioteki cgroup | |
55 | Group: Development/Libraries | |
56 | Requires: %{name} = %{version}-%{release} | |
57 | ||
58 | %description devel | |
59 | It provides API to create/delete and modify cgroup nodes. It will also | |
60 | in the future allow creation of persistent configuration for control | |
61 | groups and provide scripts to manage that configuration. | |
62 | ||
63 | %description devel -l pl.UTF-8 | |
64 | Ten pakiet udostępnia API do tworzenia, usuwania i modyfikowania | |
65 | węzłów cgroup. W przyszłości pozwoli także na tworzenie trwałej | |
66 | konfiguracji grup kontroli i udostępni skrypty do zarządzania taką | |
67 | konfiguracją. | |
68 | ||
69 | %package -n pam-pam_cgroup | |
70 | Summary: PAM module for libcgroup | |
71 | Summary(pl.UTF-8): Moduł PAM dla libcgroup | |
72 | Group: Libraries | |
73 | Requires: %{name} = %{version}-%{release} | |
74 | Obsoletes: libcgroup-pam | |
75 | ||
76 | %description -n pam-pam_cgroup | |
77 | PAM module for libcgroup. | |
78 | ||
79 | %description -n pam-pam_cgroup -l pl.UTF-8 | |
80 | Moduł PAM dla libcgroup. | |
81 | ||
82 | %prep | |
83 | %setup -q -n %{name}-%{version}.%{rcver} | |
84 | %patch0 -p1 | |
85 | %patch1 -p1 | |
86 | ||
87 | %build | |
88 | %{__libtoolize} | |
89 | %{__aclocal} | |
90 | %{__autoconf} | |
91 | %{__automake} | |
92 | %configure \ | |
93 | --disable-silent-rules \ | |
94 | --enable-initscript-install \ | |
95 | --enable-pam-module-dir=/%{_lib}/security \ | |
96 | --enable-opaque-hierarchy="name=systemd" | |
97 | ||
98 | %{__make} | |
99 | ||
100 | %install | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}} | |
103 | ||
104 | %{__make} install \ | |
105 | DESTDIR=$RPM_BUILD_ROOT | |
106 | ||
107 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/cgconfig | |
108 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/cgred | |
109 | ||
110 | install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/cgconfig.service | |
111 | install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/cgred.service | |
112 | ||
113 | install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/cgred | |
114 | cp -a samples/cg{config,rules,snapshot_blacklist}.conf $RPM_BUILD_ROOT%{_sysconfdir} | |
115 | ||
116 | mv $RPM_BUILD_ROOT%{_libdir}/libcgroup.so.* $RPM_BUILD_ROOT/%{_lib} | |
117 | ln -snf ../../%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libcgroup.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/libcgroup.so | |
118 | ||
119 | %{__rm} $RPM_BUILD_ROOT/%{_lib}/security/pam_cgroup.la | |
120 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la | |
121 | ||
122 | %clean | |
123 | rm -rf $RPM_BUILD_ROOT | |
124 | ||
125 | %pre | |
126 | %groupadd -g 261 -r -f cgred | |
127 | ||
128 | %post | |
129 | /sbin/ldconfig | |
130 | /sbin/chkconfig --add cgred | |
131 | /sbin/chkconfig --add cgconfig | |
132 | if [ ! -f /var/lock/subsys/cgconfig ]; then | |
133 | echo 'Run "/sbin/service cgconfig start" to setup cgroup rules.' | |
134 | fi | |
135 | if [ ! -f /var/lock/subsys/cgred ]; then | |
136 | echo 'Run "/sbin/service cgred start" to start control group rules daemon.' | |
137 | fi | |
138 | NORESTART=1 | |
139 | %systemd_post cgconfig.service | |
140 | %systemd_post cgred.service | |
141 | ||
142 | %preun | |
143 | if [ $1 = 0 ]; then | |
144 | %service cgred stop | |
145 | %service cgconfig stop | |
146 | /sbin/chkconfig --del cgconfig | |
147 | /sbin/chkconfig --del cgred | |
148 | fi | |
149 | %systemd_preun cgconfig.service | |
150 | %systemd_preun cgred.service | |
151 | ||
152 | %postun | |
153 | /sbin/ldconfig | |
154 | if [ "$1" = "0" ]; then | |
155 | %groupremove cgred | |
156 | fi | |
157 | %systemd_reload | |
158 | ||
159 | %triggerpostun -- %{name} < 0.38-0.rc1.1 | |
160 | if [ -f /etc/sysconfig/cgred.conf.rpmsave ]; then | |
161 | . /etc/sysconfig/cgred.conf.rpmsave | |
162 | OPTIONS= | |
163 | [ -n "$NODAEMON" ] && OPTIONS="$OPTIONS $NODAEMON" | |
164 | [ -n "$LOG" ] && OPTIONS="$OPTIONS $LOG" | |
165 | if [ -n "$LOG_FILE" ]; then | |
166 | OPTIONS="$OPTIONS -f $LOG_FILE" | |
167 | else | |
168 | OPTIONS="$OPTIONS -s" | |
169 | fi | |
170 | [ -n "$SOCKET_USER" ] && OPTIONS="$OPTIONS -u $SOCKET_USER" | |
171 | if [ -n "$SOCKET_GROUP" ]; then | |
172 | OPTIONS="$OPTIONS -g $SOCKET_GROUP" | |
173 | else | |
174 | OPTIONS="$OPTIONS -g cgred" | |
175 | fi | |
176 | echo >>/etc/sysconfig/cgred | |
177 | echo "# Added by rpm trigger" >>/etc/sysconfig/cgred | |
178 | echo "OPTIONS=\"$OPTIONS\"" >>/etc/sysconfig/cgred | |
179 | fi | |
180 | %systemd_trigger cgconfig.service | |
181 | %systemd_trigger cgred.service | |
182 | ||
183 | %files | |
184 | %defattr(644,root,root,755) | |
185 | %doc README README_daemon | |
186 | %attr(754,root,root) /etc/rc.d/init.d/cgconfig | |
187 | %attr(754,root,root) /etc/rc.d/init.d/cgred | |
188 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cgred | |
189 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cg*.conf | |
190 | %{systemdunitdir}/cgconfig.service | |
191 | %{systemdunitdir}/cgred.service | |
192 | %attr(755,root,root) /%{_lib}/libcgroup.so.*.*.* | |
193 | %attr(755,root,root) %ghost /%{_lib}/libcgroup.so.1 | |
194 | %attr(755,root,root) /bin/cgclassify | |
195 | %attr(755,root,root) /bin/cgcreate | |
196 | %attr(755,root,root) /bin/cgdelete | |
197 | %attr(755,root,root) /bin/cgexec | |
198 | %attr(755,root,root) /bin/cgget | |
199 | %attr(755,root,root) /bin/cgset | |
200 | %attr(755,root,root) /bin/cgsnapshot | |
201 | %attr(755,root,root) /bin/lscgroup | |
202 | %attr(755,root,root) /bin/lssubsys | |
203 | %attr(755,root,root) /sbin/cgclear | |
204 | %attr(755,root,root) /sbin/cgconfigparser | |
205 | %attr(755,root,root) /sbin/cgrulesengd | |
206 | %{_mandir}/man1/ls*.1* | |
207 | %{_mandir}/man1/cg*.1* | |
208 | %{_mandir}/man5/cg*.5* | |
209 | %{_mandir}/man8/cg*.8* | |
210 | ||
211 | %files -n pam-pam_cgroup | |
212 | %defattr(644,root,root,755) | |
213 | %attr(755,root,root) /%{_lib}/security/pam_cgroup.so | |
214 | ||
215 | %files devel | |
216 | %defattr(644,root,root,755) | |
217 | %attr(755,root,root) %{_libdir}/libcgroup.so | |
218 | %{_includedir}/libcgroup | |
219 | %{_includedir}/libcgroup.h | |
220 | %{_pkgconfigdir}/libcgroup.pc |