Subject: [alpine-aports] [PATCH] testing/squeezelite: new aport

From: Carl Chave <[email-masked]>
Date: Sun, 17 Mar 2019 00:57:21 -0400

From: Carl Chave <[email-masked]>
Date: Sat, 16 Mar 2019 23:37:41 -0500
Subject: [PATCH] testing/squeezelite: new aport

https://github.com/ralph-irving/squeezelite
Lightweight headless squeezebox player for Logitech Media Server
---
 testing/squeezelite/APKBUILD                 | 37 ++++++++++++++++++++
 testing/squeezelite/squeezelite.confd        | 31 ++++++++++++++++
 testing/squeezelite/squeezelite.initd        | 31 ++++++++++++++++
 testing/squeezelite/squeezelite.post-install | 12 +++++++
 testing/squeezelite/squeezelite.pre-install  |  5 +++
 5 files changed, 116 insertions(+)
 create mode 100644 testing/squeezelite/APKBUILD
 create mode 100644 testing/squeezelite/squeezelite.confd
 create mode 100644 testing/squeezelite/squeezelite.initd
 create mode 100644 testing/squeezelite/squeezelite.post-install
 create mode 100644 testing/squeezelite/squeezelite.pre-install

diff --git a/testing/squeezelite/APKBUILD b/testing/squeezelite/APKBUILD
new file mode 100644
index 0000000000..e701db7868
--- /dev/null
+++ b/testing/squeezelite/APKBUILD
@@ -0,0 +1,37 @@
+# Contributor: Carl Chave <[email-masked]>
+# Maintainer:
+pkgname=squeezelite
+pkgver=1.9.1.1130
+pkgrel=0
+pkgdesc="Lightweight headless squeezebox player for Logitech Media Server"
+url="https://github.com/ralph-irving/squeezelite"
+arch="all"
+license="GPL-3.0-or-later3"
+options="!check" # No test suite
+depends="flac alsa-lib faad2 mpg123 libvorbis libmad"
+makedepends="flac-dev alsa-lib-dev faad2-dev mpg123-dev libvorbis-dev
libmad-dev"
+install="$pkgname.pre-install $pkgname.post-install"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="$pkgname-$pkgver.zip::
https://github.com/ralph-irving/squeezelite/archive/master.zip
$pkgname.confd $pkgname.initd"
+builddir="$srcdir/$pkgname-master"
+
+build() {
+    cd "$builddir"
+    make
+}
+
+package() {
+    cd "$builddir"
+    install -Dm 755 squeezelite \
+        "$pkgdir"/usr/bin/squeezelite
+    install -Dm 644 doc/squeezelite.1 \
+        "$pkgdir"/usr/share/man/man1/squeezelite.1
+    install -Dm 644 "$srcdir"/squeezelite.confd \
+        "$pkgdir"/etc/conf.d/squeezelite
+    install -Dm 755 "$srcdir"/squeezelite.initd \
+        "$pkgdir"/etc/init.d/squeezelite
+}
+
+sha512sums="d1c8c8830b60703b7dab47acd08b03d07fb6796f85605d44a635fe0cfe2da1c55d3ada76fe594881495e0790ce7a8b388f2f90657d26edbe47f45f3e2034fc6f
squeezelite-1.9.1.1130.zip
+ff552fcbbbf2b2291958fa1c61057f54ba0d9b19620666036dd1e19897b5d7bcc543c40699c3ee53b2eec7a38b9cf46cb9205c2048f7d5488c23085d9904f114
squeezelite.confd
+38f69c55cda7f58e66cf913718ab245a9f08545e223d6d5b3f6ebd6185df0a35338dc7607b6318fa85787c8b7a606500f79e755a624e2be95138a79d4878f3e4
squeezelite.initd"
diff --git a/testing/squeezelite/squeezelite.confd
b/testing/squeezelite/squeezelite.confd
new file mode 100644
index 0000000000..86235b41dc
--- /dev/null
+++ b/testing/squeezelite/squeezelite.confd
@@ -0,0 +1,31 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Configuration for /etc/init.d/squeezelite
+
+# IP address of Logitech Media Server; leave this blank to try to
+# locate the server via auto-discovery.
+# If you fill this in then include "-s" before the IP address, eg:
+#  SL_SERVER_IP="-s 1.2.3.4"
+SL_SERVERIP=""
+
+# User that Squeezelite should run as. The dedicated 'squeezelite'
+# user is preferred to avoid running with high privilege. This user
+# should be a member of the 'audio' group to allow access to the audio
+# hardware. Running as the 'root' user allows the sound output thread
+# to run at a very high priority -- this can help avoid gaps in
+# playback, but could be a potential security problem if there are
+# exploitable vulnerabilities in Squeezelite.
+SL_USER=squeezelite
+
+# Any other switches to pass to Squeezelite. See 'squeezelite -h' for
+# a description of all possible switches.
+
+# Example setting:
+#  1. the ALSA output device
+#  2. the player name
+#  3. turning on visualiser support (-v)
+#
+# SL_OPTS="-o sysdefault -n $HOSTNAME -v"
+#
+SL_OPTS=""
diff --git a/testing/squeezelite/squeezelite.initd
b/testing/squeezelite/squeezelite.initd
new file mode 100644
index 0000000000..e9bb6b0722
--- /dev/null
+++ b/testing/squeezelite/squeezelite.initd
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+    need net
+    use alsasound
+    after bootmisc
+}
+
+start() {
+    ebegin "Starting squeezelite"
+    start-stop-daemon \
+    --start \
+    --exec /usr/bin/squeezelite \
+    --pidfile /run/squeezelite.pid \
+    --make-pidfile \
+    --user ${SL_USER} \
+    --background \
+    -- ${SL_OPTS} ${SL_SERVERIP}
+    eend $?
+}
+
+stop() {
+    ebegin "Stopping squeezelite"
+    start-stop-daemon \
+    --stop \
+    --exec /usr/bin/squeezelite \
+    --pidfile /run/squeezelite.pid
+  eend $?
+}
diff --git a/testing/squeezelite/squeezelite.post-install
b/testing/squeezelite/squeezelite.post-install
new file mode 100644
index 0000000000..120c10e7b7
--- /dev/null
+++ b/testing/squeezelite/squeezelite.post-install
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cat >&2 <<EOF
+*
+* If you want start Squeezelite automatically on system boot:
+* rc-update add squeezelite default
+* Edit /etc/cond.d/squeezelite to customize -- in particular
+* you may want to set the audio device to be used.
+*
+EOF
+
+exit 0
diff --git a/testing/squeezelite/squeezelite.pre-install
b/testing/squeezelite/squeezelite.pre-install
new file mode 100644
index 0000000000..19da2ab1d3
--- /dev/null
+++ b/testing/squeezelite/squeezelite.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+adduser -S -D -H -h /dev/null -s /sbin/nologin -G audio -g squeezelite
squeezelite 2>/dev/null
+
+exit 0
-- 
2.20.1