From d5591e6ccfb2aeef77b6dcface5ae9775b7c49e5 Mon Sep 17 00:00:00 2001
From: Sertonix <sertonix@posteo.net>
Date: Wed, 9 Oct 2024 14:59:44 +0200
Subject: [PATCH] samples: modernize and improve

---
 sample.APKBUILD | 14 +++++---------
 sample.confd    |  2 +-
 sample.initd    |  4 ++--
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/sample.APKBUILD b/sample.APKBUILD
index de6485d9..5341fb43 100644
--- a/sample.APKBUILD
+++ b/sample.APKBUILD
@@ -1,7 +1,5 @@
 # This is an example APKBUILD file. Use this as a start to creating your own,
 # and remove these comments.
-# NOTE: Please fill out the license field for your package! If it is unknown,
-# then please put 'unknown'.
 
 # Contributor: Your Name <youremail@domain.com>
 maintainer="Your Name <youremail@domain.com>"
@@ -11,22 +9,22 @@ pkgrel=0
 pkgdesc=""
 url=""
 arch="all"
-license="GPL"
+license="unknown"
 depends=
 depends_dev=
 makedepends="$depends_dev"
 install=
 subpackages="$pkgname-dev $pkgname-doc"
-source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz"
+source="https://downloads.sourceforge.net/NAME/NAME-$pkgver.tar.gz"
 
 builddir="$srcdir"/$pkgname-$pkgver
 
 prepare() {
-	cd "$builddir"
+	default_prepare
+	# When needed add additional preparation below. Otherwise remove this function
 }
 
 build() {
-	cd "$builddir"
 	./configure --prefix=/usr \
 		--sysconfdir=/etc \
 		--mandir=/usr/share/man \
@@ -35,7 +33,6 @@ build() {
 }
 
 package() {
-	cd "$builddir"
 	make DESTDIR="$pkgdir" install
 
 	# remove the 2 lines below (and this) if there is no init.d script
@@ -44,9 +41,8 @@ package() {
 }
 
 check() {
-	# uncomment the 2 lines below if there is a testsuite.  we assume the testsuite
+	# uncomment the line below if there is a testsuite.  we assume the testsuite
 	# is run using "make check", which is the default for autotools-based build systems.
-	# cd "$builddir"
 	# make check
 }
 
diff --git a/sample.confd b/sample.confd
index 72626952..4f55bcbe 100644
--- a/sample.confd
+++ b/sample.confd
@@ -1,7 +1,7 @@
 # Configuration for /etc/init.d/<SERVICE>
 
 # User (and group) to run <SERVICE> as.
-#command_user="<USER>"
+#command_user="<USER>[:<GROUP>]"
 
 # Additional arguments for <SERVICE> daemon.
 #command_args=
diff --git a/sample.initd b/sample.initd
index 1fcf9b3b..5cdb12ee 100644
--- a/sample.initd
+++ b/sample.initd
@@ -3,10 +3,10 @@
 name="SampleService"
 description="Sample init.d file for Alpine Linux"
 
-: ${command_user:="<USER>"}
+: "${command_user:="<USER>"}"
 
 command="/usr/sbin/<SERVICE>"
-command_args="$command_args"
+: "${command_args:="--default-args"}"
 command_background="yes"
 pidfile="/run/$RC_SVCNAME.pid"
 
-- 
GitLab