orion pushed to flow-tools (epel7). "Migrate to systemd."
notifications at fedoraproject.org
notifications at fedoraproject.org
Mon Apr 13 21:36:04 UTC 2015
>From 111c79b84327bac0e6e6339db2846b3a9837b37b Mon Sep 17 00:00:00 2001
From: Jon Ciesla <limburgher at gmail.com>
Date: Tue, 24 Apr 2012 13:15:28 -0500
Subject: Migrate to systemd.
diff --git a/flow-capture.service b/flow-capture.service
new file mode 100644
index 0000000..4f03bd5
--- /dev/null
+++ b/flow-capture.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Flow-capture Capture Traffic Flow Data
+After=network.target
+
+[Service]
+User=flow-tools
+Group=flow-tools
+Type=forking
+EnvironmentFile=-/etc/sysconfig/flow-capture
+PIDFile=/run/flow-capture.pid
+ExecStart=/usr/bin/flow-capture -p /run/flow-capture.pid $OPTIONS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/flow-tools.spec b/flow-tools.spec
index 355cfd8..94af69b 100644
--- a/flow-tools.spec
+++ b/flow-tools.spec
@@ -8,21 +8,23 @@
Version: 0.68.5.1
Name: flow-tools
Summary: Tool set for working with NetFlow data
-Release: 4%{?dist}
+Release: 5%{?dist}
Group: Applications/System
License: BSD
URL: http://code.google.com/p/%{name}/
Source0: http://%{name}.googlecode.com/files/%{name}-%{version}.tar.bz2
-Source1: flow-capture.init
+Source1: flow-capture.service
Source2: flow-capture.sysconfig
BuildRequires: openssl-devel mysql-devel postgresql-devel zlib-devel
BuildRequires: bison flex tcp_wrappers-devel
BuildRequires: fedora-usermgmt-devel doxygen
%{?FE_USERADD_REQ}
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-Requires(post): initscripts chkconfig
-Requires(preun): initscripts chkconfig
-Requires(postun): initscripts
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+# For triggerun
+Requires(post): systemd-sysv
Provides: group(%username) = %uid
Provides: user(%username) = %uid
@@ -109,8 +111,8 @@ rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';'
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/%{name}
-install -d $RPM_BUILD_ROOT%{_initrddir}
-install -m 0755 %SOURCE1 $RPM_BUILD_ROOT%{_initrddir}/flow-capture
+install -d $RPM_BUILD_ROOT%{_unitdir}
+install -m 0644 %SOURCE1 $RPM_BUILD_ROOT%{_unitdir}/flow-capture.service
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -m 0644 %SOURCE2 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/flow-capture
@@ -124,22 +126,35 @@ rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
-/sbin/chkconfig --add flow-capture
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ $1 = 0 ]; then
- /sbin/service flow-capture stop >/dev/null 2>&1
- /sbin/chkconfig --del flow-capture
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable flow-capture.service > /dev/null 2>&1 || :
+ /bin/systemctl stop flow-capture.service > /dev/null 2>&1 || :
fi
%postun
/sbin/ldconfig
-if [ "$1" -ge "1" ]; then
- /sbin/service flow-capture condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart flow-capture.service >/dev/null 2>&1 || :
fi
-%__fe_userdel %username &>/dev/null || :
-%__fe_groupdel %username &>/dev/null || :
+%triggerun -- flow-tools < 0.68.5.1-5
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply flow-capture
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save flow-capture >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del flow-capture >/dev/null 2>&1 || :
+/bin/systemctl try-restart flow-capture.service >/dev/null 2>&1 || :
%files
%defattr(-,root,root)
@@ -197,7 +212,7 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}/cfg/*
%config(noreplace) %{_sysconfdir}/%{name}/sym/*
%config(noreplace) %{_sysconfdir}/sysconfig/flow-capture
-%{_initrddir}/flow-capture
+%{_unitdir}/flow-capture.service
%attr(-,flow-tools,flow-tools) %{_localstatedir}/%{name}/
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/*
@@ -219,6 +234,9 @@ fi
%doc docs/*.html ChangeLog.old TODO INSTALL SECURITY
%changelog
+* Tue Apr 24 2012 Jon Ciesla <limburgher at gmail.com> - 0.68.5.1-5
+- Migrate to systemd, BZ 767392.
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.68.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/flow-tools.git/commit/?h=epel7&id=111c79b84327bac0e6e6339db2846b3a9837b37b
More information about the scm-commits
mailing list