PKGBUILDs/extra/libvirt/PKGBUILD

222 lines
7.1 KiB
Bash
Raw Normal View History

2021-12-03 15:00:16 +00:00
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
2020-06-02 13:53:24 +00:00
# Maintainer: Robin Broda <robin@broda.me>
2020-09-15 14:54:10 +00:00
# Contributor: Christian Rebischke <chris.rebischke@archlinux.org>
2018-01-27 03:59:37 +00:00
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
2013-07-01 23:28:11 +00:00
# Contributor: Jonathan Wiersma <archaur at jonw dot org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
2024-09-04 11:08:56 +00:00
# - removed qemu-base makedepend
2024-07-02 13:49:39 +00:00
# - removed qemu-base, qemu-desktop, qemu-emulators-full optdepends
2013-07-01 23:28:11 +00:00
2020-06-02 13:53:24 +00:00
pkgname=(libvirt libvirt-storage-gluster libvirt-storage-iscsi-direct)
2020-10-18 19:32:57 +00:00
epoch=1
2024-09-04 11:08:56 +00:00
pkgver=10.7.0
2024-09-07 21:32:40 +00:00
pkgrel=2
2013-07-01 23:28:11 +00:00
pkgdesc="API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)"
2017-12-10 14:08:31 +00:00
arch=('x86_64')
2019-03-04 19:25:16 +00:00
url="https://libvirt.org/"
2024-02-11 20:20:00 +00:00
license=('LGPL-2.1-or-later'
'GPL-3.0-or-later') # libvirt_parthelper links to libparted
2024-09-04 11:08:56 +00:00
depends=(
'fuse3'
'gnutls'
'libnbd'
'libnl'
'libpciaccess'
'libssh'
'libxml2'
'numactl'
'parted'
'polkit'
'yajl'
)
makedepends=(
'bash-completion'
'dnsmasq'
'glusterfs'
'iproute2'
'libiscsi'
'libxslt'
'lvm2'
'meson'
'open-iscsi'
'python-docutils'
'systemd'
)
optdepends=(
'dmidecode: DMI system info support'
'dnsmasq: required for default NAT/DHCP for guests'
'gettext: required for libvirt-guests.service'
'iptables-nft: required for default NAT networking'
'libvirt-storage-gluster: Gluster storage backend'
'libvirt-storage-iscsi-direct: iSCSI-direct storage backend'
'lvm2: Logical Volume Manager support'
'openbsd-netcat: for remote management over ssh'
'open-iscsi: iSCSI support via iscsiadm'
'radvd: IPv6 RAD support'
'swtpm: TPM emulator support'
)
2021-07-12 13:51:10 +00:00
2020-06-02 13:53:24 +00:00
backup=(
'etc/libvirt/libvirt-admin.conf'
2018-06-08 17:45:38 +00:00
'etc/libvirt/libvirt.conf'
'etc/libvirt/libvirtd.conf'
'etc/libvirt/lxc.conf'
2024-08-08 18:48:09 +00:00
'etc/libvirt/network.conf'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/allow-arp.xml'
'etc/libvirt/nwfilter/allow-dhcp-server.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/allow-dhcpv6-server.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/allow-dhcp.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/allow-dhcpv6.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/allow-incoming-ipv4.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/allow-incoming-ipv6.xml'
'etc/libvirt/nwfilter/allow-ipv6.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/allow-ipv4.xml'
2020-06-02 13:53:24 +00:00
'etc/libvirt/nwfilter/clean-traffic-gateway.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/clean-traffic.xml'
'etc/libvirt/nwfilter/no-arp-ip-spoofing.xml'
'etc/libvirt/nwfilter/no-arp-mac-spoofing.xml'
'etc/libvirt/nwfilter/no-arp-spoofing.xml'
'etc/libvirt/nwfilter/no-ip-multicast.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/no-ipv6-multicast.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/no-ip-spoofing.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/no-ipv6-spoofing.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/no-mac-spoofing.xml'
2021-01-25 18:34:46 +00:00
'etc/libvirt/nwfilter/no-mac-broadcast.xml'
2018-06-08 17:45:38 +00:00
'etc/libvirt/nwfilter/no-other-l2-traffic.xml'
'etc/libvirt/nwfilter/no-other-rarp-traffic.xml'
'etc/libvirt/nwfilter/qemu-announce-self-rarp.xml'
'etc/libvirt/nwfilter/qemu-announce-self.xml'
2024-07-24 14:27:46 +00:00
'etc/libvirt/network.conf'
2018-06-08 17:45:38 +00:00
'etc/libvirt/qemu.conf'
2020-06-02 13:53:24 +00:00
'etc/libvirt/qemu-lockd.conf'
2018-06-08 17:45:38 +00:00
'etc/libvirt/qemu/networks/default.xml'
2021-07-12 13:51:10 +00:00
'etc/libvirt/virtchd.conf'
2020-06-02 13:53:24 +00:00
'etc/libvirt/virtinterfaced.conf'
2018-06-08 17:45:38 +00:00
'etc/libvirt/virtlockd.conf'
2020-06-02 13:53:24 +00:00
'etc/libvirt/virtlogd.conf'
'etc/libvirt/virt-login-shell.conf'
'etc/libvirt/virtlxcd.conf'
'etc/libvirt/virtnetworkd.conf'
'etc/libvirt/virtnodedevd.conf'
'etc/libvirt/virtnwfilterd.conf'
'etc/libvirt/virtproxyd.conf'
'etc/libvirt/virtqemud.conf'
'etc/libvirt/virtsecretd.conf'
'etc/libvirt/virtstoraged.conf'
'etc/libvirt/virtvboxd.conf'
2018-06-08 17:45:38 +00:00
'etc/logrotate.d/libvirtd'
'etc/logrotate.d/libvirtd.lxc'
'etc/logrotate.d/libvirtd.qemu'
2020-06-02 13:53:24 +00:00
'etc/sasl2/libvirt.conf'
)
2022-08-08 12:48:36 +00:00
source=(
"https://libvirt.org/sources/$pkgname-$pkgver.tar.xz"{,.asc}
2024-09-07 21:32:40 +00:00
"fix-uuid.patch::https://gitlab.com/libvirt/libvirt/-/commit/008214842011d77fa4feda8d1ff586d29791f8ab.patch"
2022-08-08 12:48:36 +00:00
)
2024-09-04 11:08:56 +00:00
sha256sums=('ca757322eed998013b21f474c6c0c15dc08320ba6c8bae54aa16a93a1c3b7054'
2024-09-07 21:32:40 +00:00
'SKIP'
'c814c9233718c92324ba150f32892b3174d970940e8eb2f7098f989bb4aa8953')
2021-01-25 18:34:46 +00:00
validpgpkeys=('453B65310595562855471199CA68BE8010084C9C') # Jiří Denemark <jdenemar@redhat.com>
2014-02-10 13:14:42 +00:00
prepare() {
2020-06-02 13:53:24 +00:00
cd "$pkgname-$pkgver"
2020-09-15 14:54:10 +00:00
2024-09-07 21:32:40 +00:00
patch -Np1 < ../fix-uuid.patch
2014-04-10 20:46:43 +00:00
sed -i 's|/sysconfig/|/conf.d/|g' \
2020-10-18 19:32:57 +00:00
src/remote/libvirtd.service.in \
2024-07-02 13:49:39 +00:00
tools/{libvirt-guests.service,libvirt-guests.sh}.in \
2022-07-09 12:45:57 +00:00
docs/manpages/libvirt-guests.rst \
2020-06-02 13:53:24 +00:00
src/locking/virtlockd.service.in \
2020-10-18 19:32:57 +00:00
src/logging/virtlogd.service.in
2014-06-23 12:25:10 +00:00
sed -i 's|/usr/libexec/qemu-bridge-helper|/usr/lib/qemu/qemu-bridge-helper|g' \
2022-05-09 12:58:17 +00:00
src/qemu/qemu.conf.in \
2020-10-18 19:32:57 +00:00
src/qemu/test_libvirtd_qemu.aug.in
2014-04-10 20:46:43 +00:00
}
build() {
2021-01-25 18:34:46 +00:00
cd "$pkgname-$pkgver"
arch-meson build \
--libexecdir=lib/libvirt \
-Drunstatedir=/run \
2022-03-03 13:52:19 +00:00
-Dqemu_user=libvirt-qemu \
-Dqemu_group=libvirt-qemu \
2021-01-25 18:34:46 +00:00
-Dnetcf=disabled \
-Dopenwsman=disabled \
-Dapparmor=disabled \
2021-07-12 13:51:10 +00:00
-Dapparmor_profiles=disabled \
2021-01-25 18:34:46 +00:00
-Dselinux=disabled \
-Dwireshark_dissector=disabled \
-Ddriver_bhyve=disabled \
-Ddriver_hyperv=disabled \
-Ddriver_libxl=disabled \
-Ddriver_vz=disabled \
2021-07-12 13:51:10 +00:00
-Dsanlock=disabled \
2021-01-25 18:34:46 +00:00
-Dsecdriver_apparmor=disabled \
-Dsecdriver_selinux=disabled \
-Dstorage_vstorage=disabled \
-Ddtrace=disabled \
-Dnumad=disabled \
2022-08-08 12:48:36 +00:00
-Dstorage_zfs=enabled\
2021-01-25 18:34:46 +00:00
-Dstorage_rbd=disabled
2024-01-18 15:44:54 +00:00
meson compile -C build
2013-07-01 23:28:11 +00:00
}
2020-06-02 13:53:24 +00:00
check() {
2021-01-25 18:34:46 +00:00
cd "$pkgname-$pkgver"
2024-01-18 15:44:54 +00:00
meson test -C build --print-errorlogs
2020-06-02 13:53:24 +00:00
}
package_libvirt() {
2020-10-20 13:48:26 +00:00
provides=("libvirt=$pkgver" 'libvirt.so' 'libvirt-admin.so' 'libvirt-lxc.so' 'libvirt-qemu.so')
2021-01-25 18:34:46 +00:00
cd "$pkgname-$pkgver"
2024-01-18 15:44:54 +00:00
meson install -C build --destdir "$pkgdir"
2013-07-01 23:28:11 +00:00
2024-03-02 14:37:26 +00:00
mkdir -p "$pkgdir"/usr/lib/{sysusers,tmpfiles}.d
echo 'g libvirt - -' > "$pkgdir/usr/lib/sysusers.d/libvirt-qemu.conf"
2022-03-03 13:52:19 +00:00
echo 'u libvirt-qemu /var/lib/libvirt "Libvirt QEMU user"' >> "$pkgdir/usr/lib/sysusers.d/libvirt.conf"
echo 'm libvirt-qemu kvm' >> "$pkgdir/usr/lib/sysusers.d/libvirt.conf"
echo 'z /var/lib/libvirt/qemu 0751' > "$pkgdir/usr/lib/tmpfiles.d/libvirt.conf"
2013-07-01 23:28:11 +00:00
2020-06-02 13:53:24 +00:00
chmod 600 "$pkgdir"/etc/libvirt/nwfilter/*.xml \
"$pkgdir/etc/libvirt/qemu/networks/default.xml"
2022-04-02 19:31:01 +00:00
chmod 700 "$pkgdir"/etc/libvirt/secrets
2024-05-02 22:07:14 +00:00
chmod 711 "$pkgdir"/var/lib/libvirt/swtpm
2015-07-25 01:16:28 +00:00
2013-07-01 23:28:11 +00:00
rm -rf \
2020-06-02 13:53:24 +00:00
"$pkgdir/run" \
"$pkgdir/var/lib/libvirt/qemu" \
"$pkgdir/var/cache/libvirt/qemu" \
"$pkgdir/etc/logrotate.d/libvirtd.libxl"
2017-03-03 19:25:31 +00:00
2020-06-02 13:53:24 +00:00
rm -f "$pkgdir/etc/libvirt/qemu/networks/autostart/default.xml"
# move split modules
2021-01-25 19:27:55 +00:00
mv "$pkgdir"/usr/lib/libvirt/storage-backend/libvirt_storage_backend_gluster.so "$pkgdir/../"
2020-10-18 19:32:57 +00:00
mv "$pkgdir/usr/lib/libvirt/storage-backend/libvirt_storage_backend_iscsi-direct.so" "$pkgdir/../"
mv "$pkgdir/usr/lib/libvirt/storage-file/libvirt_storage_file_gluster.so" "$pkgdir/../"
2020-06-02 13:53:24 +00:00
}
package_libvirt-storage-gluster() {
pkgdesc="Libvirt Gluster storage backend"
depends=("libvirt=$pkgver" 'glusterfs')
optdepends=()
backup=()
2020-10-18 19:32:57 +00:00
install -Dv -t "$pkgdir/usr/lib/libvirt/storage-backend" "$pkgdir/../libvirt_storage_backend_gluster.so"
install -Dv -t "$pkgdir/usr/lib/libvirt/storage-file" "$pkgdir/../libvirt_storage_file_gluster.so"
2020-06-02 13:53:24 +00:00
}
2019-06-05 12:48:46 +00:00
2020-06-02 13:53:24 +00:00
package_libvirt-storage-iscsi-direct() {
pkgdesc="Libvirt iSCSI-direct storage backend"
depends=("libvirt=$pkgver" 'libiscsi')
optdepends=()
backup=()
2019-06-05 12:48:46 +00:00
2020-10-18 19:32:57 +00:00
install -Dv -t "$pkgdir/usr/lib/libvirt/storage-backend" "$pkgdir/../libvirt_storage_backend_iscsi-direct.so"
2013-07-01 23:28:11 +00:00
}