1 |
commit: 07b76b118c8ea9c922b5686d335b499fff5a7fb9 |
2 |
Author: Matthias Maier <tamiko <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 30 21:39:09 2016 +0000 |
4 |
Commit: Matthias Maier <tamiko <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 30 21:39:09 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07b76b11 |
7 |
|
8 |
Revert "app-emulation/libvirt: drop old versions 1.2.21, 1.3.1" |
9 |
|
10 |
This reverts commit 31eba666d070804f00c7285f4d2f9f7ea6b672c7. |
11 |
|
12 |
app-emulation/libvirt/Manifest | 3 + |
13 |
.../libvirt-1.2.17-fix_paths_for_apparmor.patch | 148 ++++++++ |
14 |
.../files/libvirt-1.2.9-do_not_use_sysconf.patch | 112 ++++++ |
15 |
app-emulation/libvirt/files/libvirt-guests.init-r1 | 235 +++++++++++++ |
16 |
app-emulation/libvirt/files/libvirtd.init-r15 | 38 ++ |
17 |
app-emulation/libvirt/libvirt-1.2.21-r2.ebuild | 380 ++++++++++++++++++++ |
18 |
app-emulation/libvirt/libvirt-1.3.1-r1.ebuild | 385 +++++++++++++++++++++ |
19 |
7 files changed, 1301 insertions(+) |
20 |
|
21 |
diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest |
22 |
index 3c3efc0..c416f0f 100644 |
23 |
--- a/app-emulation/libvirt/Manifest |
24 |
+++ b/app-emulation/libvirt/Manifest |
25 |
@@ -1,2 +1,5 @@ |
26 |
+DIST libvirt-1.2.21-20151222.tar.xz 1684 SHA256 6c97f288470ec58bcbe98507563c6a191892c6f8813a7b9688c09b823934cbe5 SHA512 4fd43f0e12434b78ac3e671ad8eb0e402d384cff6278f6d0db322a068c2c8807c7c7f7e5774aa9d19e2a85e49f6d9888908b32fca5fc04980134edaccba0afe2 WHIRLPOOL 2bfbc3cbf1ca44a2bb06ddf2e8eabeb116165560b9c73d649d7b8cc9baba851f5e9246414bfc2c4740f27d0d0d42b6176eaec43b05e8c1e54de2804150c2cde1 |
27 |
+DIST libvirt-1.2.21.tar.gz 29848954 SHA256 8d406582f5fe88d739d1d83e0ba7ac7f91f5a8da4be82162ab85631744d8925b SHA512 5c15d0ba5d75c13f735c6a60dfdbad007426f77e113f95894d520f7fc358fa4361d5cce7bb9a548a436f323b845f13b8940abbad568b8b146418430068bb970e WHIRLPOOL d53bbb07c85b3aa2d9b0f38ff2edd3cd0a2a5300627f3e2f0a82bc057303617cab9d6f1d8a9a771bd968b0496d38d3a39a0154f88bdca44dda359a65fdc2c650 |
28 |
+DIST libvirt-1.3.1.tar.gz 29900143 SHA256 a5d43fbed34d31eeffc641d2ac9b6026a57bf1a4fa74d0fa19a9891d9ec2c21a SHA512 a109c09d947f7c5e924fdbc9c9b6c0a9d6ff64d9411aedd9a3e710d20f749b088ff9895e882dd888b88bfea7724a8933534be4078f16cb9d2047da761515e804 WHIRLPOOL 62fb8486bfa53d55b397d9a90750d32a83f0a73cf2e6685f296489390abf9c62efc69fecd6d011fc51e9f562f75f5b8ce03208c350e98d20de0a5560721c675e |
29 |
DIST libvirt-1.3.4.tar.gz 30493908 SHA256 e2396ebebb3f3fdb50429ce8faa99559f6e8e3cc0493d5fa0c1999db189c25bd SHA512 6f85e4cd8a696da729bb88368c608694119258c6ab7f9b99f41c34a6cc4492d9ad90b8ff1574fd4ee6c78c674a3a501db60d1d3ba898f7013321ecc996612919 WHIRLPOOL af4a8a0e3d746f50e0f9d95e3920c023c5bbec0d7c641f43aea580db9b95a793027f7579ecd94625a68b7e3662c328d94b7b2d243afea60a8d2f31cab1cc9319 |
30 |
DIST libvirt-1.3.5.tar.gz 35109092 SHA256 93a23c44eb431da46c9458f95a66e29c9b98e37515d44b6be09e75b35ec94ac8 SHA512 6c6a09623d3d4d426311bfa7039f5e39584d5f891b8e761bbdb3022601ea066b8e1c3f8d609326e8ba4081ae40b7b03086fbc8ba5759d218b8616ec98200a89d WHIRLPOOL 88ac308cc461efff842c27e40263a3b25ce0bc0ca310fb6e9def9126ab893fe43aed01bda9fc3615439ee797c36e2800f741b346e0b3d96aac64e7909c269879 |
31 |
|
32 |
diff --git a/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch b/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch |
33 |
new file mode 100644 |
34 |
index 0000000..c608295 |
35 |
--- /dev/null |
36 |
+++ b/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch |
37 |
@@ -0,0 +1,148 @@ |
38 |
+diff --git a/examples/apparmor/Makefile.am b/examples/apparmor/Makefile.am |
39 |
+index 7a20e16..c3c67b6 100644 |
40 |
+--- a/examples/apparmor/Makefile.am |
41 |
++++ b/examples/apparmor/Makefile.am |
42 |
+@@ -19,13 +19,13 @@ EXTRA_DIST= \ |
43 |
+ TEMPLATE.lxc \ |
44 |
+ libvirt-qemu \ |
45 |
+ libvirt-lxc \ |
46 |
+- usr.lib.libvirt.virt-aa-helper \ |
47 |
++ usr.libexec.virt-aa-helper \ |
48 |
+ usr.sbin.libvirtd |
49 |
+ |
50 |
+ if WITH_APPARMOR_PROFILES |
51 |
+ apparmordir = $(sysconfdir)/apparmor.d/ |
52 |
+ apparmor_DATA = \ |
53 |
+- usr.lib.libvirt.virt-aa-helper \ |
54 |
++ usr.libexec.virt-aa-helper \ |
55 |
+ usr.sbin.libvirtd \ |
56 |
+ $(NULL) |
57 |
+ |
58 |
+diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper b/examples/apparmor/usr.lib.libvirt.virt-aa-helper |
59 |
+deleted file mode 100644 |
60 |
+index b34fb35..0000000 |
61 |
+--- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper |
62 |
++++ /dev/null |
63 |
+@@ -1,48 +0,0 @@ |
64 |
+-# Last Modified: Mon Apr 5 15:10:27 2010 |
65 |
+-#include <tunables/global> |
66 |
+- |
67 |
+-profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper { |
68 |
+- #include <abstractions/base> |
69 |
+- |
70 |
+- # needed for searching directories |
71 |
+- capability dac_override, |
72 |
+- capability dac_read_search, |
73 |
+- |
74 |
+- # needed for when disk is on a network filesystem |
75 |
+- network inet, |
76 |
+- |
77 |
+- deny @{PROC}/[0-9]*/mounts r, |
78 |
+- @{PROC}/[0-9]*/net/psched r, |
79 |
+- owner @{PROC}/[0-9]*/status r, |
80 |
+- @{PROC}/filesystems r, |
81 |
+- |
82 |
+- # for hostdev |
83 |
+- /sys/devices/ r, |
84 |
+- /sys/devices/** r, |
85 |
+- |
86 |
+- /usr/{lib,lib64}/libvirt/virt-aa-helper mr, |
87 |
+- /sbin/apparmor_parser Ux, |
88 |
+- |
89 |
+- /etc/apparmor.d/libvirt/* r, |
90 |
+- /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw, |
91 |
+- |
92 |
+- # for backingstore -- allow access to non-hidden files in @{HOME} as well |
93 |
+- # as storage pools |
94 |
+- audit deny @{HOME}/.* mrwkl, |
95 |
+- audit deny @{HOME}/.*/ rw, |
96 |
+- audit deny @{HOME}/.*/** mrwkl, |
97 |
+- audit deny @{HOME}/bin/ rw, |
98 |
+- audit deny @{HOME}/bin/** mrwkl, |
99 |
+- @{HOME}/ r, |
100 |
+- @{HOME}/** r, |
101 |
+- /var/lib/libvirt/images/ r, |
102 |
+- /var/lib/libvirt/images/** r, |
103 |
+- /{media,mnt,opt,srv}/** r, |
104 |
+- |
105 |
+- /**.img r, |
106 |
+- /**.qcow{,2} r, |
107 |
+- /**.qed r, |
108 |
+- /**.vmdk r, |
109 |
+- /**.[iI][sS][oO] r, |
110 |
+- /**/disk{,.*} r, |
111 |
+-} |
112 |
+diff --git a/examples/apparmor/usr.libexec.virt-aa-helper b/examples/apparmor/usr.libexec.virt-aa-helper |
113 |
+new file mode 100644 |
114 |
+index 0000000..b34fb35 |
115 |
+--- /dev/null |
116 |
++++ b/examples/apparmor/usr.libexec.virt-aa-helper |
117 |
+@@ -0,0 +1,48 @@ |
118 |
++# Last Modified: Mon Apr 5 15:10:27 2010 |
119 |
++#include <tunables/global> |
120 |
++ |
121 |
++profile virt-aa-helper /usr/libexec/virt-aa-helper { |
122 |
++ #include <abstractions/base> |
123 |
++ |
124 |
++ # needed for searching directories |
125 |
++ capability dac_override, |
126 |
++ capability dac_read_search, |
127 |
++ |
128 |
++ # needed for when disk is on a network filesystem |
129 |
++ network inet, |
130 |
++ |
131 |
++ deny @{PROC}/[0-9]*/mounts r, |
132 |
++ @{PROC}/[0-9]*/net/psched r, |
133 |
++ owner @{PROC}/[0-9]*/status r, |
134 |
++ @{PROC}/filesystems r, |
135 |
++ |
136 |
++ # for hostdev |
137 |
++ /sys/devices/ r, |
138 |
++ /sys/devices/** r, |
139 |
++ |
140 |
++ /usr/libexec/virt-aa-helper mr, |
141 |
++ /sbin/apparmor_parser Ux, |
142 |
++ |
143 |
++ /etc/apparmor.d/libvirt/* r, |
144 |
++ /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw, |
145 |
++ |
146 |
++ # for backingstore -- allow access to non-hidden files in @{HOME} as well |
147 |
++ # as storage pools |
148 |
++ audit deny @{HOME}/.* mrwkl, |
149 |
++ audit deny @{HOME}/.*/ rw, |
150 |
++ audit deny @{HOME}/.*/** mrwkl, |
151 |
++ audit deny @{HOME}/bin/ rw, |
152 |
++ audit deny @{HOME}/bin/** mrwkl, |
153 |
++ @{HOME}/ r, |
154 |
++ @{HOME}/** r, |
155 |
++ /var/lib/libvirt/images/ r, |
156 |
++ /var/lib/libvirt/images/** r, |
157 |
++ /{media,mnt,opt,srv}/** r, |
158 |
++ |
159 |
++ /**.img r, |
160 |
++ /**.qcow{,2} r, |
161 |
++ /**.qed r, |
162 |
++ /**.vmdk r, |
163 |
++ /**.[iI][sS][oO] r, |
164 |
++ /**/disk{,.*} r, |
165 |
++} |
166 |
+diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sbin.libvirtd |
167 |
+index 5d606e6..ab2f1a9 100644 |
168 |
+--- a/examples/apparmor/usr.sbin.libvirtd |
169 |
++++ b/examples/apparmor/usr.sbin.libvirtd |
170 |
+@@ -58,8 +58,10 @@ |
171 |
+ audit deny /sys/kernel/security/apparmor/.* rwxl, |
172 |
+ /sys/kernel/security/apparmor/profiles r, |
173 |
+ /usr/{lib,lib64}/libvirt/* PUxr, |
174 |
+- /usr/{lib,lib64}/libvirt/libvirt_parthelper ix, |
175 |
+- /usr/{lib,lib64}/libvirt/libvirt_iohelper ix, |
176 |
++ /usr/libexec/virt-aa-helper PUxr, |
177 |
++ /usr/libexec/libvirt_lxc PUxr, |
178 |
++ /usr/libexec/libvirt_parthelper ix, |
179 |
++ /usr/libexec/libvirt_iohelper ix, |
180 |
+ /etc/libvirt/hooks/** rmix, |
181 |
+ /etc/xen/scripts/** rmix, |
182 |
+ |
183 |
+-- |
184 |
+2.3.6 |
185 |
+ |
186 |
|
187 |
diff --git a/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch b/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch |
188 |
new file mode 100644 |
189 |
index 0000000..e766f49 |
190 |
--- /dev/null |
191 |
+++ b/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch |
192 |
@@ -0,0 +1,112 @@ |
193 |
+From 69372a32025ac16578ad277c6356e89713a3f9f4 Mon Sep 17 00:00:00 2001 |
194 |
+From: Matthias Maier <tamiko@××××××××××.org> |
195 |
+Date: Mon, 3 Nov 2014 00:51:35 +0100 |
196 |
+Subject: [PATCH] Do not use /etc/sysconf |
197 |
+ |
198 |
+--- |
199 |
+ daemon/Makefile.am | 4 +--- |
200 |
+ daemon/libvirtd.service.in | 3 +-- |
201 |
+ src/Makefile.am | 3 --- |
202 |
+ src/locking/virtlockd.service.in | 3 +-- |
203 |
+ tools/Makefile.am | 2 +- |
204 |
+ tools/libvirt-guests.service.in | 2 +- |
205 |
+ 6 files changed, 5 insertions(+), 12 deletions(-) |
206 |
+ |
207 |
+diff --git a/daemon/Makefile.am b/daemon/Makefile.am |
208 |
+index b95a79d..1e98422 100644 |
209 |
+--- a/daemon/Makefile.am |
210 |
++++ b/daemon/Makefile.am |
211 |
+@@ -328,9 +328,7 @@ uninstall-logrotate: |
212 |
+ rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || : |
213 |
+ |
214 |
+ install-sysconfig: |
215 |
+- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig |
216 |
+- $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \ |
217 |
+- $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd |
218 |
++ |
219 |
+ uninstall-sysconfig: |
220 |
+ rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd |
221 |
+ rmdir $(DESTDIR)$(sysconfdir)/sysconfig || : |
222 |
+diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in |
223 |
+index 1759ac8..cd337a1 100644 |
224 |
+--- a/daemon/libvirtd.service.in |
225 |
++++ b/daemon/libvirtd.service.in |
226 |
+@@ -10,8 +10,7 @@ Documentation=http://libvirt.org |
227 |
+ |
228 |
+ [Service] |
229 |
+ Type=notify |
230 |
+-EnvironmentFile=-/etc/sysconfig/libvirtd |
231 |
+-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS |
232 |
++ExecStart=@sbindir@/libvirtd |
233 |
+ ExecReload=/bin/kill -HUP $MAINPID |
234 |
+ KillMode=process |
235 |
+ Restart=on-failure |
236 |
+diff --git a/src/Makefile.am b/src/Makefile.am |
237 |
+index e65177f..18bbbb4 100644 |
238 |
+--- a/src/Makefile.am |
239 |
++++ b/src/Makefile.am |
240 |
+@@ -2269,9 +2269,6 @@ EXTRA_DIST += locking/virtlockd.sysconf \ |
241 |
+ locking/test_libvirt_lockd.aug.in |
242 |
+ |
243 |
+ install-sysconfig: |
244 |
+- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig |
245 |
+- $(INSTALL_DATA) $(srcdir)/locking/virtlockd.sysconf \ |
246 |
+- $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd |
247 |
+ |
248 |
+ uninstall-sysconfig: |
249 |
+ rm -f $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd |
250 |
+diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in |
251 |
+index 57089b0..ace0c83 100644 |
252 |
+--- a/src/locking/virtlockd.service.in |
253 |
++++ b/src/locking/virtlockd.service.in |
254 |
+@@ -5,8 +5,7 @@ Documentation=man:virtlockd(8) |
255 |
+ Documentation=http://libvirt.org |
256 |
+ |
257 |
+ [Service] |
258 |
+-EnvironmentFile=-/etc/sysconfig/virtlockd |
259 |
+-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS |
260 |
++ExecStart=@sbindir@/virtlockd |
261 |
+ ExecReload=/bin/kill -USR1 $MAINPID |
262 |
+ # Loosing the locks is a really bad thing that will |
263 |
+ # cause the machine to be fenced (rebooted), so make |
264 |
+diff --git a/tools/Makefile.am b/tools/Makefile.am |
265 |
+index 93d642d..2da0e97 100644 |
266 |
+--- a/tools/Makefile.am |
267 |
++++ b/tools/Makefile.am |
268 |
+@@ -259,7 +259,7 @@ uninstall-local: uninstall-init uninstall-systemd |
269 |
+ install-sysconfig: |
270 |
+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig |
271 |
+ $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ |
272 |
+- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests |
273 |
++ $(DESTDIR)$(sysconfdir)/libvirt/libvirt-guests.conf |
274 |
+ |
275 |
+ uninstall-sysconfig: |
276 |
+ rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests |
277 |
+diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in |
278 |
+index cc04b6d..9be514b 100644 |
279 |
+--- a/tools/libvirt-guests.service.in |
280 |
++++ b/tools/libvirt-guests.service.in |
281 |
+@@ -5,7 +5,7 @@ Documentation=man:libvirtd(8) |
282 |
+ Documentation=http://libvirt.org |
283 |
+ |
284 |
+ [Service] |
285 |
+-EnvironmentFile=-/etc/sysconfig/libvirt-guests |
286 |
++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf |
287 |
+ # Hack just call traditional service until we factor |
288 |
+ # out the code |
289 |
+ ExecStart=@libexecdir@/libvirt-guests.sh start |
290 |
+--- a/tools/libvirt-guests.sysconf |
291 |
++++ b/tools/libvirt-guests.sysconf |
292 |
+@@ -1,3 +1,10 @@ |
293 |
++# |
294 |
++# Warning: This configuration file is only sourced by the systemd |
295 |
++# libvirt-guests.service unit. The coresponding openrc facility is in |
296 |
++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd |
297 |
++# |
298 |
++ |
299 |
++ |
300 |
+ # URIs to check for running guests |
301 |
+ # example: URIS='default xen:/// vbox+tcp://host/system lxc:///' |
302 |
+ #URIS=default |
303 |
+-- |
304 |
+2.0.4 |
305 |
|
306 |
diff --git a/app-emulation/libvirt/files/libvirt-guests.init-r1 b/app-emulation/libvirt/files/libvirt-guests.init-r1 |
307 |
new file mode 100644 |
308 |
index 0000000..6d81469 |
309 |
--- /dev/null |
310 |
+++ b/app-emulation/libvirt/files/libvirt-guests.init-r1 |
311 |
@@ -0,0 +1,235 @@ |
312 |
+#!/sbin/openrc-run |
313 |
+ |
314 |
+description="Virtual Machine Management (libvirt) Guests" |
315 |
+ |
316 |
+depend() { |
317 |
+ need libvirtd |
318 |
+} |
319 |
+ |
320 |
+# set the default to QEMU |
321 |
+[ -z "${LIBVIRT_URIS}" ] && LIBVIRT_URIS="qemu:///system" |
322 |
+ |
323 |
+# default to suspending the VM via managedsave |
324 |
+case "${LIBVIRT_SHUTDOWN}" in |
325 |
+ managedsave|shutdown|destroy) ;; |
326 |
+ *) LIBVIRT_SHUTDOWN="managedsave" ;; |
327 |
+esac |
328 |
+ |
329 |
+# default to 500 seconds |
330 |
+[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500 |
331 |
+ |
332 |
+gueststatefile="/var/lib/libvirt/libvirt-guests.state" |
333 |
+netstatefile="/var/lib/libvirt/libvirt-net.state" |
334 |
+ |
335 |
+do_virsh() { |
336 |
+ local hvuri=$1 |
337 |
+ shift |
338 |
+ |
339 |
+ # if unset, default to qemu |
340 |
+ [ -z ${hvuri} ] && hvuri="qemu:///system" |
341 |
+ # if only qemu was supplied then correct the value |
342 |
+ [ "xqemu" = x${hvuri} ] && hvuri="qemu:///system" |
343 |
+ |
344 |
+ # Silence errors because virsh always throws an error about |
345 |
+ # not finding the hypervisor version when connecting to libvirtd |
346 |
+ # lastly strip the blank line at the end |
347 |
+ LC_ALL=C virsh -c ${hvuri} "$@" 2>/dev/null | head -n -1 |
348 |
+} |
349 |
+ |
350 |
+libvirtd_dom_list() { |
351 |
+ # Only work with domains by their UUIDs |
352 |
+ local hvuri=$1 |
353 |
+ shift |
354 |
+ |
355 |
+ do_virsh "${hvuri}" list --uuid $@ |
356 |
+} |
357 |
+ |
358 |
+libvirtd_dom_count() { |
359 |
+ local hvuri=$1 |
360 |
+ shift |
361 |
+ |
362 |
+ libvirtd_dom_list "${hvuri}" $@ | wc -l |
363 |
+} |
364 |
+ |
365 |
+libvirtd_net_list() { |
366 |
+ # Only work with networks by their UUIDs |
367 |
+ local hvuri=$1 |
368 |
+ shift |
369 |
+ |
370 |
+ do_virsh "${hvuri}" net-list --uuid $@ |
371 |
+} |
372 |
+ |
373 |
+libvirtd_net_count() { |
374 |
+ local hvuri=$1 |
375 |
+ shift |
376 |
+ |
377 |
+ libvirtd_net_list "${hvuri}" $@ | wc -l |
378 |
+} |
379 |
+ |
380 |
+libvirtd_dom_stop() { |
381 |
+ # stops all persistent or transient domains for a given URI |
382 |
+ # $1 - uri |
383 |
+ # $2 - persisent/transient |
384 |
+ |
385 |
+ local uri=$1 |
386 |
+ local persist=$2 |
387 |
+ local shutdown_type=${LIBVIRT_SHUTDOWN} |
388 |
+ local counter=${LIBVIRT_MAXWAIT} |
389 |
+ local dom_name= |
390 |
+ local dom_as= |
391 |
+ local dom_ids= |
392 |
+ local uuid= |
393 |
+ local dom_count= |
394 |
+ |
395 |
+ [ "${persist}" = "--transient" ] && shutdown_type="shutdown" |
396 |
+ [ -n "${counter}" ] || counter=500 |
397 |
+ |
398 |
+ einfo " Shutting down domain(s) ..." |
399 |
+ |
400 |
+ # grab all persistent or transient domains running |
401 |
+ dom_ids=$(libvirtd_dom_list ${uri} ${persist}) |
402 |
+ |
403 |
+ for uuid in ${dom_ids}; do |
404 |
+ # Get the name |
405 |
+ dom_name=$(do_virsh ${uri} domname ${uuid}) |
406 |
+ einfo " ${dom_name}" |
407 |
+ # Get autostart state |
408 |
+ dom_as=$(do_virsh ${uri} dominfo ${uuid} | \ |
409 |
+ awk '$1 == "Autostart:" { print $2 }') |
410 |
+ |
411 |
+ if [ "${persist}" = "--persistent" ]; then |
412 |
+ # Save our running state only if LIBVIRT_IGNORE_AUTOSTART != yes |
413 |
+ if [ "x${LIBVIRT_IGNORE_AUTOSTART}" = "xyes" ] && \ |
414 |
+ [ ${dom_as} = "enabled" ]; then |
415 |
+ : |
416 |
+ else |
417 |
+ echo "${uri} ${uuid}" >> ${gueststatefile} |
418 |
+ fi |
419 |
+ |
420 |
+ fi |
421 |
+ |
422 |
+ # Now let's stop it |
423 |
+ do_virsh "${uri}" ${shutdown_type} ${uuid} > /dev/null |
424 |
+ |
425 |
+ done |
426 |
+ |
427 |
+ dom_count="$(libvirtd_dom_count ${uri} ${persist})" |
428 |
+ while [ ${dom_count} -gt 0 ] && [ ${counter} -gt 0 ] ; do |
429 |
+ dom_count="$(libvirtd_dom_count ${uri} ${persist})" |
430 |
+ sleep 1 |
431 |
+ if [ "${shutdown_type}" = "shutdown" ]; then |
432 |
+ counter=$((${counter} - 1)) |
433 |
+ fi |
434 |
+ echo -n "." |
435 |
+ done |
436 |
+ |
437 |
+ if [ "${shutdown_type}" = "shutdown" ]; then |
438 |
+ # grab all domains still running |
439 |
+ dom_ids=$(libvirtd_dom_list ${uri} ${persist}) |
440 |
+ for uuid in ${dom_ids}; do |
441 |
+ dom_name=$(do_virsh ${uri} domname ${uuid}) |
442 |
+ eerror " ${dom_name} forcibly stopped" |
443 |
+ do_virsh "${uri}" destroy ${uuid} > /dev/null |
444 |
+ done |
445 |
+ fi |
446 |
+} |
447 |
+ |
448 |
+libvirtd_net_stop() { |
449 |
+ # stops all persistent or transient domains for a given URI |
450 |
+ # $1 - uri |
451 |
+ # $2 - persisent/transient |
452 |
+ |
453 |
+ local uri=$1 |
454 |
+ local persist=$2 |
455 |
+ local uuid= |
456 |
+ local net_name= |
457 |
+ |
458 |
+ if [ "${LIBVIRT_NET_SHUTDOWN}" != "no" ]; then |
459 |
+ |
460 |
+ einfo " Shutting down network(s):" |
461 |
+ for uuid in $(libvirtd_net_list ${uri} ${persist}); do |
462 |
+ net_name=$(do_virsh ${uri} net-name ${uuid}) |
463 |
+ einfo " ${net_name}" |
464 |
+ |
465 |
+ if [ "${persist}" = "--persistent" ]; then |
466 |
+ # Save our running state |
467 |
+ echo "${uri} ${uuid}" >> ${netstatefile} |
468 |
+ |
469 |
+ fi |
470 |
+ |
471 |
+ # Actually stop the network |
472 |
+ do_virsh qemu net-destroy ${uuid} > /dev/null |
473 |
+ done |
474 |
+ |
475 |
+ fi |
476 |
+} |
477 |
+ |
478 |
+start() { |
479 |
+ local uri= |
480 |
+ local uuid= |
481 |
+ local name= |
482 |
+ |
483 |
+ for uri in ${LIBVIRT_URIS}; do |
484 |
+ do_virsh "${uri}" connect |
485 |
+ if [ $? -ne 0 ]; then |
486 |
+ eerror "Failed to connect to '${uri}'. Domains may not start." |
487 |
+ fi |
488 |
+ done |
489 |
+ |
490 |
+ [ ! -e "${netstatefile}" ] && touch "${netstatefile}" |
491 |
+ [ ! -e "${gueststatefile}" ] && touch "${gueststatefile}" |
492 |
+ |
493 |
+ # if the user didn't want to start any guests up then respect their wish |
494 |
+ [ "x${LIBVIRT_START}" = "xno" ] && return 0 |
495 |
+ |
496 |
+ # start networks |
497 |
+ ebegin "Starting libvirt networks" |
498 |
+ while read -r uri uuid |
499 |
+ do |
500 |
+ # ignore trash |
501 |
+ [ -z "${uri}" ] || [ -z "${uuid}" ] && continue |
502 |
+ |
503 |
+ name=$(do_virsh "${uri}" net-name ${uuid}) |
504 |
+ einfo " ${name}" |
505 |
+ do_virsh "${uri}" net-start ${uuid} > /dev/null |
506 |
+ done <"${netstatefile}" |
507 |
+ eend 0 |
508 |
+ |
509 |
+ # start domains |
510 |
+ ebegin "Starting libvirt domains" |
511 |
+ while read -r uri uuid |
512 |
+ do |
513 |
+ # ignore trash |
514 |
+ [ -z "${uri}" ] || [ -z "${uuid}" ] && continue |
515 |
+ |
516 |
+ name=$(do_virsh "${uri}" domname ${uuid}) |
517 |
+ einfo " ${name}" |
518 |
+ do_virsh "${uri}" start ${uuid} > /dev/null |
519 |
+ done <"${gueststatefile}" |
520 |
+ eend 0 |
521 |
+} |
522 |
+ |
523 |
+stop() { |
524 |
+ local counter= |
525 |
+ local dom_name= |
526 |
+ local net_name= |
527 |
+ local dom_ids= |
528 |
+ local uuid= |
529 |
+ local dom_count= |
530 |
+ |
531 |
+ rm -f "${gueststatefile}" |
532 |
+ [ $? -ne 0 ] && eerror "Unable to save domain state" |
533 |
+ rm -f "${netstatefile}" |
534 |
+ [ $? -ne 0 ] && eerror "Unable to save net state" |
535 |
+ |
536 |
+ for uri in ${LIBVIRT_URIS}; do |
537 |
+ einfo "Stopping libvirt domains and networks for ${uri}" |
538 |
+ |
539 |
+ libvirtd_dom_stop "${uri}" "--persistent" |
540 |
+ libvirtd_dom_stop "${uri}" "--transient" |
541 |
+ libvirtd_net_stop "${uri}" "--persistent" |
542 |
+ libvirtd_net_stop "${uri}" "--transient" |
543 |
+ |
544 |
+ einfo "Done stopping domains and networks for ${uri}" |
545 |
+ done |
546 |
+} |
547 |
|
548 |
diff --git a/app-emulation/libvirt/files/libvirtd.init-r15 b/app-emulation/libvirt/files/libvirtd.init-r15 |
549 |
new file mode 100644 |
550 |
index 0000000..cc456b3 |
551 |
--- /dev/null |
552 |
+++ b/app-emulation/libvirt/files/libvirtd.init-r15 |
553 |
@@ -0,0 +1,38 @@ |
554 |
+#!/sbin/openrc-run |
555 |
+# Copyright 1999-2015 Gentoo Foundation |
556 |
+# Distributed under the terms of the GNU General Public License v2 |
557 |
+# $Id$ |
558 |
+ |
559 |
+description="Virtual Machine Management daemon (libvirt)" |
560 |
+ |
561 |
+LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"} |
562 |
+LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"} |
563 |
+ |
564 |
+command="/usr/sbin/libvirtd" |
565 |
+command_args="-d ${LIBVIRTD_OPTS}" |
566 |
+start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab" |
567 |
+pidfile="/var/run/libvirtd.pid" |
568 |
+retry="${LIBVIRTD_TERMTIMEOUT}" |
569 |
+ |
570 |
+depend() { |
571 |
+ USE_FLAG_FIREWALLD |
572 |
+ use USE_FLAG_AVAHI USE_FLAG_ISCSI USE_FLAG_RBD dbus virtlockd |
573 |
+ after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled |
574 |
+} |
575 |
+ |
576 |
+start_pre() { |
577 |
+ # Test configuration directories in /etc/libvirt/ to be either not |
578 |
+ # present or a directory, i.e. not a regular file, bug #532892 |
579 |
+ local has_errors=0 |
580 |
+ ebegin "Checking for suitable directories in \"/etc/libvirt\"" |
581 |
+ |
582 |
+ for dir in lxc nwfilter qemu storage; do |
583 |
+ if [ -f /etc/libvirt/$dir ]; then |
584 |
+ has_errors=1 |
585 |
+ eerror "/etc/libvirt/$dir was created as a regular file. It must be either" |
586 |
+ eerror "a directory or not present for libvirtd to start up successfully." |
587 |
+ fi |
588 |
+ done |
589 |
+ |
590 |
+ eend ${has_errors} "Please correct the error(s) above" |
591 |
+} |
592 |
|
593 |
diff --git a/app-emulation/libvirt/libvirt-1.2.21-r2.ebuild b/app-emulation/libvirt/libvirt-1.2.21-r2.ebuild |
594 |
new file mode 100644 |
595 |
index 0000000..f786958 |
596 |
--- /dev/null |
597 |
+++ b/app-emulation/libvirt/libvirt-1.2.21-r2.ebuild |
598 |
@@ -0,0 +1,380 @@ |
599 |
+# Copyright 1999-2015 Gentoo Foundation |
600 |
+# Distributed under the terms of the GNU General Public License v2 |
601 |
+# $Id$ |
602 |
+ |
603 |
+EAPI=5 |
604 |
+ |
605 |
+inherit eutils user autotools-utils linux-info systemd readme.gentoo |
606 |
+ |
607 |
+BACKPORTS="20151222" # CVE-2015-5313 |
608 |
+ |
609 |
+if [[ ${PV} = *9999* ]]; then |
610 |
+ inherit git-r3 |
611 |
+ EGIT_REPO_URI="git://libvirt.org/libvirt.git" |
612 |
+ SRC_URI="" |
613 |
+ KEYWORDS="" |
614 |
+ SLOT="0" |
615 |
+else |
616 |
+ # Versions with 4 numbers are stable updates: |
617 |
+ if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then |
618 |
+ SRC_URI="http://libvirt.org/sources/stable_updates/${P}.tar.gz" |
619 |
+ else |
620 |
+ SRC_URI="http://libvirt.org/sources/${P}.tar.gz" |
621 |
+ fi |
622 |
+ SRC_URI+=" ${BACKPORTS:+ |
623 |
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz |
624 |
+ https://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" |
625 |
+ KEYWORDS="amd64 x86" |
626 |
+ SLOT="0/${PV}" |
627 |
+fi |
628 |
+ |
629 |
+DESCRIPTION="C toolkit to manipulate virtual machines" |
630 |
+HOMEPAGE="http://www.libvirt.org/" |
631 |
+LICENSE="LGPL-2.1" |
632 |
+IUSE="apparmor audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm \ |
633 |
+ lxc +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ |
634 |
+ selinux systemd +udev uml +vepa virtualbox virt-network wireshark-plugins \ |
635 |
+ xen" |
636 |
+ |
637 |
+REQUIRED_USE=" |
638 |
+ firewalld? ( virt-network ) |
639 |
+ libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) |
640 |
+ lxc? ( caps libvirtd ) |
641 |
+ openvz? ( libvirtd ) |
642 |
+ qemu? ( libvirtd ) |
643 |
+ uml? ( libvirtd ) |
644 |
+ vepa? ( macvtap ) |
645 |
+ virt-network? ( libvirtd ) |
646 |
+ virtualbox? ( libvirtd ) |
647 |
+ xen? ( libvirtd )" |
648 |
+ |
649 |
+# gettext.sh command is used by the libvirt command wrappers, and it's |
650 |
+# non-optional, so put it into RDEPEND. |
651 |
+# We can use both libnl:1.1 and libnl:3, but if you have both installed, the |
652 |
+# package will use 3 by default. Since we don't have slot pinning in an API, |
653 |
+# we must go with the most recent |
654 |
+RDEPEND=" |
655 |
+ app-misc/scrub |
656 |
+ dev-libs/libgcrypt:0 |
657 |
+ dev-libs/libnl:3 |
658 |
+ >=dev-libs/libxml2-2.7.6 |
659 |
+ >=net-analyzer/netcat6-1.0-r2 |
660 |
+ >=net-libs/gnutls-1.0.25:0= |
661 |
+ net-libs/libssh2 |
662 |
+ >=net-misc/curl-7.18.0 |
663 |
+ sys-apps/dmidecode |
664 |
+ >=sys-apps/util-linux-2.17 |
665 |
+ sys-devel/gettext |
666 |
+ sys-libs/ncurses:0= |
667 |
+ sys-libs/readline:= |
668 |
+ apparmor? ( sys-libs/libapparmor ) |
669 |
+ audit? ( sys-process/audit ) |
670 |
+ avahi? ( >=net-dns/avahi-0.6[dbus] ) |
671 |
+ caps? ( sys-libs/libcap-ng ) |
672 |
+ firewalld? ( net-firewall/firewalld ) |
673 |
+ fuse? ( >=sys-fs/fuse-2.8.6 ) |
674 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) |
675 |
+ iscsi? ( sys-block/open-iscsi ) |
676 |
+ lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) |
677 |
+ lxc? ( !systemd? ( sys-power/pm-utils ) ) |
678 |
+ nfs? ( net-fs/nfs-utils ) |
679 |
+ numa? ( |
680 |
+ >sys-process/numactl-2.0.2 |
681 |
+ sys-process/numad |
682 |
+ ) |
683 |
+ openvz? ( sys-kernel/openvz-sources:* ) |
684 |
+ parted? ( |
685 |
+ >=sys-block/parted-1.8[device-mapper] |
686 |
+ sys-fs/lvm2 |
687 |
+ ) |
688 |
+ pcap? ( >=net-libs/libpcap-1.0.0 ) |
689 |
+ policykit? ( >=sys-auth/polkit-0.9 ) |
690 |
+ qemu? ( |
691 |
+ >=app-emulation/qemu-0.13.0 |
692 |
+ dev-libs/yajl |
693 |
+ !systemd? ( sys-power/pm-utils ) |
694 |
+ ) |
695 |
+ rbd? ( sys-cluster/ceph ) |
696 |
+ sasl? ( dev-libs/cyrus-sasl ) |
697 |
+ selinux? ( >=sys-libs/libselinux-2.0.85 ) |
698 |
+ systemd? ( sys-apps/systemd ) |
699 |
+ virt-network? ( |
700 |
+ net-dns/dnsmasq[script] |
701 |
+ net-firewall/ebtables |
702 |
+ >=net-firewall/iptables-1.4.10[ipv6] |
703 |
+ net-misc/radvd |
704 |
+ sys-apps/iproute2[-minimal] |
705 |
+ ) |
706 |
+ virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) |
707 |
+ wireshark-plugins? ( net-analyzer/wireshark:= ) |
708 |
+ xen? ( |
709 |
+ app-emulation/xen |
710 |
+ app-emulation/xen-tools:= |
711 |
+ ) |
712 |
+ udev? ( |
713 |
+ virtual/udev |
714 |
+ >=x11-libs/libpciaccess-0.10.9 |
715 |
+ )" |
716 |
+ |
717 |
+DEPEND="${RDEPEND} |
718 |
+ app-text/xhtml1 |
719 |
+ dev-lang/perl |
720 |
+ dev-libs/libxslt |
721 |
+ dev-perl/XML-XPath |
722 |
+ virtual/pkgconfig" |
723 |
+ |
724 |
+pkg_setup() { |
725 |
+ enewgroup qemu 77 |
726 |
+ enewuser qemu 77 -1 -1 qemu kvm |
727 |
+ |
728 |
+ # Some people used the masked ebuild which was not adding the qemu |
729 |
+ # user to the kvm group originally. This results in VMs failing to |
730 |
+ # start for some users. bug #430808 |
731 |
+ egetent group kvm | grep -q qemu |
732 |
+ if [[ $? -ne 0 ]]; then |
733 |
+ gpasswd -a qemu kvm |
734 |
+ fi |
735 |
+ |
736 |
+ # Check kernel configuration: |
737 |
+ CONFIG_CHECK="" |
738 |
+ use fuse && CONFIG_CHECK+=" |
739 |
+ ~FUSE_FS" |
740 |
+ |
741 |
+ use lvm && CONFIG_CHECK+=" |
742 |
+ ~BLK_DEV_DM |
743 |
+ ~DM_MULTIPATH |
744 |
+ ~DM_SNAPSHOT" |
745 |
+ |
746 |
+ use lxc && CONFIG_CHECK+=" |
747 |
+ ~BLK_CGROUP |
748 |
+ ~CGROUP_CPUACCT |
749 |
+ ~CGROUP_DEVICE |
750 |
+ ~CGROUP_FREEZER |
751 |
+ ~CGROUP_NET_PRIO |
752 |
+ ~CGROUP_PERF |
753 |
+ ~CGROUPS |
754 |
+ ~CGROUP_SCHED |
755 |
+ ~CPUSETS |
756 |
+ ~DEVPTS_MULTIPLE_INSTANCES |
757 |
+ ~IPC_NS |
758 |
+ ~MACVLAN |
759 |
+ ~NAMESPACES |
760 |
+ ~NET_CLS_CGROUP |
761 |
+ ~NET_NS |
762 |
+ ~PID_NS |
763 |
+ ~POSIX_MQUEUE |
764 |
+ ~SECURITYFS |
765 |
+ ~USER_NS |
766 |
+ ~UTS_NS |
767 |
+ ~VETH |
768 |
+ ~!GRKERNSEC_CHROOT_MOUNT |
769 |
+ ~!GRKERNSEC_CHROOT_DOUBLE |
770 |
+ ~!GRKERNSEC_CHROOT_PIVOT |
771 |
+ ~!GRKERNSEC_CHROOT_CHMOD |
772 |
+ ~!GRKERNSEC_CHROOT_CAPS" |
773 |
+ # Handle specific kernel versions for different features |
774 |
+ kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" |
775 |
+ kernel_is ge 3 6 && CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" |
776 |
+ |
777 |
+ use macvtap && CONFIG_CHECK+=" |
778 |
+ ~MACVTAP" |
779 |
+ |
780 |
+ use virt-network && CONFIG_CHECK+=" |
781 |
+ ~BRIDGE_EBT_MARK_T |
782 |
+ ~BRIDGE_NF_EBTABLES |
783 |
+ ~NETFILTER_ADVANCED |
784 |
+ ~NETFILTER_XT_CONNMARK |
785 |
+ ~NETFILTER_XT_MARK |
786 |
+ ~NETFILTER_XT_TARGET_CHECKSUM" |
787 |
+ # Bandwidth Limiting Support |
788 |
+ use virt-network && CONFIG_CHECK+=" |
789 |
+ ~BRIDGE_EBT_T_NAT |
790 |
+ ~NET_ACT_POLICE |
791 |
+ ~NET_CLS_FW |
792 |
+ ~NET_CLS_U32 |
793 |
+ ~NET_SCH_HTB |
794 |
+ ~NET_SCH_INGRESS |
795 |
+ ~NET_SCH_SFQ" |
796 |
+ |
797 |
+ ERROR_USER_NS="Optional depending on LXC configuration." |
798 |
+ |
799 |
+ if [[ -n ${CONFIG_CHECK} ]]; then |
800 |
+ linux-info_pkg_setup |
801 |
+ fi |
802 |
+} |
803 |
+ |
804 |
+src_prepare() { |
805 |
+ touch "${S}/.mailmap" |
806 |
+ |
807 |
+ if [[ ${PV} = *9999* ]]; then |
808 |
+ # git checkouts require bootstrapping to create the configure script. |
809 |
+ # Additionally the submodules must be cloned to the right locations |
810 |
+ # bug #377279 |
811 |
+ ./bootstrap || die "bootstrap failed" |
812 |
+ ( |
813 |
+ git submodule status | sed 's/^[ +-]//;s/ .*//' |
814 |
+ git hash-object bootstrap.conf |
815 |
+ ) >.git-module-status |
816 |
+ fi |
817 |
+ |
818 |
+ epatch \ |
819 |
+ "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch \ |
820 |
+ "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch \ |
821 |
+ "${FILESDIR}"/${PN}-1.2.17-fix_paths_for_apparmor.patch \ |
822 |
+ "${FILESDIR}"/${P}-avoid_deprecated_pc_file.patch |
823 |
+ |
824 |
+ [[ -n ${BACKPORTS} ]] && |
825 |
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ |
826 |
+ EPATCH_SOURCE="${WORKDIR}/patches" epatch |
827 |
+ |
828 |
+ epatch_user |
829 |
+ |
830 |
+ # Tweak the init script: |
831 |
+ cp "${FILESDIR}/libvirtd.init-r15" "${S}/libvirtd.init" || die |
832 |
+ sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \ |
833 |
+ -e "s/USE_FLAG_AVAHI/$(usex avahi avahi-daemon '')/" \ |
834 |
+ -e "s/USE_FLAG_ISCSI/$(usex iscsi iscsid '')/" \ |
835 |
+ -e "s/USE_FLAG_RBD/$(usex rbd ceph '')/" \ |
836 |
+ -i "${S}/libvirtd.init" || die "sed failed" |
837 |
+ |
838 |
+ AUTOTOOLS_AUTORECONF=true |
839 |
+ autotools-utils_src_prepare |
840 |
+} |
841 |
+ |
842 |
+src_configure() { |
843 |
+ local myeconfargs=( |
844 |
+ $(use_with apparmor) |
845 |
+ $(use_with apparmor apparmor-profiles) |
846 |
+ $(use_with audit) |
847 |
+ $(use_with avahi) |
848 |
+ $(use_with caps capng) |
849 |
+ $(use_with firewalld) |
850 |
+ $(use_with fuse) |
851 |
+ $(use_with glusterfs) |
852 |
+ $(use_with glusterfs storage-gluster) |
853 |
+ $(use_with iscsi storage-iscsi) |
854 |
+ $(use_with libvirtd) |
855 |
+ $(use_with lvm storage-lvm) |
856 |
+ $(use_with lvm storage-mpath) |
857 |
+ $(use_with lxc) |
858 |
+ $(use_with macvtap) |
859 |
+ $(use_enable nls) |
860 |
+ $(use_with numa numactl) |
861 |
+ $(use_with numa numad) |
862 |
+ $(use_with openvz) |
863 |
+ $(use_with parted storage-disk) |
864 |
+ $(use_with pcap libpcap) |
865 |
+ $(use_with phyp) |
866 |
+ $(use_with policykit polkit) |
867 |
+ $(use_with qemu) |
868 |
+ $(use_with qemu yajl) |
869 |
+ $(use_with rbd storage-rbd) |
870 |
+ $(use_with sasl) |
871 |
+ $(use_with selinux) |
872 |
+ $(use_with systemd systemd-daemon) |
873 |
+ $(usex systemd --with-init-script=systemd '') |
874 |
+ $(use_with udev) |
875 |
+ $(use_with uml) |
876 |
+ $(use_with vepa virtualport) |
877 |
+ $(use_with virt-network network) |
878 |
+ $(use_with wireshark-plugins wireshark-dissector) |
879 |
+ $(use_with xen) |
880 |
+ $(use_with xen xen-inotify) |
881 |
+ $(usex xen --with-libxl '') |
882 |
+ |
883 |
+ --without-hal |
884 |
+ --without-netcf |
885 |
+ --without-sanlock |
886 |
+ --without-xenapi |
887 |
+ --with-esx |
888 |
+ --with-qemu-group=$(usex caps qemu root) |
889 |
+ --with-qemu-user=$(usex caps qemu root) |
890 |
+ --with-remote |
891 |
+ --with-storage-fs |
892 |
+ --with-vmware |
893 |
+ |
894 |
+ --disable-static |
895 |
+ --disable-werror |
896 |
+ |
897 |
+ --with-html-subdir=${PF}/html |
898 |
+ --localstatedir=/var |
899 |
+ ) |
900 |
+ |
901 |
+ if use virtualbox && has_version app-emulation/virtualbox-ose; then |
902 |
+ myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ ) |
903 |
+ else |
904 |
+ myeconfargs+=( $(use_with virtualbox vbox) ) |
905 |
+ fi |
906 |
+ |
907 |
+ autotools-utils_src_configure |
908 |
+ |
909 |
+ if [[ ${PV} = *9999* ]]; then |
910 |
+ # Restore gnulib's config.sub and config.guess |
911 |
+ # bug #377279 |
912 |
+ (cd .gnulib && git reset --hard > /dev/null) |
913 |
+ fi |
914 |
+} |
915 |
+ |
916 |
+src_test() { |
917 |
+ # Explicitly allow parallel build of tests |
918 |
+ export VIR_TEST_DEBUG=1 |
919 |
+ HOME="${T}" emake check || die "tests failed" |
920 |
+} |
921 |
+ |
922 |
+src_install() { |
923 |
+ autotools-utils_src_compile install \ |
924 |
+ DESTDIR="${D}" \ |
925 |
+ SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" |
926 |
+ |
927 |
+ find "${D}" -name '*.la' -delete || die |
928 |
+ |
929 |
+ # Remove bogus, empty directories. They are either not used, or |
930 |
+ # libvirtd is able to create them on demand |
931 |
+ rm -rf "${D}"/etc/sysconfig |
932 |
+ rm -rf "${D}"/var/cache |
933 |
+ rm -rf "${D}"/var/run |
934 |
+ rm -rf "${D}"/var/log |
935 |
+ |
936 |
+ use libvirtd || return 0 |
937 |
+ # From here, only libvirtd-related instructions, be warned! |
938 |
+ |
939 |
+ use systemd && systemd_install_serviced \ |
940 |
+ "${FILESDIR}"/libvirtd.service.conf libvirtd.service |
941 |
+ |
942 |
+ systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf |
943 |
+ |
944 |
+ newinitd "${S}/libvirtd.init" libvirtd || die |
945 |
+ newinitd "${FILESDIR}/libvirt-guests.init-r1" libvirt-guests || die |
946 |
+ newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die |
947 |
+ |
948 |
+ newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die |
949 |
+ newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die |
950 |
+ |
951 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") |
952 |
+ DISABLE_AUTOFORMATTING=true |
953 |
+ readme.gentoo_create_doc |
954 |
+} |
955 |
+ |
956 |
+pkg_preinst() { |
957 |
+ # we only ever want to generate this once |
958 |
+ if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then |
959 |
+ rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml |
960 |
+ fi |
961 |
+} |
962 |
+ |
963 |
+pkg_postinst() { |
964 |
+ if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then |
965 |
+ touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml |
966 |
+ fi |
967 |
+ |
968 |
+ use libvirtd || return 0 |
969 |
+ # From here, only libvirtd-related instructions, be warned! |
970 |
+ |
971 |
+ if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 1.2.18-r2 ${REPLACING_VERSIONS} ]]; then |
972 |
+ FORCE_PRINT_ELOG=true |
973 |
+ fi |
974 |
+ |
975 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") |
976 |
+ DISABLE_AUTOFORMATTING=true |
977 |
+ readme.gentoo_print_elog |
978 |
+} |
979 |
|
980 |
diff --git a/app-emulation/libvirt/libvirt-1.3.1-r1.ebuild b/app-emulation/libvirt/libvirt-1.3.1-r1.ebuild |
981 |
new file mode 100644 |
982 |
index 0000000..a022027 |
983 |
--- /dev/null |
984 |
+++ b/app-emulation/libvirt/libvirt-1.3.1-r1.ebuild |
985 |
@@ -0,0 +1,385 @@ |
986 |
+# Copyright 1999-2016 Gentoo Foundation |
987 |
+# Distributed under the terms of the GNU General Public License v2 |
988 |
+# $Id$ |
989 |
+ |
990 |
+EAPI=5 |
991 |
+ |
992 |
+inherit eutils user autotools-utils linux-info systemd readme.gentoo |
993 |
+ |
994 |
+BACKPORTS="" |
995 |
+ |
996 |
+if [[ ${PV} = *9999* ]]; then |
997 |
+ inherit git-r3 |
998 |
+ EGIT_REPO_URI="git://libvirt.org/libvirt.git" |
999 |
+ SRC_URI="" |
1000 |
+ KEYWORDS="" |
1001 |
+ SLOT="0" |
1002 |
+else |
1003 |
+ # Versions with 4 numbers are stable updates: |
1004 |
+ if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then |
1005 |
+ SRC_URI="http://libvirt.org/sources/stable_updates/${P}.tar.gz" |
1006 |
+ else |
1007 |
+ SRC_URI="http://libvirt.org/sources/${P}.tar.gz" |
1008 |
+ fi |
1009 |
+ SRC_URI+=" ${BACKPORTS:+ |
1010 |
+ https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz |
1011 |
+ https://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" |
1012 |
+ KEYWORDS="amd64 x86" |
1013 |
+ SLOT="0/${PV}" |
1014 |
+fi |
1015 |
+ |
1016 |
+DESCRIPTION="C toolkit to manipulate virtual machines" |
1017 |
+HOMEPAGE="http://www.libvirt.org/" |
1018 |
+LICENSE="LGPL-2.1" |
1019 |
+IUSE="apparmor audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm \ |
1020 |
+ lxc +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ |
1021 |
+ selinux systemd +udev uml +vepa virtualbox virt-network wireshark-plugins \ |
1022 |
+ xen" |
1023 |
+ |
1024 |
+REQUIRED_USE=" |
1025 |
+ firewalld? ( virt-network ) |
1026 |
+ libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) |
1027 |
+ lxc? ( caps libvirtd ) |
1028 |
+ openvz? ( libvirtd ) |
1029 |
+ qemu? ( libvirtd ) |
1030 |
+ uml? ( libvirtd ) |
1031 |
+ vepa? ( macvtap ) |
1032 |
+ virt-network? ( libvirtd ) |
1033 |
+ virtualbox? ( libvirtd ) |
1034 |
+ xen? ( libvirtd )" |
1035 |
+ |
1036 |
+# gettext.sh command is used by the libvirt command wrappers, and it's |
1037 |
+# non-optional, so put it into RDEPEND. |
1038 |
+# We can use both libnl:1.1 and libnl:3, but if you have both installed, the |
1039 |
+# package will use 3 by default. Since we don't have slot pinning in an API, |
1040 |
+# we must go with the most recent |
1041 |
+RDEPEND=" |
1042 |
+ app-misc/scrub |
1043 |
+ dev-libs/libgcrypt:0 |
1044 |
+ dev-libs/libnl:3 |
1045 |
+ >=dev-libs/libxml2-2.7.6 |
1046 |
+ >=net-analyzer/netcat6-1.0-r2 |
1047 |
+ >=net-libs/gnutls-1.0.25:0= |
1048 |
+ net-libs/libssh2 |
1049 |
+ >=net-misc/curl-7.18.0 |
1050 |
+ sys-apps/dmidecode |
1051 |
+ >=sys-apps/util-linux-2.17 |
1052 |
+ sys-devel/gettext |
1053 |
+ sys-libs/ncurses:0= |
1054 |
+ sys-libs/readline:= |
1055 |
+ apparmor? ( sys-libs/libapparmor ) |
1056 |
+ audit? ( sys-process/audit ) |
1057 |
+ avahi? ( >=net-dns/avahi-0.6[dbus] ) |
1058 |
+ caps? ( sys-libs/libcap-ng ) |
1059 |
+ firewalld? ( net-firewall/firewalld ) |
1060 |
+ fuse? ( >=sys-fs/fuse-2.8.6 ) |
1061 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) |
1062 |
+ iscsi? ( sys-block/open-iscsi ) |
1063 |
+ lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) |
1064 |
+ lxc? ( !systemd? ( sys-power/pm-utils ) ) |
1065 |
+ nfs? ( net-fs/nfs-utils ) |
1066 |
+ numa? ( |
1067 |
+ >sys-process/numactl-2.0.2 |
1068 |
+ sys-process/numad |
1069 |
+ ) |
1070 |
+ openvz? ( sys-kernel/openvz-sources:* ) |
1071 |
+ parted? ( |
1072 |
+ >=sys-block/parted-1.8[device-mapper] |
1073 |
+ sys-fs/lvm2 |
1074 |
+ ) |
1075 |
+ pcap? ( >=net-libs/libpcap-1.0.0 ) |
1076 |
+ policykit? ( >=sys-auth/polkit-0.9 ) |
1077 |
+ qemu? ( |
1078 |
+ >=app-emulation/qemu-0.13.0 |
1079 |
+ dev-libs/yajl |
1080 |
+ !systemd? ( sys-power/pm-utils ) |
1081 |
+ ) |
1082 |
+ rbd? ( sys-cluster/ceph ) |
1083 |
+ sasl? ( dev-libs/cyrus-sasl ) |
1084 |
+ selinux? ( >=sys-libs/libselinux-2.0.85 ) |
1085 |
+ systemd? ( sys-apps/systemd ) |
1086 |
+ virt-network? ( |
1087 |
+ net-dns/dnsmasq[script] |
1088 |
+ net-firewall/ebtables |
1089 |
+ >=net-firewall/iptables-1.4.10[ipv6] |
1090 |
+ net-misc/radvd |
1091 |
+ sys-apps/iproute2[-minimal] |
1092 |
+ ) |
1093 |
+ virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) |
1094 |
+ wireshark-plugins? ( net-analyzer/wireshark:= ) |
1095 |
+ xen? ( |
1096 |
+ app-emulation/xen |
1097 |
+ app-emulation/xen-tools:= |
1098 |
+ ) |
1099 |
+ udev? ( |
1100 |
+ virtual/udev |
1101 |
+ >=x11-libs/libpciaccess-0.10.9 |
1102 |
+ )" |
1103 |
+ |
1104 |
+DEPEND="${RDEPEND} |
1105 |
+ app-text/xhtml1 |
1106 |
+ dev-lang/perl |
1107 |
+ dev-libs/libxslt |
1108 |
+ dev-perl/XML-XPath |
1109 |
+ virtual/pkgconfig" |
1110 |
+ |
1111 |
+pkg_setup() { |
1112 |
+ enewgroup qemu 77 |
1113 |
+ enewuser qemu 77 -1 -1 qemu kvm |
1114 |
+ |
1115 |
+ # Some people used the masked ebuild which was not adding the qemu |
1116 |
+ # user to the kvm group originally. This results in VMs failing to |
1117 |
+ # start for some users. bug #430808 |
1118 |
+ egetent group kvm | grep -q qemu |
1119 |
+ if [[ $? -ne 0 ]]; then |
1120 |
+ gpasswd -a qemu kvm |
1121 |
+ fi |
1122 |
+ |
1123 |
+ # Check kernel configuration: |
1124 |
+ CONFIG_CHECK="" |
1125 |
+ use fuse && CONFIG_CHECK+=" |
1126 |
+ ~FUSE_FS" |
1127 |
+ |
1128 |
+ use lvm && CONFIG_CHECK+=" |
1129 |
+ ~BLK_DEV_DM |
1130 |
+ ~DM_MULTIPATH |
1131 |
+ ~DM_SNAPSHOT" |
1132 |
+ |
1133 |
+ use lxc && CONFIG_CHECK+=" |
1134 |
+ ~BLK_CGROUP |
1135 |
+ ~CGROUP_CPUACCT |
1136 |
+ ~CGROUP_DEVICE |
1137 |
+ ~CGROUP_FREEZER |
1138 |
+ ~CGROUP_NET_PRIO |
1139 |
+ ~CGROUP_PERF |
1140 |
+ ~CGROUPS |
1141 |
+ ~CGROUP_SCHED |
1142 |
+ ~CPUSETS |
1143 |
+ ~DEVPTS_MULTIPLE_INSTANCES |
1144 |
+ ~IPC_NS |
1145 |
+ ~MACVLAN |
1146 |
+ ~NAMESPACES |
1147 |
+ ~NET_CLS_CGROUP |
1148 |
+ ~NET_NS |
1149 |
+ ~PID_NS |
1150 |
+ ~POSIX_MQUEUE |
1151 |
+ ~SECURITYFS |
1152 |
+ ~USER_NS |
1153 |
+ ~UTS_NS |
1154 |
+ ~VETH |
1155 |
+ ~!GRKERNSEC_CHROOT_MOUNT |
1156 |
+ ~!GRKERNSEC_CHROOT_DOUBLE |
1157 |
+ ~!GRKERNSEC_CHROOT_PIVOT |
1158 |
+ ~!GRKERNSEC_CHROOT_CHMOD |
1159 |
+ ~!GRKERNSEC_CHROOT_CAPS" |
1160 |
+ # Handle specific kernel versions for different features |
1161 |
+ kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" |
1162 |
+ kernel_is ge 3 6 && CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" |
1163 |
+ |
1164 |
+ use macvtap && CONFIG_CHECK+=" |
1165 |
+ ~MACVTAP" |
1166 |
+ |
1167 |
+ use virt-network && CONFIG_CHECK+=" |
1168 |
+ ~BRIDGE_EBT_MARK_T |
1169 |
+ ~BRIDGE_NF_EBTABLES |
1170 |
+ ~NETFILTER_ADVANCED |
1171 |
+ ~NETFILTER_XT_CONNMARK |
1172 |
+ ~NETFILTER_XT_MARK |
1173 |
+ ~NETFILTER_XT_TARGET_CHECKSUM" |
1174 |
+ # Bandwidth Limiting Support |
1175 |
+ use virt-network && CONFIG_CHECK+=" |
1176 |
+ ~BRIDGE_EBT_T_NAT |
1177 |
+ ~NET_ACT_POLICE |
1178 |
+ ~NET_CLS_FW |
1179 |
+ ~NET_CLS_U32 |
1180 |
+ ~NET_SCH_HTB |
1181 |
+ ~NET_SCH_INGRESS |
1182 |
+ ~NET_SCH_SFQ" |
1183 |
+ |
1184 |
+ ERROR_USER_NS="Optional depending on LXC configuration." |
1185 |
+ |
1186 |
+ if [[ -n ${CONFIG_CHECK} ]]; then |
1187 |
+ linux-info_pkg_setup |
1188 |
+ fi |
1189 |
+} |
1190 |
+ |
1191 |
+src_prepare() { |
1192 |
+ touch "${S}/.mailmap" |
1193 |
+ |
1194 |
+ if [[ ${PV} = *9999* ]]; then |
1195 |
+ # git checkouts require bootstrapping to create the configure script. |
1196 |
+ # Additionally the submodules must be cloned to the right locations |
1197 |
+ # bug #377279 |
1198 |
+ ./bootstrap || die "bootstrap failed" |
1199 |
+ ( |
1200 |
+ git submodule status | sed 's/^[ +-]//;s/ .*//' |
1201 |
+ git hash-object bootstrap.conf |
1202 |
+ ) >.git-module-status |
1203 |
+ fi |
1204 |
+ |
1205 |
+ epatch \ |
1206 |
+ "${FILESDIR}"/${PN}-1.3.0-do_not_use_sysconf.patch \ |
1207 |
+ "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch \ |
1208 |
+ "${FILESDIR}"/${P}-fix_paths_for_apparmor.patch \ |
1209 |
+ "${FILESDIR}"/${PN}-1.2.21-avoid_deprecated_pc_file.patch |
1210 |
+ |
1211 |
+ [[ -n ${BACKPORTS} ]] && |
1212 |
+ EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ |
1213 |
+ EPATCH_SOURCE="${WORKDIR}/patches" epatch |
1214 |
+ |
1215 |
+ epatch_user |
1216 |
+ |
1217 |
+ # Tweak the init script: |
1218 |
+ cp "${FILESDIR}/libvirtd.init-r16" "${S}/libvirtd.init" || die |
1219 |
+ sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \ |
1220 |
+ -e "s/USE_FLAG_AVAHI/$(usex avahi 'use avahi-daemon' '')/" \ |
1221 |
+ -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \ |
1222 |
+ -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \ |
1223 |
+ -i "${S}/libvirtd.init" || die "sed failed" |
1224 |
+ |
1225 |
+ AUTOTOOLS_AUTORECONF=true |
1226 |
+ autotools-utils_src_prepare |
1227 |
+} |
1228 |
+ |
1229 |
+src_configure() { |
1230 |
+ local myeconfargs=( |
1231 |
+ $(use_with apparmor) |
1232 |
+ $(use_with apparmor apparmor-profiles) |
1233 |
+ $(use_with audit) |
1234 |
+ $(use_with avahi) |
1235 |
+ $(use_with caps capng) |
1236 |
+ $(use_with firewalld) |
1237 |
+ $(use_with fuse) |
1238 |
+ $(use_with glusterfs) |
1239 |
+ $(use_with glusterfs storage-gluster) |
1240 |
+ $(use_with iscsi storage-iscsi) |
1241 |
+ $(use_with libvirtd) |
1242 |
+ $(use_with lvm storage-lvm) |
1243 |
+ $(use_with lvm storage-mpath) |
1244 |
+ $(use_with lxc) |
1245 |
+ $(use_with macvtap) |
1246 |
+ $(use_enable nls) |
1247 |
+ $(use_with numa numactl) |
1248 |
+ $(use_with numa numad) |
1249 |
+ $(use_with openvz) |
1250 |
+ $(use_with parted storage-disk) |
1251 |
+ $(use_with pcap libpcap) |
1252 |
+ $(use_with phyp) |
1253 |
+ $(use_with policykit polkit) |
1254 |
+ $(use_with qemu) |
1255 |
+ $(use_with qemu yajl) |
1256 |
+ $(use_with rbd storage-rbd) |
1257 |
+ $(use_with sasl) |
1258 |
+ $(use_with selinux) |
1259 |
+ $(use_with systemd systemd-daemon) |
1260 |
+ $(usex systemd --with-init-script=systemd '') |
1261 |
+ $(use_with udev) |
1262 |
+ $(use_with uml) |
1263 |
+ $(use_with vepa virtualport) |
1264 |
+ $(use_with virt-network network) |
1265 |
+ $(use_with wireshark-plugins wireshark-dissector) |
1266 |
+ $(use_with xen) |
1267 |
+ $(use_with xen xen-inotify) |
1268 |
+ $(usex xen --with-libxl '') |
1269 |
+ |
1270 |
+ --without-hal |
1271 |
+ --without-netcf |
1272 |
+ --without-sanlock |
1273 |
+ --without-xenapi |
1274 |
+ --with-esx |
1275 |
+ --with-qemu-group=$(usex caps qemu root) |
1276 |
+ --with-qemu-user=$(usex caps qemu root) |
1277 |
+ --with-remote |
1278 |
+ --with-storage-fs |
1279 |
+ --with-vmware |
1280 |
+ |
1281 |
+ --disable-static |
1282 |
+ --disable-werror |
1283 |
+ |
1284 |
+ --with-html-subdir=${PF}/html |
1285 |
+ --localstatedir=/var |
1286 |
+ ) |
1287 |
+ |
1288 |
+ if use virtualbox && has_version app-emulation/virtualbox-ose; then |
1289 |
+ myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ ) |
1290 |
+ else |
1291 |
+ myeconfargs+=( $(use_with virtualbox vbox) ) |
1292 |
+ fi |
1293 |
+ |
1294 |
+ autotools-utils_src_configure |
1295 |
+ |
1296 |
+ if [[ ${PV} = *9999* ]]; then |
1297 |
+ # Restore gnulib's config.sub and config.guess |
1298 |
+ # bug #377279 |
1299 |
+ (cd .gnulib && git reset --hard > /dev/null) |
1300 |
+ fi |
1301 |
+ |
1302 |
+ # Workaround: Sometimes this subdirectory is missing and leads to a |
1303 |
+ # build failure. |
1304 |
+ mkdir -p "${BUILD_DIR}"/docs/internals |
1305 |
+} |
1306 |
+ |
1307 |
+src_test() { |
1308 |
+ # Explicitly allow parallel build of tests |
1309 |
+ export VIR_TEST_DEBUG=1 |
1310 |
+ HOME="${T}" emake check || die "tests failed" |
1311 |
+} |
1312 |
+ |
1313 |
+src_install() { |
1314 |
+ autotools-utils_src_compile install \ |
1315 |
+ DESTDIR="${D}" \ |
1316 |
+ SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" |
1317 |
+ |
1318 |
+ find "${D}" -name '*.la' -delete || die |
1319 |
+ |
1320 |
+ # Remove bogus, empty directories. They are either not used, or |
1321 |
+ # libvirtd is able to create them on demand |
1322 |
+ rm -rf "${D}"/etc/sysconfig |
1323 |
+ rm -rf "${D}"/var/cache |
1324 |
+ rm -rf "${D}"/var/run |
1325 |
+ rm -rf "${D}"/var/log |
1326 |
+ |
1327 |
+ use libvirtd || return 0 |
1328 |
+ # From here, only libvirtd-related instructions, be warned! |
1329 |
+ |
1330 |
+ use systemd && systemd_install_serviced \ |
1331 |
+ "${FILESDIR}"/libvirtd.service.conf libvirtd.service |
1332 |
+ |
1333 |
+ systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf |
1334 |
+ |
1335 |
+ newinitd "${S}/libvirtd.init" libvirtd || die |
1336 |
+ newinitd "${FILESDIR}/libvirt-guests.init-r2" libvirt-guests || die |
1337 |
+ newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die |
1338 |
+ newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die |
1339 |
+ |
1340 |
+ newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die |
1341 |
+ newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die |
1342 |
+ |
1343 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") |
1344 |
+ DISABLE_AUTOFORMATTING=true |
1345 |
+ readme.gentoo_create_doc |
1346 |
+} |
1347 |
+ |
1348 |
+pkg_preinst() { |
1349 |
+ # we only ever want to generate this once |
1350 |
+ if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then |
1351 |
+ rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml |
1352 |
+ fi |
1353 |
+} |
1354 |
+ |
1355 |
+pkg_postinst() { |
1356 |
+ if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then |
1357 |
+ touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml |
1358 |
+ fi |
1359 |
+ |
1360 |
+ use libvirtd || return 0 |
1361 |
+ # From here, only libvirtd-related instructions, be warned! |
1362 |
+ |
1363 |
+ if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 1.2.18-r2 ${REPLACING_VERSIONS} ]]; then |
1364 |
+ FORCE_PRINT_ELOG=true |
1365 |
+ fi |
1366 |
+ |
1367 |
+ DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r1") |
1368 |
+ DISABLE_AUTOFORMATTING=true |
1369 |
+ readme.gentoo_print_elog |
1370 |
+} |