1
0
mirror of https://github.com/moparisthebest/arch-ppa synced 2024-11-24 17:42:19 -05:00

Add libresonic

This commit is contained in:
Travis Burtrum 2016-12-05 13:42:01 -05:00
parent 624fe6eef6
commit 730e8992e6
5 changed files with 268 additions and 0 deletions

29
src/libresonic/.SRCINFO Normal file
View File

@ -0,0 +1,29 @@
pkgbase = libresonic
pkgdesc = A free, web-based media streamer and jukebox.
pkgver = 6.1
pkgrel = 3
url = https://github.com/Libresonic/libresonic/
install = libresonic.install
arch = any
license = GPL3
depends = java-runtime-headless
conflicts = subsonic
conflicts = subsonic-kang
conflicts = subsonic-kang-git
conflicts = subsonic-beta
noextract = libresonic-v6.1.war
noextract = libresonic-booter-jar-with-dependencies.jar
backup = var/lib/libresonic/db
backup = var/lib/libresonic/libresonic.properties
backup = var/lib/libresonic/libresonic.sh
source = https://jenkins.undocumented.software/job/libresonic/233/artifact/libresonic-booter/target/libresonic-booter-jar-with-dependencies.jar
source = https://github.com/Libresonic/libresonic/releases/download/v6.1/libresonic-v6.1.war
source = libresonic.sh
source = libresonic.service
sha256sums = 042ab6833a8fa351712ff34899d6c0ba0024e420f16f81661a17405df081f246
sha256sums = 34e4771f730f6de17aa2ba039cfab26772af3ab08e3f0c36d3f0c7a6e315a8e0
sha256sums = f1f4a22efb411d1f31f834f9f229e81c39d7f4db720281d9b0862c2f1b4d0697
sha256sums = afcef7b8ce8ceab58569440ed17d5828f39da072ea0d6e3e9fb82ac2feafcf9f
pkgname = libresonic

37
src/libresonic/PKGBUILD Normal file
View File

@ -0,0 +1,37 @@
# Maintainer: Federico Giuliani <federico.giuliani86@gmail.com>
pkgname=libresonic
pkgver=6.1
pkgrel=3
pkgdesc="A free, web-based media streamer and jukebox."
arch=('any')
url="https://github.com/Libresonic/libresonic/"
license=('GPL3')
depends=('java-runtime-headless')
conflicts=('subsonic' 'subsonic-kang' 'subsonic-kang-git' 'subsonic-beta')
backup=('var/lib/libresonic/db' 'var/lib/libresonic/libresonic.properties' 'var/lib/libresonic/libresonic.sh')
noextract=(libresonic-v${pkgver}.war libresonic-booter-jar-with-dependencies.jar)
install=$pkgname.install
source=(https://jenkins.undocumented.software/job/libresonic/233/artifact/libresonic-booter/target/libresonic-booter-jar-with-dependencies.jar
https://github.com/Libresonic/libresonic/releases/download/v${pkgver}/libresonic-v${pkgver}.war
'libresonic.sh'
'libresonic.service')
package() {
cd ${srcdir}
mkdir -p $pkgdir/var/lib/libresonic
mkdir -p $pkgdir/var/playlists
mkdir -p $pkgdir/usr/lib/systemd/system
mkdir -p $pkgdir/etc/
sed -i 's/LIBRESONIC_HOME=\/var\/libresonic/LIBRESONIC_HOME=\/var\/lib\/libresonic/' libresonic.sh
mv libresonic-v${pkgver}.war libresonic.war
cp * $pkgdir/var/lib/libresonic
ln -fs /var/lib/libresonic/libresonic.sh $pkgdir/etc/libresonic.conf
cp $srcdir/libresonic.service $pkgdir/usr/lib/systemd/system
chmod +x $pkgdir/var/lib/libresonic/libresonic.sh
}
sha256sums=('042ab6833a8fa351712ff34899d6c0ba0024e420f16f81661a17405df081f246'
'34e4771f730f6de17aa2ba039cfab26772af3ab08e3f0c36d3f0c7a6e315a8e0'
'f1f4a22efb411d1f31f834f9f229e81c39d7f4db720281d9b0862c2f1b4d0697'
'afcef7b8ce8ceab58569440ed17d5828f39da072ea0d6e3e9fb82ac2feafcf9f')

