Package: runit
Version: 2.1.2-34
Severity: normal
Tags: patch
Hi,
as discussed in #935958 it's inconvenient to print messages like
'starting foo' or 'stopping foo' by default, as they are written to
the service log.
The attached patch does the following:
* add support for a VERBOSE option to invoke run: the
value is sourced from /etc/default/runit file
(off by default) and can be overridden for each service
placing a file in /etc/sv/<service>/conf/
* export the NAME variable in invoke-run
* add a system-wide file to be sourced for runit services
the verbose option should be tested in runscripts like
if [ "$VERBOSE" = 1 ]; then
echo "runsv: starting $NAME..."
fi
I'm not sure using /etc/default path (rather than /etc/runit) is
appropriate; file there are usually meant for daemons but there are
exceptions (I have a Grub directory there).
Lorenzo
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.20.3-van (SMP w/4 CPU cores; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)
Versions of packages runit depends on:
ii libc6 2.28-10
ii sysuser-helper 1.3.3
Versions of packages runit recommends:
ii runit-init 2.1.2-34
runit suggests no packages.
-- Configuration Files:
/etc/runit/3 changed [not included]
-- no debconf information
-- debsums errors found:
debsums: changed file /lib/runit/invoke-run (from runit package)
>From 354706b5eac44d35814eb584c1b0272995f441ff Mon Sep 17 00:00:00 2001
From: Lorenzo Puliti <[email protected]>
Date: Tue, 10 Sep 2019 16:31:53 +0200
Subject: [PATCH] invoke-run: add verbose option and export NAME
Export `NAME` variable and add a `VERBOSE` option into
invoke-run interpreter.
Also add a runit default file for system wide setting about
runit services.
---
debian/contrib/lib/invoke-run | 8 ++++++++
debian/runit.default | 4 ++++
2 files changed, 12 insertions(+)
create mode 100644 debian/runit.default
diff --git a/debian/contrib/lib/invoke-run b/debian/contrib/lib/invoke-run
index b3b0c55..b0f6ef6 100755
--- a/debian/contrib/lib/invoke-run
+++ b/debian/contrib/lib/invoke-run
@@ -31,6 +31,8 @@ case "${runscript}" in
esac
readonly runscript service
+export NAME=$service
+
if [ -f "/etc/sv/${service}/.meta/installed" ] ; then
readonly installed="/usr/share/runit/meta/${service}/installed"
# uninstalled, but not purged. See #929693 and commit [4c485b]
@@ -49,6 +51,12 @@ if [ -r "/etc/default/${service}" ] ; then
set +a -u
fi
+if [ -r /etc/default/runit ]; then
+ set -a
+ . /etc/default/runit
+ set +a
+fi
+
readonly initscript="/etc/init.d/${service}"
readonly noreplace="/usr/share/runit/meta/${service}/noreplace"
diff --git a/debian/runit.default b/debian/runit.default
new file mode 100644
index 0000000..26d057e
--- /dev/null
+++ b/debian/runit.default
@@ -0,0 +1,4 @@
+# system wide setting for runit services
+
+# print runsv messages about starting and stopping the service
+VERBOSE=0
--
2.23.0