Received: from araneo.si (araneo.si [90.157.193.204]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id B5D67780FEE for ; Sat, 18 Jun 2022 06:36:26 +0000 (UTC) Received: from araneo.si (localhost.lan [127.0.0.1]) by araneo.si (OpenSMTPD) with ESMTP id de6fd118 for ; Sat, 18 Jun 2022 06:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=araneo.si; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=20180623; bh=mXB2F+IlBk+a7UlEBE7IrbqaXHY=; b=HUmIN/UkB3/U8yMy pAc80dC+XurhrD3rYflUL7mzUYO/eY3GZrm/FKrJTIjsP41FQ5diMlyKTQN93GJB kNrZy7Mgi+PAh+c/tGxZ5EyzIhopXoWcFFXaPcHDqK+hBbQF0TJ9d+LpXtlAyAKX PAGiePFAa1SM/be56b2hBRAbxVIXNxnZP6JY+3hhM2IBnmVfTpBuezKSoWdZ3+gV sjykY64UbDE/NXfeUusYBrVs4gwFhKSuqJ/AMeDtT8kmsfReJ3oEGUnVfCDyy42R qMcYpNSI9ODur43whyW+SSnsH/r4daTl6suEsO3F5hoAAJX10RnFsdoQx4m5DvzE kxzzlA== Received: by araneo.si (OpenSMTPD) with ESMTPSA id c88c2851 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 18 Jun 2022 06:29:45 +0000 (UTC) From: Timotej Lazar To: alpine-aports@lists.alpinelinux.org Cc: Timotej Lazar Subject: [PATCH] main/conntrack-tools: change init script to declarative style Date: Sat, 18 Jun 2022 08:26:00 +0200 Message-Id: <20220618062559.5027-1-timotej.lazar@araneo.si> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit --- 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 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