View File

@ -0,0 +1,56 @@
_homedir=/var/lib/libresonic
_playlistdir=/var/playlists
post_install() {
getent group libresonic &>/dev/null || groupadd --system libresonic > /dev/null
getent passwd libresonic &>/dev/null || useradd --system \
--home-dir /var/lib/libresonic \
--shell /usr/bin/nologin \
--gid libresonic \
--groups audio \
--comment "Libresonic user" \
libresonic > /dev/null
passwd --lock libresonic &> /dev/null
fix_permissions
echo "*************************************************"
echo "* Edit /etc/libresonic.conf to configure libresonic *"
echo "*************************************************"
systemctl daemon-reload
}
pre_remove() {
if [[ `systemctl is-active libresonic` == 'active' ]]; then
systemctl stop libresonic
fi
}
post_remove() {
getent passwd libresonic &>/dev/null && userdel libresonic &>/dev/null
getent group libresonic &>/dev/null && groupdel libresonic &>/dev/null
}
fix_permissions() {
chown -R libresonic:libresonic ${_homedir}
chown libresonic:libresonic ${_playlistdir}
}
pre_upgrade() {
rm -f /tmp/libresonic-was-active
if [[ `systemctl is-active libresonic` == 'active' ]]; then
touch /tmp/libresonic-was-active
echo "Stopping libresonic"
systemctl stop libresonic
fi
}
post_upgrade() {
post_install
if [ -e /tmp/libresonic-was-active ]; then
echo "Starting libresonic"
systemctl start libresonic
rm /tmp/libresonic-was-active
fi
}

View File

