From 548e8e7715e73c1a78b0540c325ba164d2f50607 Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Wed, 23 Mar 2022 09:35:45 +0100 Subject: [PATCH 1/2] udev: Import 60-net.rules from initscripts Move 60-net.rules from initscripts - https://github.com/fedora-sysv/initscripts/blob/c28529c5dc64d036fe6b9ea0bf3d78f049b97445/usr/lib/udev/rules.d/60-net.rules Related to https://github.com/fedora-sysv/initscripts/pull/379 --- rust-ifcfg-devname.spec | 4 ++++ usr/lib/udev/rules.d/60-net.rules | 1 + 2 files changed, 5 insertions(+) create mode 100644 usr/lib/udev/rules.d/60-net.rules diff --git a/rust-ifcfg-devname.spec b/rust-ifcfg-devname.spec index b5ed4b3..fb65e6c 100644 --- a/rust-ifcfg-devname.spec +++ b/rust-ifcfg-devname.spec @@ -31,7 +31,9 @@ License: GPL-3.0-or-later and MIT %files -n %{crate} %license LICENSE %doc README.md + %{_bindir}/ifcfg-devname +%{_udevrulesdir}/60-net.rules %package devel Summary: %{summary} @@ -72,6 +74,8 @@ use the "default" feature of the "%{crate}" crate. %install %cargo_install +install -m 0755 -d $(DESTDIR)$(libdir)/udev + %if %{with check} %check %cargo_test diff --git a/usr/lib/udev/rules.d/60-net.rules b/usr/lib/udev/rules.d/60-net.rules new file mode 100644 index 0000000..9e60be2 --- /dev/null +++ b/usr/lib/udev/rules.d/60-net.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/usr/bin/ifcfg-devname", RESULT=="?*", NAME="$result" From c463c2ba9388d3f6aedba59476d2ae04e2bda814 Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Thu, 6 Oct 2022 13:09:26 +0200 Subject: [PATCH 2/2] Add Makefile Co-authored-by: Michal Sekletar --- Makefile | 26 ++++++++++++++++++++++++++ rules/60-net.rules | 1 + rust-ifcfg-devname.spec | 9 ++++----- usr/lib/udev/rules.d/60-net.rules | 1 - 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 Makefile create mode 100644 rules/60-net.rules delete mode 100644 usr/lib/udev/rules.d/60-net.rules diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..238e273 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +NAME:=ifcfg-devname + +all: production check + +check: + @cargo test + +build: + @cargo build + +production: + @cargo build --release + +install: + mkdir -p $(DESTDIR)/usr/lib/udev/rules.d + install -p -m 0755 target/release/$(NAME) $(DESTDIR)/usr/lib/udev/ + install -p -m 644 rules/60-net.rules $(DESTDIR)/usr/lib/udev/rules.d/ + +uninstall: + rm -f $(DESTDIR)/usr/lib/udev/$(NAME) + rm -f $(DESTDIR)/usr/lib/udev/rules/60-net.rules + +clean: + @cargo clean + +.PHONY: check build production install uninstall clean diff --git a/rules/60-net.rules b/rules/60-net.rules new file mode 100644 index 0000000..ad58eba --- /dev/null +++ b/rules/60-net.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/lib/udev/ifcfg-devname", RESULT=="?*", NAME="$result" diff --git a/rust-ifcfg-devname.spec b/rust-ifcfg-devname.spec index fb65e6c..5be442d 100644 --- a/rust-ifcfg-devname.spec +++ b/rust-ifcfg-devname.spec @@ -10,12 +10,13 @@ Summary: Udev helper utility that provides network interface naming # Upstream license specification: GPL-3.0 License: GPL-3.0-or-later -URL: https://crates.io/crates/ifcfg-devname +URL: https://crates.io/crates/%{crate} Source: %{crates_source} ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging +BuildRequires: systemd-rpm-macros %global _description %{expand: Udev helper utility that provides network interface naming using ifcfg configuration.} @@ -32,7 +33,7 @@ License: GPL-3.0-or-later and MIT %license LICENSE %doc README.md -%{_bindir}/ifcfg-devname +%{_prefix}/lib/udev/%{crate} %{_udevrulesdir}/60-net.rules %package devel @@ -72,9 +73,7 @@ use the "default" feature of the "%{crate}" crate. %cargo_build %install -%cargo_install - -install -m 0755 -d $(DESTDIR)$(libdir)/udev +%make_install %if %{with check} %check diff --git a/usr/lib/udev/rules.d/60-net.rules b/usr/lib/udev/rules.d/60-net.rules deleted file mode 100644 index 9e60be2..0000000 --- a/usr/lib/udev/rules.d/60-net.rules +++ /dev/null @@ -1 +0,0 @@ -ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/usr/bin/ifcfg-devname", RESULT=="?*", NAME="$result"