[PATCH] main/conntrack-tools: change init script to declarative style
Export this patch
---
Mostly because I spent too much time figuring out why vrf="…" in conf.d
didn’t work. :)
Thanks!
main/conntrack-tools/APKBUILD | 10 +++++---
main/conntrack-tools/conntrackd.initd | 35 ++++++++++++---------------
2 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/main/conntrack-tools/APKBUILD b/main/conntrack-tools/APKBUILD
index e1ad0fa20c..6ee991ade9 100644
--- a/main/conntrack-tools/APKBUILD
+++ b/main/conntrack-tools/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=conntrack-tools
pkgver=1.4.6
-pkgrel=1
+pkgrel=2
pkgdesc="Connection tracking userspace tools"
url="https://www.netfilter.org/projects/conntrack-tools/"
arch="all"
@@ -47,7 +47,9 @@ package() {
"$pkgdir"/etc/logrotate.d/conntrackd
}
-sha512sums="a48260308a12b11b584fcf4658ec2c4c1adb2801c9cf9a73fc259e5c30d2fbe401aca21e931972413f03e415f98fbf9bd678d2126faa6c6d5748e8a652e58f1a conntrack-tools-1.4.6.tar.bz2
-1d8e6d6eec79233b276d12e78c5d184d356df85ede299bfa9f6967ace30987f3b2f8c8077a1e2f9123a817f2805fdb9bf8fa9ec441882a112d83cabf84932e16 conntrackd.initd
+sha512sums="
+a48260308a12b11b584fcf4658ec2c4c1adb2801c9cf9a73fc259e5c30d2fbe401aca21e931972413f03e415f98fbf9bd678d2126faa6c6d5748e8a652e58f1a conntrack-tools-1.4.6.tar.bz2
+f1d96a8107ff1f95b626d592121b59104a3a013970cad8112fde237db2db514d1383e520adf46bf1384831d8d91ec943838a9391b32c3d1ce2bf6aa83c86e18d conntrackd.initd
fd8cfab207867844db6671a8395efadca792d6085c3436381e574dc52f3b4e41d9526b3db6114dd98e534a5419ca19f291d21c091f8cf0426024d73d18133e6f conntrackd.confd
-1e4e6414bbf4210fab83d1a8cd7198bf11f2638d378abd674b1b66bd6ab6bdc048fc4052c3e263bd02dfc8085d007f3092f24e818f8579a940aa3b5af19c1766 conntrackd.logrotate"
+1e4e6414bbf4210fab83d1a8cd7198bf11f2638d378abd674b1b66bd6ab6bdc048fc4052c3e263bd02dfc8085d007f3092f24e818f8579a940aa3b5af19c1766 conntrackd.logrotate
+"
diff --git a/main/conntrack-tools/conntrackd.initd b/main/conntrack-tools/conntrackd.initd
index ba4d0a680c..fae89c6d8d 100644
--- a/main/conntrack-tools/conntrackd.initd
+++ b/main/conntrack-tools/conntrackd.initd
@@ -2,10 +2,15 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-CONNTRACKD_BIN="/usr/sbin/conntrackd"
CONNTRACKD_CFG=${CONNTRACKD_CFG:-/etc/conntrackd/conntrackd.conf}
CONNTRACKD_LOCK=${CONNTRACKD_LOCK:-/var/lock/conntrack.lock}
+command="/usr/sbin/conntrackd"
+command_args="-C ${CONNTRACKD_CFG} ${CONNTRACKD_OPTS}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+required_files="$CONNTRACKD_CFG"
+
depend() {
use logger
need net
@@ -61,13 +66,11 @@ checkconfig() {
eerror
return 1
fi
- # check for config file
- if [ ! -e "${CONNTRACKD_CFG}" ]; then
- eerror
- eerror "The conntrackd config file (${CONNTRACKD_CFG})"
- eerror "is missing!"
- eerror
- return 1
+}
+
+start_pre() {
+ if [ "${RC_CMD}" != "restart" ] ; then
+ checkconfig || return $?
fi
# check for leftover lockfile
if [ -f "${CONNTRACKD_LOCK}" ]; then
@@ -85,16 +88,8 @@ checkconfig() {
fi
}
-start() {
- checkconfig || return 1
- ebegin "Starting conntrackd"
- start-stop-daemon --start --exec "${CONNTRACKD_BIN}" \
- -- -d -C "${CONNTRACKD_CFG}" ${CONNTRACKD_OPTS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping conntrackd"
- start-stop-daemon --stop --exec "${CONNTRACKD_BIN}"
- eend $?
+stop_pre() {
+ if [ "${RC_CMD}" = "restart" ] ; then
+ checkconfig || return $?
+ fi
}
--
2.36.1