@ -0,0 +1,12 @@
[Unit]
Description=Libresonic
After=network.target
[Service]
User=libresonic
ExecStart=/var/lib/libresonic/libresonic.sh
ExecStop=/bin/kill -15 $MAINPID
Type=forking
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,134 @@
#!/bin/sh
###################################################################################
# Shell script for starting Libresonic. See http://libresonic.org.
#
# Author: Sindre Mehus
###################################################################################
LIBRESONIC_HOME=/var/libresonic
LIBRESONIC_HOST=0.0.0.0
LIBRESONIC_PORT=4040
LIBRESONIC_HTTPS_PORT=0
LIBRESONIC_CONTEXT_PATH=/
LIBRESONIC_MAX_MEMORY=150
LIBRESONIC_PIDFILE=
LIBRESONIC_DEFAULT_MUSIC_FOLDER=/var/music
LIBRESONIC_DEFAULT_PODCAST_FOLDER=/var/music/Podcast
LIBRESONIC_DEFAULT_PLAYLIST_FOLDER=/var/playlists
quiet=0
usage() {
echo "Usage: libresonic.sh [options]"
echo " --help This small usage guide."
echo " --home=DIR The directory where Libresonic will create files."
echo " Make sure it is writable. Default: /var/libresonic"
echo " --host=HOST The host name or IP address on which to bind Libresonic."
echo " Only relevant if you have multiple network interfaces and want"
echo " to make Libresonic available on only one of them. The default value"
echo " will bind Libresonic to all available network interfaces. Default: 0.0.0.0"
echo " --port=PORT The port on which Libresonic will listen for"
echo " incoming HTTP traffic. Default: 4040"
echo " --https-port=PORT The port on which Libresonic will listen for"
echo " incoming HTTPS traffic. Default: 0 (disabled)"
echo " --context-path=PATH The context path, i.e., the last part of the Libresonic"
echo " URL. Typically '/' or '/libresonic'. Default '/'"
echo " --max-memory=MB The memory limit (max Java heap size) in megabytes."
echo " Default: 100"
echo " --pidfile=PIDFILE Write PID to this file. Default not created."
echo " --quiet Don't print anything to standard out. Default false."
echo " --default-music-folder=DIR Configure Libresonic to use this folder for music. This option "
echo " only has effect the first time Libresonic is started. Default '/var/music'"
echo " --default-podcast-folder=DIR Configure Libresonic to use this folder for Podcasts. This option "
echo " only has effect the first time Libresonic is started. Default '/var/music/Podcast'"
echo " --default-playlist-folder=DIR Configure Libresonic to use this folder for playlists. This option "
echo " only has effect the first time Libresonic is started. Default '/var/playlists'"
exit 1
}
# Parse arguments.
while [ $# -ge 1 ]; do
case $1 in
--help)
usage
;;
--home=?*)
LIBRESONIC_HOME=${1#--home=}
;;
--host=?*)
LIBRESONIC_HOST=${1#--host=}
;;
--port=?*)
LIBRESONIC_PORT=${1#--port=}
;;
--https-port=?*)
LIBRESONIC_HTTPS_PORT=${1#--https-port=}
;;
--context-path=?*)
LIBRESONIC_CONTEXT_PATH=${1#--context-path=}
;;
--max-memory=?*)
LIBRESONIC_MAX_MEMORY=${1#--max-memory=}
;;
--pidfile=?*)
LIBRESONIC_PIDFILE=${1#--pidfile=}
;;
--quiet)
quiet=1
;;
--default-music-folder=?*)
LIBRESONIC_DEFAULT_MUSIC_FOLDER=${1#--default-music-folder=}
;;
--default-podcast-folder=?*)
LIBRESONIC_DEFAULT_PODCAST_FOLDER=${1#--default-podcast-folder=}
;;
--default-playlist-folder=?*)
LIBRESONIC_DEFAULT_PLAYLIST_FOLDER=${1#--default-playlist-folder=}
;;
*)
usage
;;
esac
shift
done
# Use JAVA_HOME if set, otherwise assume java is in the path.
JAVA=java
if [ -e "${JAVA_HOME}" ]
then
JAVA=${JAVA_HOME}/bin/java
fi
# Create Libresonic home directory.
mkdir -p ${LIBRESONIC_HOME}
LOG=${LIBRESONIC_HOME}/libresonic_sh.log
rm -f ${LOG}
cd $(dirname $0)
if [ -L $0 ] && ([ -e /bin/readlink ] || [ -e /usr/bin/readlink ]); then
cd $(dirname $(readlink $0))
fi
${JAVA} -Xmx${LIBRESONIC_MAX_MEMORY}m \
-Dlibresonic.home=${LIBRESONIC_HOME} \
-Dlibresonic.host=${LIBRESONIC_HOST} \
-Dlibresonic.port=${LIBRESONIC_PORT} \
-Dlibresonic.httpsPort=${LIBRESONIC_HTTPS_PORT} \
-Dlibresonic.contextPath=${LIBRESONIC_CONTEXT_PATH} \
-Dlibresonic.defaultMusicFolder=${LIBRESONIC_DEFAULT_MUSIC_FOLDER} \
-Dlibresonic.defaultPodcastFolder=${LIBRESONIC_DEFAULT_PODCAST_FOLDER} \
-Dlibresonic.defaultPlaylistFolder=${LIBRESONIC_DEFAULT_PLAYLIST_FOLDER} \
-Djava.awt.headless=true \
-verbose:gc \
-jar libresonic-booter-jar-with-dependencies.jar > ${LOG} 2>&1 &
# Write pid to pidfile if it is defined.
if [ $LIBRESONIC_PIDFILE ]; then
echo $! > ${LIBRESONIC_PIDFILE}
fi
if [ $quiet = 0 ]; then
echo Started Libresonic [PID $!, ${LOG}]
fi