From f93a1346f0f7d1bece6599be35e3187a3b495ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 23 Nov 2023 00:38:44 +0100 Subject: [PATCH] Add systemd-networkd-defaults subpackage --- ...always-install-network-example-files.patch | 42 +++++++++++++++++++ split-files.py | 9 +++- systemd.spec | 16 +++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 0001-meson-always-install-network-example-files.patch diff --git a/0001-meson-always-install-network-example-files.patch b/0001-meson-always-install-network-example-files.patch new file mode 100644 index 0000000..de84bf7 --- /dev/null +++ b/0001-meson-always-install-network-example-files.patch @@ -0,0 +1,42 @@ +From 518d40b992abca8de5b9136e88748783200535da Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 23 Nov 2023 00:06:29 +0100 +Subject: [PATCH] meson: always install network example files + +I started working on integrating this in the Fedora package and realized that +the example files should be installed regardless of the renamed files when +default-network=true is used. This is because the renamed files become part of +a different package, and we want to have the other files which are used as +documentation in the main package anyway. +--- + network/meson.build | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/network/meson.build b/network/meson.build +index 4f17f7385e..2a472f4f51 100644 +--- a/network/meson.build ++++ b/network/meson.build +@@ -18,6 +18,10 @@ if conf.get('ENABLE_NETWORKD') == 1 + '80-wifi-station.network.example', + ) + ++ install_data( ++ example_network_files, ++ install_dir : networkdir) ++ + if get_option('default-network') + foreach f : example_network_files + install_data( +@@ -25,12 +29,7 @@ if conf.get('ENABLE_NETWORKD') == 1 + rename : fs.replace_suffix(fs.name(f), ''), + install_dir : networkdir) + endforeach +- else +- install_data( +- example_network_files, +- install_dir : networkdir) + endif +- + endif + + install_data('99-default.link', diff --git a/split-files.py b/split-files.py index 0f1260e..c6e3cb7 100644 --- a/split-files.py +++ b/split-files.py @@ -24,6 +24,7 @@ o_rpm_macros = open('.file-list-rpm-macros', 'w') o_devel = open('.file-list-devel', 'w') o_container = open('.file-list-container', 'w') o_networkd = open('.file-list-networkd', 'w') +o_networkd_defaults = open('.file-list-networkd-defaults', 'w') o_oomd_defaults = open('.file-list-oomd-defaults', 'w') o_remote = open('.file-list-remote', 'w') o_resolve = open('.file-list-resolve', 'w') @@ -103,7 +104,13 @@ for file in files(buildroot): ''', n, re.X): o = o_container - elif re.search(r'''/usr/lib/systemd/network/80-| + # .network.example files go into systemd-networkd, and the matching files + # without .example go into systemd-networkd-defaults + elif (re.search(r'''/usr/lib/systemd/network/.*\.network$''', n) + and os.path.exists(f'./{n}.example')): + o = o_networkd_defaults + + elif re.search(r'''/usr/lib/systemd/network/.*\.network| networkd| networkctl| org.freedesktop.network1| diff --git a/systemd.spec b/systemd.spec index 7ccc47b..df45e91 100644 --- a/systemd.spec +++ b/systemd.spec @@ -105,6 +105,8 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[ # Drop when dracut-060 is available. Patch0001: https://github.com/systemd/systemd/pull/26494.patch +Patch0002: 0001-meson-always-install-network-example-files.patch + # Those are downstream-only patches, but we don't want them in packit builds: # https://bugzilla.redhat.com/show_bug.cgi?id=1738828 @@ -489,6 +491,17 @@ systemd-networkd is a system service that manages networks. It detects and configures network devices as they appear, as well as creating virtual network devices. +%package networkd-defaults +Summary: Configure network interfaces with networkd by default +Requires: %{name}-networkd = %{version}-%{release} +License: MIT-0 +BuildArch: noarch + +%description networkd-defaults +This package contains a set of config files for systemd-networkd that cause it +to configure network interfaces by default. Note that systemd-networkd needs to +enabled for this to have any effect. + %package resolved Summary: Network Name Resolution manager Requires: %{name}%{_isa} = %{version}-%{release} @@ -625,6 +638,7 @@ CONFIGURE_OPTS=( -Dstandalone-binaries=true -Ddefault-kill-user-processes=false -Dfirst-boot-full-preset=true + -Ddefault-network=true -Dtests=unsafe -Dinstall-tests=true -Dtty-gid=5 @@ -1150,6 +1164,8 @@ fi %files networkd -f .file-list-networkd +%files networkd-defaults -f .file-list-networkd-defaults + %files oomd-defaults -f .file-list-oomd-defaults %files tests -f .file-list-tests