- use better patch for udev activation

This commit is contained in:
Dan Horák 2018-05-14 15:39:57 +02:00
parent eb604b348b
commit fa7a55e976
3 changed files with 209 additions and 81 deletions

View File

@ -1,71 +0,0 @@
From b880ec7893b072467df1dc202d3a09f5bddbb9b6 Mon Sep 17 00:00:00 2001
From: Jakub Cajka <jcajka@redhat.com>
Date: Wed, 8 Jul 2015 12:48:43 -0300
Subject: [PATCH] Service start is controled by udev rule
Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
[Rebased to upstream.]
[Modified to use Autotools.]
---
systemd/iprdump.service.in | 2 +-
systemd/iprinit.service.in | 2 +-
systemd/iprupdate.service.in | 2 +-
systemd/iprutils.target | 7 +++++++
udev/rules.d/90-iprutils.rules | 1 +
5 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 systemd/iprutils.target
create mode 100644 udev/rules.d/90-iprutils.rules
diff --git a/systemd/iprdump.service.in b/systemd/iprdump.service.in
index 7f60e7c..fc92a40 100644
--- a/systemd/iprdump.service.in
+++ b/systemd/iprdump.service.in
@@ -7,4 +7,4 @@ Type=forking
ExecStart=@sbindir@/iprdump --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprinit.service.in b/systemd/iprinit.service.in
index dfbd33e..fb20cce 100644
--- a/systemd/iprinit.service.in
+++ b/systemd/iprinit.service.in
@@ -6,4 +6,4 @@ Type=forking
ExecStart=@sbindir@/iprinit --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprupdate.service.in b/systemd/iprupdate.service.in
index 9f44245..001b1e8 100644
--- a/systemd/iprupdate.service.in
+++ b/systemd/iprupdate.service.in
@@ -6,4 +6,4 @@ Type=forking
ExecStart=@sbindir@/iprupdate --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprutils.target b/systemd/iprutils.target
new file mode 100644
index 0000000..1b1260e
--- /dev/null
+++ b/systemd/iprutils.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=IBM Power Raid utilities
+Requires=iprupdate.service iprinit.service iprdump.service basic.target
+Before=default.target
+
+[Install]
+WantedBy=default.target
diff --git a/udev/rules.d/90-iprutils.rules b/udev/rules.d/90-iprutils.rules
new file mode 100644
index 0000000..1bb5a4a
--- /dev/null
+++ b/udev/rules.d/90-iprutils.rules
@@ -0,0 +1 @@
+DRIVERS=="ipr", TAG+="systemd", ENV{SYSTEMD_WANTS}+="iprutils.target"
--
2.1.0

View File

