Subject: [PATCH] testing/navidrome: new aport

From: Tom Lebreux <[email-masked]>
Date: Sat, 24 Apr 2021 09:24:08 -0400

https://github.com/navidrome/navidrome
Modern Music Server and Streamer compatible with Subsonic/Airsonic
---
 testing/navidrome/APKBUILD              |  64 +++++++++++++++
 testing/navidrome/navidrome.confd       |   4 +
 testing/navidrome/navidrome.initd       |  20 +++++
 testing/navidrome/navidrome.pre-install |   6 ++
 testing/navidrome/navidrome.toml        | 102 ++++++++++++++++++++++++
 5 files changed, 196 insertions(+)
 create mode 100644 testing/navidrome/APKBUILD
 create mode 100644 testing/navidrome/navidrome.confd
 create mode 100644 testing/navidrome/navidrome.initd
 create mode 100644 testing/navidrome/navidrome.pre-install
 create mode 100644 testing/navidrome/navidrome.toml

diff --git a/testing/navidrome/APKBUILD b/testing/navidrome/APKBUILD
new file mode 100644
index 000000000000..ee85439e68c8
--- /dev/null
+++ b/testing/navidrome/APKBUILD
@@ -0,0 +1,64 @@
+# Contributor: Tom Lebreux <[email-masked]>
+# Maintainer: Tom Lebreux <[email-masked]>
+pkgname=navidrome
+pkgver=0.41.1
+_gitsha="43bb075"
+pkgrel=0
+pkgdesc="Modern Music Server and Streamer compatible with Subsonic/Airsonic"
+url="https://github.com/navidrome/navidrome"
+arch="all !mips64 !mips64el"
+license="GPL-3.0-or-later"
+depends="ffmpeg"
+makedepends="go nodejs npm taglib-dev zlib-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-openrc"
+pkgusers="navidrome"
+pkggroups="navidrome"
+source="
+	$pkgname-$pkgver.tar.gz::https://github.com/navidrome/navidrome/archive/refs/tags/v$pkgver.tar.gz
+	navidrome.confd
+	navidrome.initd
+	navidrome.toml
+	"
+
+build() {
+	make setup
+	# Prevents crash due to allocation failure
+	echo 'node-options=--max_old_space_size=3072' > ./ui/.npmrc
+	cd ./ui/
+	npm run build
+	cd ..
+
+	CGO_ENABLED=1 go build \
+		-trimpath \
+		-ldflags="
+			-X github.com/navidrome/navidrome/consts.gitSha=$_gitsha
+			-X github.com/navidrome/navidrome/consts.gitTag=v$pkgver" \
+		-tags=embed,netgo
+}
+
+check() {
+	make testall
+}
+
+package() {
+	install -Dm755 navidrome "$pkgdir"/usr/bin/navidrome
+
+	install -Dm644 "$srcdir"/navidrome.toml \
+		"$pkgdir"/etc/navidrome/navidrome.toml
+
+	install -Dm755 "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname
+	install -Dm755 "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+
+	install -dm755 -o navidrome -g navidrome \
+		"$pkgdir/var/log/navidrome" \
+		"$pkgdir/var/lib/navidrome/data" \
+		"$pkgdir/var/lib/navidrome/music"
+}
+
+sha512sums="179b9af6c3925844330231f7a9d28e511e62e84475af76f92985373011fab04e525f9e0b3da88894d0f13a03f88fb83e8da67481ff4d370d9d433e3b6fcbb16f  navidrome-0.41.1.tar.gz
+c25d08fbe561922344836ca4a345163b7de377fd7f699aeca7a36fd2ec8a16e185c697971d552d02f56f03c9515a4f3d5a516103d1662a157411a41fe956780d  navidrome.confd
+1e948cf8bca61e4d1dd46bed28cdaaa1e4450c7aa1bb05391b1647e4aca3327dc3ed23271811b70a8dbf06b4c42427b0153608cd2a4976f30fd1b93b1780456f  navidrome.initd
+e3f3e8f56e10dc56a7995a7d1542713730202e68ba065b1024802cccfef36d330be4ab8a779c3f57987652f9b8cff8a1e88a04d91af278f1dfbed5d4a120ddb6  navidrome.toml"
diff --git a/testing/navidrome/navidrome.confd b/testing/navidrome/navidrome.confd
new file mode 100644
index 000000000000..519d87004828
--- /dev/null
+++ b/testing/navidrome/navidrome.confd
@@ -0,0 +1,4 @@
+navidrome_configfile=/etc/navidrome/navidrome.toml
+
+output_log=/var/log/navidrome/navidrome.log
+error_log=/var/log/navidrome/navidrome.log
diff --git a/testing/navidrome/navidrome.initd b/testing/navidrome/navidrome.initd
new file mode 100644
index 000000000000..a4aa2c33b331
--- /dev/null
+++ b/testing/navidrome/navidrome.initd
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name=navidrome
+description="Modern Music Server and Streamer compatible with Subsonic/Airsonic"
+
+command=/usr/bin/navidrome
+command_args="--nobanner --configfile $navidrome_configfile"
+command_user="navidrome:navidrome"
+
+start_pre() {
+	[ -n "$output_log" ] && checkpath -f "$output_log" \
+		-m 644 -o navidrome:navidrome
+	[ -n "$error_log" ] && checkpath -f "$error_log" \
+		-m 644 -o navidrome:navidrome
+}
+
+depend() {
+	need net
+}
diff --git a/testing/navidrome/navidrome.pre-install b/testing/navidrome/navidrome.pre-install
new file mode 100644
index 000000000000..7b34ac489c85
--- /dev/null
+++ b/testing/navidrome/navidrome.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S navidrome 2>/dev/null
+adduser -H -S -D -s /sbin/nologin -G navidrome -g navidrome navidrome 2>/dev/null
+
+exit 0
diff --git a/testing/navidrome/navidrome.toml b/testing/navidrome/navidrome.toml
new file mode 100644
index 000000000000..b24349904463
--- /dev/null
+++ b/testing/navidrome/navidrome.toml
@@ -0,0 +1,102 @@
+# Folder where your music library is stored. Can be read-only.
+MusicFolder  = "/var/lib/navidrome/music"
+
+# Folder to store application data (DB, cache…)
+DataFolder  = "/var/lib/navidrome/data"
+
+# How frequently to scan for changes in your music library. Set it to 0 to
+# disable scans.
+# ScanInterval  = "1m"
+
+# Log level. Useful for troubleshooting. Possible values: error, info, debug,
+# trace.
+LogLevel  = "error"
+
+# HTTP port Navidrome will use.
+# Port  = 4533
+
+# IP address the server will bind to.
+# Address  = "0.0.0.0"
+
+# Enables transcoding configuration in the UI.
+# EnableTranscodingConfig  = false
+
+# Size of transcoding cache. Set to 0 to disable cache.
+# TranscodingCacheSize  = "100MB"
+
+# Size of image (art work) cache. Set to 0 to disable cache.
+# ImageCacheSize  = "100MB"
+
+# Enable/disable .m3u playlist auto-import.
+# AutoImportPlaylists  = true
+
+# Base URL (only the path part) to configure Navidrome behind a proxy
+# (ex: /music)
+# BaseUrl  = ""
+
+# Change background image used in the Login page.
+# UILoginBackgroundUrl  = "https://source.unsplash.com/random/1600x900?music"
+
+# Add a welcome message to the login screen.
+# UIWelcomeMessage  = ""
+
+# Send basic info to your own Google Analytics account. Must be in the format
+# UA-XXXXXXXX. Empty means disabled.
+# GATrackingID  = ""
+
+# List of ignored articles when sorting/indexing artists.
+# IgnoredArticles  = "The El La Los Las Le Les Os As O A"
+
+# Match query strings anywhere in searchable fields, not only in word
+# boundaries. Useful for languages where words are not space separated.
+# SearchFullString  = false
+
+# Uses music files’ modification time when sorting by “Recently Added”.
+# Otherwise use import time.
+# RecentlyAddedByModTime  = false
+
+# Configure the order to look for cover art images. Use special embedded value
+# to get embedded images from the audio files.
+# CoverArtPriority  = "embedded, cover.*, folder.*, front.*"
+
+# Set JPEG quality percentage for resized cover art images.
+# CoverJpegQuality  = 75
+
+# Enable the option in the UI to download music/albums/artists/playlists from
+# the server.
+# EnableDownloads  = true
+
+# How long Navidrome will wait before closing web ui idle sessions.
+# SessionTimeout  = "24h"
+
+# How many login requests can be processed from a single IP during the
+# AuthWindowLength. Set to 0 to disable the limit rater.
+# AuthRequestLimit  = 5
+
+# Window Length for the authentication rate limit.
+# AuthWindowLength  = "20s"
+
+# Select metadata extractor implementation. Options: taglib or ffmpeg.
+# Scanner.Extractor  = "taglib"
+
+# Use Gravatar images as the user profile image. Needs the user’s email to be filled
+# EnableGravatar  = false
+
+
+# [LastFM]
+# Last.FM ApiKey
+# ApiKey  = ""
+
+# Last.FM Shared Secret
+# Secret  = ""
+
+# Two letter-code for language to be used to retrieve biographies from Last.FM
+# Language  = "en"
+
+
+# [Spotify]
+# Spotify Client ID
+# ID  = ""
+
+# Spotify Client Secret
+# Secret  = ""
-- 
2.30.2