commit:     dbe0331557ad48596cdad48f29f41cfbdacc26e9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 05:13:51 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 05:57:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbe03315

net-analyzer/pmacct: add systemd units

Borrowed from opensuse then adapted.

Closes: https://bugs.gentoo.org/635562
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-analyzer/pmacct/files/nfacctd.service             | 18 ++++++++++++++++++
 net-analyzer/pmacct/files/pmacctd.service             | 19 +++++++++++++++++++
 net-analyzer/pmacct/files/sfacctd.service             | 18 ++++++++++++++++++
 .../{pmacct-1.7.7.ebuild => pmacct-1.7.7-r1.ebuild}   |  4 +++-
 net-analyzer/pmacct/pmacct-9999.ebuild                |  4 +++-
 5 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/net-analyzer/pmacct/files/nfacctd.service 
b/net-analyzer/pmacct/files/nfacctd.service
new file mode 100644
index 000000000000..d649f47030bf
--- /dev/null
+++ b/net-analyzer/pmacct/files/nfacctd.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=netflow accounting daemon
+After=network.target
+
+[Service]
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+Type=forking
+ExecStart=/usr/sbin/nfacctd -f /etc/pmacctd/nfacctd.conf -i %I
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-analyzer/pmacct/files/pmacctd.service 
b/net-analyzer/pmacct/files/pmacctd.service
new file mode 100644
index 000000000000..a2dbb8c45846
--- /dev/null
+++ b/net-analyzer/pmacct/files/pmacctd.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=promiscuous mode accounting daemon
+After=network.target
+
+[Service]
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+Type=forking
+ExecStart=/usr/sbin/pmacctd -f /etc/pmacctd/pmacctd.conf -i %I
+
+[Install]
+WantedBy=multi-user.target
+

diff --git a/net-analyzer/pmacct/files/sfacctd.service 
b/net-analyzer/pmacct/files/sfacctd.service
new file mode 100644
index 000000000000..7a334e0ffadd
--- /dev/null
+++ b/net-analyzer/pmacct/files/sfacctd.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=sflow accounting daemon
+After=network.target
+
+[Service]
+ProtectSystem=full
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelTunables=true
+ProtectKernelModules=true
+ProtectKernelLogs=true
+ProtectControlGroups=true
+RestrictRealtime=true
+Type=forking
+ExecStart=/usr/sbin/sfacctd -f /etc/pmacctd/sfacctd.conf -i %I
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-analyzer/pmacct/pmacct-1.7.7.ebuild 
b/net-analyzer/pmacct/pmacct-1.7.7-r1.ebuild
similarity index 95%
rename from net-analyzer/pmacct/pmacct-1.7.7.ebuild
rename to net-analyzer/pmacct/pmacct-1.7.7-r1.ebuild
index 687b4ef7d8f2..55db903b6abd 100644
--- a/net-analyzer/pmacct/pmacct-1.7.7.ebuild
+++ b/net-analyzer/pmacct/pmacct-1.7.7-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit autotools toolchain-funcs
+inherit autotools toolchain-funcs systemd
 
 DESCRIPTION="A network tool to gather IP traffic information"
 HOMEPAGE="http://www.pmacct.net/";
@@ -102,6 +102,8 @@ src_install() {
        newinitd "${FILESDIR}"/pmacctd-init.d pmacctd
        newconfd "${FILESDIR}"/pmacctd-conf.d pmacctd
 
+       systemd_dounit "${FILESDIR}"/{nfacctd,pmacctd,sfacctd}.service
+
        insinto /etc/pmacctd
        newins examples/pmacctd-imt.conf.example pmacctd.conf
 }

diff --git a/net-analyzer/pmacct/pmacct-9999.ebuild 
b/net-analyzer/pmacct/pmacct-9999.ebuild
index 687b4ef7d8f2..55db903b6abd 100644
--- a/net-analyzer/pmacct/pmacct-9999.ebuild
+++ b/net-analyzer/pmacct/pmacct-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit autotools toolchain-funcs
+inherit autotools toolchain-funcs systemd
 
 DESCRIPTION="A network tool to gather IP traffic information"
 HOMEPAGE="http://www.pmacct.net/";
@@ -102,6 +102,8 @@ src_install() {
        newinitd "${FILESDIR}"/pmacctd-init.d pmacctd
        newconfd "${FILESDIR}"/pmacctd-conf.d pmacctd
 
+       systemd_dounit "${FILESDIR}"/{nfacctd,pmacctd,sfacctd}.service
+
        insinto /etc/pmacctd
        newins examples/pmacctd-imt.conf.example pmacctd.conf
 }

Reply via email to