From 8efe527ff3bb029d389196717ec58d2e0a59a014 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Wed, 21 Jun 2023 15:34:27 +0200
Subject: [PATCH] sample.*: improve sample init script

---
 sample.confd | 13 ++++++++-----
 sample.initd | 14 +++++++-------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/sample.confd b/sample.confd
index 486252b0..72626952 100644
--- a/sample.confd
+++ b/sample.confd
@@ -1,7 +1,10 @@
-# Sample conf.d file for alpine linux
+# Configuration for /etc/init.d/<SERVICE>
 
-#
-# Specify daemon options here.
-#
+# User (and group) to run <SERVICE> as.
+#command_user="<USER>"
 
-sample_opts=""
+# Additional arguments for <SERVICE> daemon.
+#command_args=
+
+# Comment out to disable process supervisor.
+supervisor=supervise-daemon
diff --git a/sample.initd b/sample.initd
index 0dc706ce..1fcf9b3b 100644
--- a/sample.initd
+++ b/sample.initd
@@ -1,14 +1,14 @@
 #!/sbin/openrc-run
 
-# Sample init.d file for alpine linux.
+name="SampleService"
+description="Sample init.d file for Alpine Linux"
 
-name=
-command="/usr/sbin/$name"
-command_args="$sample_opts"
-command_background="yes"
+: ${command_user:="<USER>"}
 
-start_stop_daemon_args="--user $sample_user:$sample_group"
-pidfile="/run/$name.pid"
+command="/usr/sbin/<SERVICE>"
+command_args="$command_args"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
 
 depend() {
 	need net
-- 
GitLab