mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
meson: src/network: install default network xml
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
parent
f7ca387fa6
commit
c957791859
15
scripts/meson-install-symlink.py
Normal file
15
scripts/meson-install-symlink.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
destdir = os.environ.get('DESTDIR', os.sep)
|
||||
dirname = sys.argv[1]
|
||||
target = sys.argv[2]
|
||||
link = sys.argv[3]
|
||||
|
||||
workdir = os.path.join(destdir, dirname.strip(os.sep))
|
||||
|
||||
os.makedirs(workdir, exist_ok=True)
|
||||
os.chdir(workdir)
|
||||
os.symlink(target, link)
|
@ -21,6 +21,7 @@ scripts = [
|
||||
'meson-gen-def.py',
|
||||
'meson-gen-sym.py',
|
||||
'meson-install-dirs.py',
|
||||
'meson-install-symlink.py',
|
||||
'meson-python.sh',
|
||||
'mock-noinline.py',
|
||||
'prohibit-duplicate-header.py',
|
||||
|
@ -7,23 +7,7 @@ STATEFUL_DRIVER_SOURCE_FILES += \
|
||||
if WITH_NETWORK
|
||||
INSTALL_DATA_DIRS += network
|
||||
|
||||
UUID=$(shell uuidgen 2>/dev/null)
|
||||
|
||||
install-data-network:
|
||||
$(MKDIR_P) "$(DESTDIR)$(confdir)/qemu/networks/autostart"
|
||||
$(INSTALL_DATA) $(srcdir)/network/default.xml \
|
||||
$(DESTDIR)$(confdir)/qemu/networks/default.xml
|
||||
test -z "$(UUID)" || \
|
||||
{ sed -e "s,</name>,</name>; <uuid>$(UUID)</uuid>," \
|
||||
$(DESTDIR)$(confdir)/qemu/networks/default.xml | \
|
||||
tr ";" "\n" > \
|
||||
$(DESTDIR)$(confdir)/qemu/networks/default.xml.t && \
|
||||
cp $(DESTDIR)$(confdir)/qemu/networks/default.xml.t \
|
||||
$(DESTDIR)$(confdir)/qemu/networks/default.xml && \
|
||||
rm $(DESTDIR)$(confdir)/qemu/networks/default.xml.t; }
|
||||
( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
|
||||
rm -f default.xml && \
|
||||
$(LN_S) ../default.xml default.xml )
|
||||
if WITH_FIREWALLD_ZONE
|
||||
$(MKDIR_P) "$(DESTDIR)$(prefix)/lib/firewalld/zones"
|
||||
$(INSTALL_DATA) $(srcdir)/network/libvirt.zone \
|
||||
@ -31,10 +15,6 @@ if WITH_FIREWALLD_ZONE
|
||||
endif WITH_FIREWALLD_ZONE
|
||||
|
||||
uninstall-data-network:
|
||||
rm -f $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
|
||||
rm -f $(DESTDIR)$(confdir)/qemu/networks/default.xml
|
||||
rmdir "$(DESTDIR)$(confdir)/qemu/networks/autostart" || :
|
||||
rmdir "$(DESTDIR)$(confdir)/qemu/networks" || :
|
||||
if WITH_FIREWALLD_ZONE
|
||||
rm -f $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml
|
||||
endif WITH_FIREWALLD_ZONE
|
||||
|
@ -82,4 +82,36 @@ if conf.has('WITH_NETWORK')
|
||||
localstatedir / 'lib' / 'libvirt' / 'dnsmasq',
|
||||
runstatedir / 'libvirt' / 'network',
|
||||
]
|
||||
|
||||
uuidgen_prog = find_program('uuidgen', required: false)
|
||||
|
||||
if uuidgen_prog.found()
|
||||
uuid = run_command(uuidgen_prog).stdout().strip()
|
||||
|
||||
configure_file(
|
||||
input: 'default.xml.in',
|
||||
output: 'default.xml',
|
||||
command: [
|
||||
'sed', '-e', 's|</name>|</name>\\n <uuid>@0@</uuid>|'.format(uuid),
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: confdir / 'qemu' / 'networks',
|
||||
)
|
||||
else
|
||||
configure_file(
|
||||
input: 'default.xml.in',
|
||||
output: 'default.xml',
|
||||
copy: true,
|
||||
install: true,
|
||||
install_dir: confdir / 'qemu' / 'networks',
|
||||
)
|
||||
endif
|
||||
|
||||
meson.add_install_script(
|
||||
meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
|
||||
confdir / 'qemu' / 'networks' / 'autostart',
|
||||
'../default.xml', 'default.xml',
|
||||
)
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user