aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2017-04-18 02:13:10 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2017-04-18 02:13:15 +0200
commit4e9f6739c943fe37767d9cc23fed86c7c97bd527 (patch)
treed8694a46a9a2cda071476b226bf1f315d464172d /testing
parentcbac058105bd4853233f5ee58dab7704b967db19 (diff)
downloadaports-4e9f6739c943fe37767d9cc23fed86c7c97bd527.tar.bz2
aports-4e9f6739c943fe37767d9cc23fed86c7c97bd527.tar.xz
testing/snapcast: improve init scripts and user/group
Diffstat (limited to 'testing')
-rw-r--r--testing/snapcast/APKBUILD22
-rw-r--r--testing/snapcast/snapcast-client.confd4
-rw-r--r--testing/snapcast/snapcast-client.initd18
-rw-r--r--testing/snapcast/snapcast-server.confd24
-rw-r--r--testing/snapcast/snapcast-server.initd14
-rw-r--r--testing/snapcast/snapcast.pre-install6
6 files changed, 54 insertions, 34 deletions
diff --git a/testing/snapcast/APKBUILD b/testing/snapcast/APKBUILD
index 2ab9d89548..8b16f54f44 100644
--- a/testing/snapcast/APKBUILD
+++ b/testing/snapcast/APKBUILD
@@ -5,7 +5,7 @@ pkgver=0.11.1
### NOTE: when bumping pkgver also update sha's below from gitsubmodules
_jsonrpcpp_sha=115296b2232ba8776467d74602d392d03409ad7e
_popl_sha=0dc38f8bc30bec1946f7e3dbc5a2d37ad1edb93e
-pkgrel=2
+pkgrel=3
pkgdesc="Synchronous multi-room audio player"
url="https://github.com/badaix/snapcast"
arch="all"
@@ -14,11 +14,17 @@ depends="$pkgname-client $pkgname-server"
makedepends="asio-dev bash avahi-dev flac-dev
libvorbis-dev alsa-lib-dev
"
+pkgusers="$pkgname"
+pkggroups="$pkgname audio"
install="$pkgname-client.pre-install $pkgname-server.pre-install"
subpackages="$pkgname-doc $pkgname-client $pkgname-server"
source="snapcast-$pkgver.tar.gz::https://github.com/badaix/snapcast/archive/v$pkgver.tar.gz
jsonrpcpp-$_jsonrpcpp_sha.tar.gz::https://github.com/badaix/jsonrpcpp/archive/$_jsonrpcpp_sha.tar.gz
https://raw.githubusercontent.com/badaix/popl/$_popl_sha/include/popl.hpp
+ $pkgname-client.initd
+ $pkgname-client.confd
+ $pkgname-server.initd
+ $pkgname-server.confd
"
builddir="$srcdir/snapcast-$pkgver"
@@ -43,16 +49,16 @@ package() {
client() {
depends=
- mkdir -p "$subpkgdir"/usr/bin
install -Dm755 "$pkgdir"/usr/bin/snapclient "$subpkgdir"/usr/bin/snapclient
+ install -Dm755 "$srcdir"/"$subpkgname.initd" "$subpkgdir"/etc/init.d/"$subpkgname"
+ install -Dm644 "$srcdir"/"$subpkgname.confd" "$subpkgdir"/etc/conf.d/"$subpkgname"
}
server() {
depends=
- mkdir -p "$subpkgdir"/usr/bin
install -Dm755 "$pkgdir"/usr/bin/snapserver "$subpkgdir"/usr/bin/snapserver
- install -Dm755 "$subpkgname.initd" "$subpkgdir"/etc/init.d/"$subpkgname"
- install -Dm644 "$subpkgname.confd" "$subpkgdir"/etc/conf.d/"$subpkgname"
+ install -Dm755 "$srcdir"/"$subpkgname.initd" "$subpkgdir"/etc/init.d/"$subpkgname"
+ install -Dm644 "$srcdir"/"$subpkgname.confd" "$subpkgdir"/etc/conf.d/"$subpkgname"
}
check() {
@@ -63,4 +69,8 @@ check() {
sha512sums="100eb239505d6f2d39a5efd470ff1802aa9fecabb709ff5dec284cefe6b6f0ef0432508cc24e8e29ed9ec378f5aae6a30c9fd7599ded106232e3b1a5ec9307be snapcast-0.11.1.tar.gz
2737653a2e06a20e419580669f53b9760fd0997593f0bb6f053c55d12e35564e3ecdf9bfff71397eb252468e4174f3eefbcd1543a28c46bfc0055bda0843ebe8 jsonrpcpp-115296b2232ba8776467d74602d392d03409ad7e.tar.gz
-d0cde4748036dec2457343b36e6c6aa47557f649503aa10b648a105b062144f5625f74597ff79da6125aa5fe4477357d664473593819116cf401b68cbff4641a popl.hpp"
+d0cde4748036dec2457343b36e6c6aa47557f649503aa10b648a105b062144f5625f74597ff79da6125aa5fe4477357d664473593819116cf401b68cbff4641a popl.hpp
+d1c4d8693b708981703b13c496226c12800d3808b9362959839c85732b56171708d75dac708acf98548f110d22dcd3c1a046dbf39a5f6454bfd8978d7bca354e snapcast-client.initd
+fa353d7974d3a8b3b22ff009b762c7c4ee318f9f83e22762a9ebf550484b9fc3cc4dffd389b6d756630dc035cb86d5c5643541957785f8bbf71fe4915691c337 snapcast-client.confd
+0f6c43e267646ff657bfe184481c7148d3395a6ed2b9c485856b56370dcb5a1d2364f856af683d9af13fc12b8687ba890345673311caabefa09c9471e7b5cf48 snapcast-server.initd
+48d494143d044a413b414b32cd8be51d4242234b6d7cb03102914a42b1ea6b1913c2c31b223c23c6be316918e731875149a2505daa03165659d0a1be3ca7e75c snapcast-server.confd"
diff --git a/testing/snapcast/snapcast-client.confd b/testing/snapcast/snapcast-client.confd
new file mode 100644
index 0000000000..68a3a863bc
--- /dev/null
+++ b/testing/snapcast/snapcast-client.confd
@@ -0,0 +1,4 @@
+# snapclient options
+
+snapclient_opts=""
+
diff --git a/testing/snapcast/snapcast-client.initd b/testing/snapcast/snapcast-client.initd
new file mode 100644
index 0000000000..2783599a4c
--- /dev/null
+++ b/testing/snapcast/snapcast-client.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+name=snapclient
+command="/usr/bin/snapclient"
+command_args="-d $snapclient_opts"
+command_user="snapcast"
+pidfile="/run/snapclient/pid"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath --directory --owner snapcast:audio --mode 0775 \
+ /var/log/snapcast /run/snapclient
+}
+
diff --git a/testing/snapcast/snapcast-server.confd b/testing/snapcast/snapcast-server.confd
index 1543a94305..6d07abb3a4 100644
--- a/testing/snapcast/snapcast-server.confd
+++ b/testing/snapcast/snapcast-server.confd
@@ -1,23 +1,3 @@
-# Allowed options:
-# -h, --help Produce help message
-# -v, --version Show version number
-# -p, --port arg (=1704) Server port
-# --controlPort arg (=1705) Remote control port
-# -s, --stream arg (=pipe:///tmp/snapfifo?name=default)
-# URI of the PCM input stream.
-# Format: TYPE://host/path?name=NAME
-# [&codec=CODEC]
-# [&sampleformat=SAMPLEFORMAT]
-# --sampleformat arg (=48000:16:2) Default sample format
-# -c, --codec arg (=flac) Default transport codec
-# (flac|ogg|pcm)[:options]
-# Type codec:? to get codec specific options
-# --streamBuffer arg (=20) Default stream read buffer [ms]
-# -b, --buffer arg (=1000) Buffer [ms]
-# -d, --daemon [=arg(=0)] Daemonize
-# optional process priority [-20..19]
-# --user arg the user[:group] to run snapserver as when daemonized
+# snapcast options
-USER_OPTS="--user snapcast:snapcast"
-
-SNAPSERVER_OPTS=""
+snapserver_opts=""
diff --git a/testing/snapcast/snapcast-server.initd b/testing/snapcast/snapcast-server.initd
index ab70a84a14..f2b166df4e 100644
--- a/testing/snapcast/snapcast-server.initd
+++ b/testing/snapcast/snapcast-server.initd
@@ -1,12 +1,18 @@
#!/sbin/openrc-run
-name="$RC_SVCNAME"
+name=snapserver
command="/usr/bin/snapserver"
-command_args="${USER_OPTS:---user snapcast:snapcast} $SNAPSERVER_OPTS"
-command_background=yes
-pidfile="/run/$RC_SVCNAME.pid"
+command_args="-d $snapserver_opts"
+command_user="snapcast"
+start_stop_daemon_args="--quiet"
depend() {
need net
after firewall
}
+
+start_pre() {
+ checkpath --directory --owner snapcast:audio --mode 0775 \
+ /var/log/snapcast /run/snapserver
+}
+
diff --git a/testing/snapcast/snapcast.pre-install b/testing/snapcast/snapcast.pre-install
index 0152f9e7db..93457b10e9 100644
--- a/testing/snapcast/snapcast.pre-install
+++ b/testing/snapcast/snapcast.pre-install
@@ -1,6 +1,8 @@
#!/bin/sh
-addgroup snapcast 2>/dev/null
-adduser -S -D -h /var/lib/snapcast -s /sbin/nologin -G snapcast -g snapcast snapcast 2>/dev/null
+addgroup -S -g 18 audio 2>/dev/null
+addgroup -S snapcast 2>/dev/null
+adduser -S -D -H -h /var/lib/snapcast -s /sbin/nologin -G snapcast -g snapcast snapcast 2>/dev/null
+addgroup snapcast audio 2>/dev/null
exit 0