summaryrefslogtreecommitdiff
path: root/net-firewall/nfacct
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
committerV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
commit2771f79232c273bc2a57d23bf335dd81ccf6af28 (patch)
treec8af0fd04194aed03cf067d44e53c7edd3e9ab84 /net-firewall/nfacct
parente9d044d4b9b71200a96adfa280848858c0f468c9 (diff)
gentoo resync : 05.12.2021
Diffstat (limited to 'net-firewall/nfacct')
-rw-r--r--net-firewall/nfacct/Manifest4
-rw-r--r--net-firewall/nfacct/files/nfacct.confd7
-rw-r--r--net-firewall/nfacct/files/nfacct.initd42
-rw-r--r--net-firewall/nfacct/nfacct-1.0.2-r1.ebuild (renamed from net-firewall/nfacct/nfacct-1.0.2.ebuild)8
4 files changed, 60 insertions, 1 deletions
diff --git a/net-firewall/nfacct/Manifest b/net-firewall/nfacct/Manifest
index 4f38d7750344..c83f67ab638f 100644
--- a/net-firewall/nfacct/Manifest
+++ b/net-firewall/nfacct/Manifest
@@ -1,3 +1,5 @@
+AUX nfacct.confd 187 BLAKE2B a24307553ce81bba7885b4846ece38d0e2dad233271c3a38536e1f091a56c0fd9f8b60263f111c41b91f971ab26522aba85be62c4fff216b1c843abb1530d46a SHA512 01207f81a75365982ce9090cc605ee60799b0a46a3d649132733238a70b4380dceedaef39b1d52b99b661b1adeecd799f30c01f38ee5e923a9f94e9c3dadc34f
+AUX nfacct.initd 775 BLAKE2B dedd042368320a5c028fe733eeb6be104c12b0aa84c88a21a361cf71b4b188d1179066f979c9a3e5a916af9d63da0d4cf7f1548acdaac62305812c793a7f62fc SHA512 d87bc1f884698024677af8c11ad2c8c5459bd452d09139425bd751247e3024f9253893cd6d25fad6365349d9c4699c0e3904659b6eb7b7a34b0702e463319d0e
DIST nfacct-1.0.2.tar.bz2 265449 BLAKE2B 08da45f90a2982746633001265c93ff6d055bc0ec9bcfb731b60e3666a2ee2520ed499ea57815e524b6c49369415aa4215d0c8e6ea02c1ce76dbc22de2fc79ea SHA512 2d7a76a51ffb10601e67ceda2ce055e63a8da802a682aab3c96cfa38e1d9d0d7ae7fa204d17d555303216e2ceeb0965d6b25387634725cf35e0a7109d84b47b3
-EBUILD nfacct-1.0.2.ebuild 553 BLAKE2B 9ce45786b64c26e1143f50578fbdec41553e6a211568dcb8e9fcde114d1381886799a2daadfd7b8d14c49cd201fca3767cc37b2f5460c547f4b86e20ced2acaa SHA512 cbf6d62eb370e5609474b42a1bf18df6cb886bdfb9524a58f404ed37cde2b1b958708f086888bd589d696d27063a33eb942cbf0efe988a22a2b5276d75632372
+EBUILD nfacct-1.0.2-r1.ebuild 705 BLAKE2B 55b5a0b5aedefe31b3cf0e02522c3bee1b2a761ea30370320e0243822e9931037be6f95313d4dfbec841dc089d5569b91e8e75228f0ce3ba6e82698e83c3de5b SHA512 f3a11b28f7cf36b2f4900b26a247df207798c723dd024e8ff4ed7772e32ced35538c7f7efcd7fbebdd1ee8f1a9e5dda12a3204697ffd3c87ba905112521e9e8e
MISC metadata.xml 281 BLAKE2B 7e0e1c117646c2893f34d5ed50df583ba6450b0e9ed93eaeb7c689e0d73116233ad242160215fcb7261551f1c8475101b9ea5e605445d2c57d91dd8b8f0b972a SHA512 7208366ad23bf46ff28d5b9ebbe42c626cd6f04c6edb09cd2047a0100ad82ff174667835f3933dca94e44a8137b8b0af53aef684cbb38d244cee95275691226d
diff --git a/net-firewall/nfacct/files/nfacct.confd b/net-firewall/nfacct/files/nfacct.confd
new file mode 100644
index 000000000000..b695251ebb03
--- /dev/null
+++ b/net-firewall/nfacct/files/nfacct.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/nfacct
+
+# Location for nfacct initscript to save and restore the counters
+NFACCT_SAVE="/var/lib/nfacct/counters-save"
+
+# Save counters on stopping nfacct
+SAVE_ON_STOP="yes"
diff --git a/net-firewall/nfacct/files/nfacct.initd b/net-firewall/nfacct/files/nfacct.initd
new file mode 100644
index 000000000000..ac5eeaa33aba
--- /dev/null
+++ b/net-firewall/nfacct/files/nfacct.initd
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="save"
+
+NFACCT_SAVE=${NFACCT_SAVE:-/var/lib/nfacct/counters-save}
+
+depend() {
+ before iptables ip6tables
+}
+
+checkconfig() {
+ if [ ! -f "${NFACCT_SAVE}" ] ; then
+ eerror "Not starting ${SVCNAME}. First create some counters then run:"
+ eerror "/etc/init.d/${SVCNAME} save"
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Loading nfacct counters"
+ nfacct restore < "${NFACCT_SAVE}"
+ eend $?
+}
+
+stop() {
+ if [ "${SAVE_ON_STOP}" = "yes" ] ; then
+ save || return 1
+ fi
+ ebegin "Removing nfacct counters"
+ nfacct flush
+ eend $?
+}
+
+save() {
+ ebegin "Saving nfacct counters"
+ nfacct list > "${NFACCT_SAVE}"
+ eend $?
+}
diff --git a/net-firewall/nfacct/nfacct-1.0.2.ebuild b/net-firewall/nfacct/nfacct-1.0.2-r1.ebuild
index e8f02e4ce7f0..1feb53596a4b 100644
--- a/net-firewall/nfacct/nfacct-1.0.2.ebuild
+++ b/net-firewall/nfacct/nfacct-1.0.2-r1.ebuild
@@ -22,3 +22,11 @@ DEPEND="
"
CONFIG_CHECK="~NETFILTER_NETLINK_ACCT"
+
+src_install() {
+ default_src_install
+
+ keepdir /var/lib/nfacct
+ newinitd "${FILESDIR}"/${PN}.initd nfacct
+ newconfd "${FILESDIR}"/${PN}.confd nfacct
+}