[fcoe-utils] Make fcoe-utils systemd aware (#714683)
Petr Sabata
psabata at fedoraproject.org
Mon Jul 18 13:40:16 UTC 2011
commit 8f401962e946eff5de657efafa34d2f3791b81b4
Author: Petr Sabata <contyk at redhat.com>
Date: Mon Jul 18 15:38:27 2011 +0200
Make fcoe-utils systemd aware (#714683)
Also, ancient scriptlets were removed, quickstart documentation updated
and some rpmlint issues resolved.
fcoe-utils.spec | 86 +++++++++++++++++++++++++-----------------------------
fcoe.config | 5 +++
fcoe.service | 13 ++++++++
quickstart.txt | 15 ++++-----
4 files changed, 65 insertions(+), 54 deletions(-)
---
diff --git a/fcoe-utils.spec b/fcoe-utils.spec
index 674454a..51934bb 100644
--- a/fcoe-utils.spec
+++ b/fcoe-utils.spec
@@ -1,35 +1,38 @@
-Name: fcoe-utils
-Version: 1.0.20
-Release: 1%{?dist}
-Summary: Fibre Channel over Ethernet utilities
-Group: Applications/System
-License: GPLv2
-URL: http://www.open-fcoe.org
+Name: fcoe-utils
+Version: 1.0.20
+Release: 2%{?dist}
+Summary: Fibre Channel over Ethernet utilities
+Group: Applications/System
+License: GPLv2
+URL: http://www.open-fcoe.org
# git://open-fcoe.org/fcoe/fcoe-utils.git
-Source0: %{name}-%{version}.tar.bz2
-Source1: quickstart.txt
+Source0: %{name}-%{version}.tar.bz2
+Source1: quickstart.txt
+Source2: fcoe.service
+Source3: fcoe.config
# Generic Fedora patches
-Patch0: fcoe-utils-1.0.20-init.patch
-Patch1: fcoe-utils-1.0.19-make.patch
-Patch2: fcoe-utils-1.0.18-help.patch
-Patch3: fcoe-utils-1.0.18-config.patch
-
+Patch0: fcoe-utils-1.0.20-init.patch
+Patch1: fcoe-utils-1.0.19-make.patch
+Patch2: fcoe-utils-1.0.18-help.patch
+Patch3: fcoe-utils-1.0.18-config.patch
BuildRequires: libtool automake autoconf
BuildRequires: lldpad-devel >= 0.9.43
BuildRequires: libhbaapi-devel >= 2.2-12
BuildRequires: libnl-devel
+BuildRequires: systemd-units
Requires: lldpad >= 0.9.43
Requires: libhbalinux >= 1.0.12
Requires: iproute
Requires: device-mapper-multipath
-Requires(post): chkconfig
-Requires(preun): chkconfig initscripts
-Requires(postun): initscripts
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%description
Fibre Channel over Ethernet utilities
fcoeadm - command line tool for configuring FCoE interfaces
-fcoemon - service to configure DCB Ethernet QOS filters, works with dcbd or lldpad
+fcoemon - service to configure DCB Ethernet QOS filters, works with dcbd
+or lldpad
%prep
%setup -q
@@ -45,12 +48,11 @@ make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
-mkdir -p %{buildroot}%{_initrddir}
-mv %{buildroot}/etc/init.d/fcoe %{buildroot}%{_initrddir}/fcoe
rm -rf %{buildroot}/etc/init.d
-install -m 644 %SOURCE1 quickstart.txt
-mkdir -p %{buildroot}%{_sysconfdir}/fcoe/
-cp etc/config %{buildroot}%{_sysconfdir}/fcoe/config
+install -m 644 %{SOURCE1} quickstart.txt
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig %{buildroot}%{_unitdir}
+install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
+install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/fcoe
mkdir -p %{buildroot}%{_libexecdir}/fcoe
install -m 755 contrib/fcc.sh %{buildroot}%{_libexecdir}/fcoe/fcc.sh
install -m 755 contrib/fcoe_edd.sh %{buildroot}%{_libexecdir}/fcoe/fcoe_edd.sh
@@ -59,44 +61,31 @@ install -m 755 debug/fcoedump.sh %{buildroot}%{_libexecdir}/fcoe/fcoedump.sh
install -m 755 debug/dcbcheck.sh %{buildroot}%{_libexecdir}/fcoe/dcbcheck.sh
%post
-/sbin/chkconfig --add fcoe
-
-%triggerun -- fcoe-utils <= 1.0.7-5
-if [ -x %{_initrddir}/fcoe-utils ]; then
- /sbin/service fcoe-utils stop > /dev/null 2>&1
- /sbin/chkconfig fcoe-utils off
- # now copy an updated file, which we need to do proper condrestart
- sed 's/\/var\/lock\/subsys\/fcoe/\/var\/lock\/subsys\/fcoe-utils/' %{_initrddir}/fcoe > %{_initrddir}/fcoe-utils
-fi
-
-%triggerpostun -- fcoe-utils <= 1.0.7-5
-if [ -x %{_initrddir}/fcoe-utils ]; then
- rm -f %{_initrddir}/fcoe-utils # this file should be already deleted, but just in case ...
+if [ $1 -eq 1 ]; then
+ systemctl enable fcoe.service
fi
%preun
-if [ $1 = 0 ]; then
- /sbin/service fcoe stop > /dev/null 2>&1
- /sbin/chkconfig --del fcoe
+if [ $1 -eq 0 ]; then
+ systemctl stop fcoe.service
+ systemctl disable fcoe.service
fi
%postun
-if [ "$1" -ge "1" ]; then
- /sbin/service fcoe condrestart > /dev/null 2>&1 || :
+if [ $1 -ge 1 ]; then
+ systemctl try-restart fcoe.service
fi
-
%files
-%defattr(-,root,root,-)
%doc README COPYING quickstart.txt
%{_sbindir}/*
%{_mandir}/man8/*
+%{_unitdir}/fcoe.service
+%config(noreplace) %{_sysconfdir}/sysconfig/fcoe
%dir %{_sysconfdir}/fcoe/
-%config(noreplace) %{_sysconfdir}/fcoe/config
%config(noreplace) %{_sysconfdir}/fcoe/cfg-ethx
%dir %{_sysconfdir}/bash_completion.d/
%{_sysconfdir}/bash_completion.d/*
-%{_initrddir}/fcoe
%attr(0755,root,root) %{_libexecdir}/fcoe/fcoe_edd.sh
%attr(0755,root,root) %{_libexecdir}/fcoe/fcoe-setup.sh
%attr(0755,root,root) %{_libexecdir}/fcoe/fcc.sh
@@ -105,6 +94,11 @@ fi
%changelog
+* Mon Jul 18 2011 Petr Sabata <contyk at redhat.com> - 1.0.20-2
+- Drop SysV support in favor of systemd (#714683)
+- Remove ancient scriptlets (pre-1.0.7 era)
+- Update quickstart.txt to reflect new changes
+
* Thu Jul 07 2011 Petr Sabata <contyk at redhat.com> - 1.0.20-1
- 1.0.20 bump
@@ -189,7 +183,7 @@ fi
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Tue Jun 9 2009 Jan Zeleny <jzeleny at redhat.com> - 1.0.7-7
-- added quickstart file to %doc (#500759)
+- added quickstart file to doc (#500759)
* Thu May 14 2009 Jan Zeleny <jzeleny at redhat.com> - 1.0.7-6
- renamed init script to fcoe, changed lock filename to fcoe
diff --git a/fcoe.config b/fcoe.config
new file mode 100644
index 0000000..635a01b
--- /dev/null
+++ b/fcoe.config
@@ -0,0 +1,5 @@
+# All supported drivers listed here are loaded when service starts
+SUPPORTED_DRIVERS="libfc fcoe"
+
+# Add --debug to enable debug messages
+FCOEMON_OPTS="--syslog"
diff --git a/fcoe.service b/fcoe.service
new file mode 100644
index 0000000..380da2e
--- /dev/null
+++ b/fcoe.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Open-FCoE Inititator.
+After=syslog.target network.target lldpad.service
+
+[Service]
+Type=forking
+PIDFile=/var/run/fcoemon.pid
+EnvironmentFile=/etc/sysconfig/fcoe
+ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
+ExecStart=/usr/sbin/fcoemon $FCOEMON_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/quickstart.txt b/quickstart.txt
index 5515090..fdb6e3f 100644
--- a/quickstart.txt
+++ b/quickstart.txt
@@ -11,16 +11,15 @@ Quick Start guide for Open-FCoE
3. Modify configuration files to enable FCoE. Set FCOE_ENABLE="yes" and
DCB_REQUIRED="yes".
-3. Run 'chkconfig fcoe on' to start FCoE per run level. This will setup
- FCoE to start on reboot.
+3. Run 'systemctl enable fcoe.service' to start FCoE per run level. This
+ will setup FCoE to start on reboot.
-4. Run 'chkconfig dcbd on' to start DCB per run level. This will setup DCB to
- start on reboot.
+4. Run 'systemctl enable lldpad.service' to start LLDP agent per run
+ level. This will setup DCB to start on reboot.
-5. Run 'service dcbd start' to start dcb.
+5. Run 'systemctl start lldpad.service' to start LLDP agent.
6. Run 'dcbtool sc ethX dcb on; dcbtool sc ethX app:0 e:1;' for each fcoe-enabled
- interface to setup dcb for fcoe.
-
-7. Run 'service fcoe start' to start fcoe.
+ interface to setup DCB for FCoE.
+7. Run 'systemctl start fcoe.sertvice' to start FCoE.
More information about the scm-commits
mailing list