@ -0,0 +1,199 @@
From 65ada384b036556ad4c608b317187a89543d053f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Sun, 13 May 2018 18:48:47 +0200
Subject: [PATCH 1/3] Add posibility to activate ipr systemd units via udev
rule and corresponding iprutils.target that makes deps between the ipr
systemd units Add those new files in to the dist target
---
Makefile.am | 1 +
configure.ac | 2 +-
systemd/Makefile.am | 2 +-
systemd/iprdump.service.in | 2 +-
systemd/iprinit.service.in | 2 +-
systemd/iprupdate.service.in | 2 +-
systemd/iprutils.target | 7 +++++++
udev/Makefile.am | 11 +++++++++++
udev/rules.d/90-iprutils.rules | 1 +
9 files changed, 25 insertions(+), 5 deletions(-)
create mode 100644 systemd/iprutils.target
create mode 100644 udev/Makefile.am
create mode 100644 udev/rules.d/90-iprutils.rules
diff --git a/Makefile.am b/Makefile.am
index d528c26..a92f1bf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,6 +47,7 @@ SUBDIRS = . init.d spec
if SYSTEMD
SUBDIRS += systemd
+SUBDIRS += udev
endif
if SOSREPORT
diff --git a/configure.ac b/configure.ac
index 774db12..dd1e32d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,5 +159,5 @@ AC_CHECK_FUNCS([getcwd isascii memset mkdir munmap pow setenv setlocale \
socket strcasecmp strchr strncasecmp strrchr strstr \
strtol strtoul strtoull])
-AC_CONFIG_FILES([Makefile systemd/Makefile init.d/Makefile spec/Makefile])
+AC_CONFIG_FILES([Makefile systemd/Makefile init.d/Makefile spec/Makefile udev/Makefile])
AC_OUTPUT
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index b9a28c9..3feb05d 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -16,7 +16,7 @@ systemdunitdir = @systemdunitdir@
nodist_systemdunit_DATA = iprdump.service \
iprinit.service iprupdate.service
EXTRA_DIST = iprdump.service.in \
- iprinit.service.in iprupdate.service.in
+ iprinit.service.in iprupdate.service.in iprutils.target
clean-local:
-rm iprdump.service iprinit.service iprupdate.service
diff --git a/systemd/iprdump.service.in b/systemd/iprdump.service.in
index 7f60e7c..fc92a40 100644
--- a/systemd/iprdump.service.in
+++ b/systemd/iprdump.service.in
@@ -7,4 +7,4 @@ Type=forking
ExecStart=@sbindir@/iprdump --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprinit.service.in b/systemd/iprinit.service.in
index dfbd33e..fb20cce 100644
--- a/systemd/iprinit.service.in
+++ b/systemd/iprinit.service.in
@@ -6,4 +6,4 @@ Type=forking
ExecStart=@sbindir@/iprinit --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprupdate.service.in b/systemd/iprupdate.service.in
index 9f44245..001b1e8 100644
--- a/systemd/iprupdate.service.in
+++ b/systemd/iprupdate.service.in
@@ -6,4 +6,4 @@ Type=forking
ExecStart=@sbindir@/iprupdate --daemon
[Install]
-WantedBy=multi-user.target
+WantedBy=iprutils.target
diff --git a/systemd/iprutils.target b/systemd/iprutils.target
new file mode 100644
index 0000000..1b1260e
--- /dev/null
+++ b/systemd/iprutils.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=IBM Power Raid utilities
+Requires=iprupdate.service iprinit.service iprdump.service basic.target
+Before=default.target
+
+[Install]
+WantedBy=default.target
diff --git a/udev/Makefile.am b/udev/Makefile.am
new file mode 100644
index 0000000..740dcaa
--- /dev/null
+++ b/udev/Makefile.am
@@ -0,0 +1,11 @@
+# IBM IPR adapter configuration utility
+#
+# (C) Copyright 2015
+# International Business Machines Corporation and others.
+# All Rights Reserved. This program and the accompanying
+# materials are made available under the terms of the
+# Common Public License v1.0 which accompanies this distribution.
+#
+#
+:
+EXTRA_DIST = rules.d/
diff --git a/udev/rules.d/90-iprutils.rules b/udev/rules.d/90-iprutils.rules
new file mode 100644
index 0000000..1bb5a4a
--- /dev/null
+++ b/udev/rules.d/90-iprutils.rules
@@ -0,0 +1 @@
+DRIVERS=="ipr", TAG+="systemd", ENV{SYSTEMD_WANTS}+="iprutils.target"
From aeca4f9208bf45db2486736530021e53f65f7e6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 14 May 2018 10:27:38 +0200
Subject: [PATCH 2/3] properly install iprutils.target
---
systemd/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index 3feb05d..ba858ef 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -16,7 +16,8 @@ systemdunitdir = @systemdunitdir@
nodist_systemdunit_DATA = iprdump.service \
iprinit.service iprupdate.service
EXTRA_DIST = iprdump.service.in \
- iprinit.service.in iprupdate.service.in iprutils.target
+ iprinit.service.in iprupdate.service.in
+systemdunit_DATA = iprutils.target
clean-local:
-rm iprdump.service iprinit.service iprupdate.service
From 3af0d5dc832406ccee601ef1e8aba777c8262406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 14 May 2018 10:46:59 +0200
Subject: [PATCH 3/3] install udev rules
---
configure.ac | 2 ++
udev/{rules.d => }/90-iprutils.rules | 0
udev/Makefile.am | 5 +++--
3 files changed, 5 insertions(+), 2 deletions(-)
rename udev/{rules.d => }/90-iprutils.rules (100%)
diff --git a/configure.ac b/configure.ac
index dd1e32d..e71558a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,7 @@ AM_CONDITIONAL([IPRDUMPFMT], [test "x${iprdumpfmt}" = xtrue])
# --with-systemd
systemdunitdir='${exec_prefix}/lib/systemd/system/'
+udevrulesdir='${exec_prefix}/lib/udev/rules.d/'
AC_ARG_WITH([systemd],
[--without-systemd Disable systemd service files.],
[case $withval in
@@ -91,6 +92,7 @@ AC_ARG_WITH([systemd],
esac], [systemd=true])
AM_CONDITIONAL([SYSTEMD], [test "x${systemd}" = xtrue])
AC_SUBST(systemdunitdir, ${systemdunitdir})
+AC_SUBST(udevrulesdir, ${udevrulesdir})
# --with-initd
initddir="${prefix}/etc/init.d/"
diff --git a/udev/rules.d/90-iprutils.rules b/udev/90-iprutils.rules
similarity index 100%
rename from udev/rules.d/90-iprutils.rules
rename to udev/90-iprutils.rules
diff --git a/udev/Makefile.am b/udev/Makefile.am
index 740dcaa..30211c1 100644
--- a/udev/Makefile.am
+++ b/udev/Makefile.am
@@ -7,5 +7,6 @@
# Common Public License v1.0 which accompanies this distribution.
#
#
-:
-EXTRA_DIST = rules.d/
+
+udevrulesdir = @udevrulesdir@
+udevrules_DATA = 90-iprutils.rules

View File

@ -1,7 +1,7 @@
Summary: Utilities for the IBM Power Linux RAID adapters
Name: iprutils
Version: 2.4.16.1
Release: 1%{?dist}
Release: 2%{?dist}
License: CPL
Group: System Environment/Base
URL: http://sourceforge.net/projects/iprdd/
@ -10,9 +10,10 @@ Source0: https://sourceforge.net/projects/iprdd/files/iprutils%20for%202.6%20ker
# missing man page
Source1: iprdbg.8.gz
# sent to upstream
Patch0: 0001-Service-start-is-controled-by-udev-rule.patch
# https://github.com/bjking1/iprutils/pull/2
Patch0: iprutils-udev-activation.patch
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: libcap-devel
BuildRequires: kernel-headers
@ -28,21 +29,17 @@ supported by the ipr SCSI storage device driver.
%prep
%autosetup -p1
autoreconf -vif
%build
%configure --with-systemd --disable-static --disable-sosreport
%configure --with-systemd --without-initscripts --disable-static --disable-sosreport
%{make_build}
%install
%{make_install}
# iprutils.target
install -p -m 0644 systemd/iprutils.target %{buildroot}/%{_unitdir}/iprutils.target
mkdir -p %{buildroot}/%{_udevrulesdir}
install -p -m 0644 udev/rules.d/90-iprutils.rules %{buildroot}/%{_udevrulesdir}/90-iprutils.rules
# missing man page
install -p -m 0644 %SOURCE1 %{buildroot}%{_mandir}/man8/
@ -79,6 +76,9 @@ rm %{buildroot}/%{_sysconfdir}/ha.d/resource.d/iprha
%changelog
* Mon May 14 2018 Dan Horák <dan[at]danny.cz> - 2.4.16.1-2
- use better patch for udev activation
* Fri May 11 2018 Dan Horák <dan[at]danny.cz> - 2.4.16.1-1
- rebased to 2.4.16.1
- spec file cleanup