Bug#1037005: prometheus-smokeping-prober: package is missing an /etc/init.d script

2023-07-15 Thread Daniel Swarbrick

Hello Tim,

Despite SysVinit systems being something of a rarity these days, and 
Debian policy no longer requiring package maintainers to ship init 
scripts, I am willing to entertain your request.


However, may I ask what template you have based your script on? It would 
require adding a runtime dependency on "daemon", which is essentially 
superfluous since start-stop-daemon can achieve the same result, and is 
included in dpkg (i.e., an _essential_ package). I would prefer not to 
bring in any new dependencies, especially considering how few systems 
will actually make use of this script.


Daniel



OpenPGP_signature
Description: OpenPGP digital signature


Bug#1037005: prometheus-smokeping-prober: package is missing an /etc/init.d script

2023-05-31 Thread Tim Wootton
Package: prometheus-smokeping-prober
Version: 0.4.1-2+b5
Severity: normal
Tags: patch
X-Debbugs-Cc: tim_woot...@yahoo.com

Dear Maintainer,

Please include an /etc/init.d script as is provided with other prometheus 
exporters

-- System Information:
Debian Release: 11.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-21-amd64 (SMP w/2 CPU threads)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: OpenRC (via /run/openrc), PID 1: init

Versions of packages prometheus-smokeping-prober depends on:
ii  adduser3.118
ii  debconf [debconf-2.0]  1.5.77
ii  libc6  2.31-13+deb11u6
ii  libcap2-bin1:2.44-1

prometheus-smokeping-prober recommends no packages.

prometheus-smokeping-prober suggests no packages.

-- debconf information:
  prometheus-smokeping-prober/want_cap_net_raw: false




Patch file /etc/init.d/prometheus-smokeping-prober, based on standard template:

#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:  prometheus-smokeping-prober
# Required-Start:$remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: Prometheus style "smokeping" prober 
# Description:   This prober sends a series of ICMP (or UDP) pings to a 
target and records
#the responses in Prometheus histogram metrics. The 
resulting metrics are
#useful for detecting changes in network latency (or round 
trip time), as
#well as packet loss over a network path. 
### END INIT INFO

DESC="Prometheus style smokeping prober"
NAME=prometheus-smokeping-prober
DAEMON=/usr/bin/$NAME
USER=prometheus
PIDFILE=/var/run/prometheus/$NAME.pid
LOGFILE=/var/log/prometheus/$NAME.log

HELPER=/usr/bin/daemon
HELPER_ARGS="--name=$NAME --output=$LOGFILE --pidfile=$PIDFILE --user=$USER"

ARGS=""
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

do_start_prepare()
{
mkdir -p `dirname $PIDFILE`
chown $USER: `dirname $LOGFILE`
chown $USER: `dirname $PIDFILE`
}

do_start_cmd_override()
{
# Return
#   0 if daemon has been started or already running
#   2 if daemon could not be started
$HELPER $HELPER_ARGS --running && return 0
$HELPER $HELPER_ARGS -- $DAEMON $ARGS || return 2
return 0
}

do_stop_cmd_override()
{
# Return
#   0 if daemon has been stopped or already stopped
#   2 if daemon could not be stopped
#   other if a failure occurred
$HELPER $HELPER_ARGS --running || return 0
$HELPER $HELPER_ARGS --stop || return 2
# wait for the process to really terminate
for n in 1 2 3 4 5; do
sleep $n
$HELPER $HELPER_ARGS --running || break
done
$HELPER $HELPER_ARGS --running || return 0
return 2
}