diff options
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | PKGBUILD | 35 | ||||
-rw-r--r-- | subsonic.install | 70 | ||||
-rw-r--r-- | subsonic.service | 12 |
4 files changed, 137 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..cfac9d61062d --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +pkgbase = subsonic + pkgdesc = A free, web-based media streamer and jukebox. + pkgver = 5.2.1 + pkgrel = 1 + url = http://subsonic.org/ + install = subsonic.install + arch = any + license = GPL + depends = java-runtime-headless + conflicts = subsonic + backup = var/lib/subsonic/db + backup = var/lib/subsonic/subsonic.properties + backup = var/lib/subsonic/subsonic.sh + source = http://prdownloads.sourceforge.net/subsonic/subsonic-5.2.1-standalone.tar.gz + source = subsonic.service + md5sums = c790783b6710923ce4f63e9e657fb90e + md5sums = 7cbbb9c8357992385c929e9f05be00be + +pkgname = subsonic + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..40585802514b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,35 @@ +# Maintainer: M0Rf30 +# Contributors: Thom Wiggers <thom@thomwiggers.nl> +# Contributors: hoban +# Contributors: Nrm + +pkgname=subsonic +pkgver=5.2.1 +pkgrel=1 +pkgdesc="A free, web-based media streamer and jukebox." +arch=('any') +url="http://subsonic.org/" +license=('GPL') +depends=('java-runtime-headless') +conflicts=('subsonic') +source=(http://prdownloads.sourceforge.net/subsonic/subsonic-${pkgver}-standalone.tar.gz + 'subsonic.service') +backup=('var/lib/subsonic/db' 'var/lib/subsonic/subsonic.properties' 'var/lib/subsonic/subsonic.sh') +install=$pkgname.install + +package() { + cd ${srcdir} + mkdir -p $pkgdir/var/lib/subsonic + mkdir -p $pkgdir/var/playlists + mkdir -p $pkgdir/usr/lib/systemd/system + mkdir -p $pkgdir/etc/ + sed -i 's/SUBSONIC_HOME=\/var\/subsonic/SUBSONIC_HOME=\/var\/lib\/subsonic/' subsonic.sh + cp * $pkgdir/var/lib/subsonic + rm $pkgdir/var/lib/subsonic/{subsonic.bat,subsonic-${pkgver}-standalone.tar.gz} + ln -fs /var/lib/subsonic/subsonic.sh $pkgdir/etc/subsonic.conf + cp $srcdir/subsonic.service $pkgdir/usr/lib/systemd/system + chmod +x $pkgdir/var/lib/subsonic/subsonic.sh +} + +md5sums=('c790783b6710923ce4f63e9e657fb90e' + '7cbbb9c8357992385c929e9f05be00be') diff --git a/subsonic.install b/subsonic.install new file mode 100644 index 000000000000..fc55fa960de9 --- /dev/null +++ b/subsonic.install @@ -0,0 +1,70 @@ +_homedir=/var/lib/subsonic +_playlistdir=/var/playlists + +post_install() { + + getent group subsonic &>/dev/null || groupadd --system subsonic > /dev/null + getent passwd subsonic &>/dev/null || useradd --system \ + --home-dir /var/lib/subsonic \ + --shell /usr/bin/nologin \ + --gid subsonic \ + --groups audio \ + --comment "Subsonic user" \ + subsonic > /dev/null + passwd --lock subsonic > /dev/null + + fix_permissions + echo "*************************************************" + echo "* Edit /etc/subsonic.conf to configure subsonic *" + echo "*************************************************" + + systemctl daemon-reload +} + +pre_remove() { + if [[ `systemctl is-active subsonic` == 'active' ]]; then + systemctl stop subsonic + fi +} + +post_remove() { + getent passwd subsonic &>/dev/null && userdel subsonic >/dev/null + getent group subsonic &>/dev/null && groupdel subsonic >/dev/null +} + +fix_permissions() { + chown -R subsonic:subsonic ${_homedir} + chown subsonic:subsonic ${_playlistdir} +} + +pre_upgrade() { + rm -f /tmp/subsonic-was-active + if [[ `systemctl is-active subsonic` == 'active' ]]; then + touch /tmp/subsonic-was-active + echo "Stopping subsonic" + systemctl stop subsonic + fi +} + +post_upgrade() { + post_install + + if [[ $(vercmp 5.0.beta1 $2) == "1" ]]; then + echo "!! Subsonics home dir is now located in /var/lib/subsonic." + echo " You will have to move the database located in " + echo " /var/subsonic/db to this new location." + echo "" + echo "!! This package now runs subsonic as the user 'subsonic'." + echo " You mightneed to edit permissions for your media folders." + rm -f /tmp/subsonic-was-active + echo "" + echo "!! Not restarting subsonic automatically." + echo " You might need to change configs" + fi + + if [ -e /tmp/subsonic-was-active ]; then + echo "Starting subsonic" + systemctl start subsonic + rm /tmp/subsonic-was-active + fi +} diff --git a/subsonic.service b/subsonic.service new file mode 100644 index 000000000000..78889b6a6ea9 --- /dev/null +++ b/subsonic.service @@ -0,0 +1,12 @@ +[Unit] +Description=Subsonic +After=network.target + +[Service] +User=subsonic +ExecStart=/var/lib/subsonic/subsonic.sh +ExecStop=/bin/kill -15 $MAINPID +Type=forking + +[Install] +WantedBy=multi-user.target |