Skip to content

Commit

Permalink
Add Makefile
Browse files Browse the repository at this point in the history
Co-authored-by: Michal Sekletar <[email protected]>
  • Loading branch information
jamacku and msekletar committed Oct 16, 2023
1 parent 548e8e7 commit c463c2b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions rules/60-net.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="1", PROGRAM="/lib/udev/ifcfg-devname", RESULT=="?*", NAME="$result"
9 changes: 4 additions & 5 deletions rust-ifcfg-devname.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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.}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion usr/lib/udev/rules.d/60-net.rules

This file was deleted.

0 comments on commit c463c2b

Please sign in to comment.