diff --git a/multimedia/serviio/README b/multimedia/serviio/README new file mode 100644 index 0000000000..76a83c25f5 --- /dev/null +++ b/multimedia/serviio/README @@ -0,0 +1,37 @@ +Serviio DNLA Server is a free media server. It allows you to stream +your media files (music, video or images) to renderer devices (e.g. a +TV set, Bluray player, games console or mobile phone) on your connected +home network. + +There is also a paid for Pro edition which further enhances the +possibilities of sharing content in your connected household. If you +don't buy a Pro edition licence, Serviio automatically will turn to +Free version after 14 days. This SlackBuild provides no Pro edition +licence. + +Serviio works with many devices from your connected home (TV, +Playstation 3, XBox 360, smart phones, tablets, etc.). It supports +profiles for particular devices so that it can be tuned to maximise the +device's potential and/or minimize lack of media format playback +support (via transcoding). + +Serviio needs a serviio user and a serviio group with GID=337 and +UID=337 to work properly. Run these commands: + + groupadd -g 337 serviio + useradd -d /opt/serviio -g 337 -u 337 -U serviio + +This SlackBuild also provides a /etc/rc.d/rc.serviio file. If you want +to start Serviio at boot time, add these lines to /etc/rc.d/rc.local: + + # start Serviio DNLA Server: + if [ -x /etc/rc.d/rc.serviio] ; then + /etc/rc.d/rc.serviio start + fi + +Also, add to rc.local_shutdown + + # stop Serviio DNLA Server + if [ -x /etc/rc.d/rc.serviio] ; then + /etc/rc.d/rc.serviio start + fi diff --git a/multimedia/serviio/doinst.sh b/multimedia/serviio/doinst.sh new file mode 100644 index 0000000000..710245989d --- /dev/null +++ b/multimedia/serviio/doinst.sh @@ -0,0 +1,25 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms rc.serviio.new diff --git a/multimedia/serviio/rc.serviio b/multimedia/serviio/rc.serviio new file mode 100644 index 0000000000..f81a3bfd74 --- /dev/null +++ b/multimedia/serviio/rc.serviio @@ -0,0 +1,53 @@ +#!/bin/bash + +# rc.serviio - script to run with slackware + +# Location of serviio.sh +SERVIIO_CMD=/opt/serviio/bin/serviio.sh + +# The user Serviio should run under +SERVIIO_USER=serviio + +# pid file used +PIDFILE=/var/run/serviio/serviio.pid + +# stop/start functions + +start() { + if [ -f "$PIDFILE" ] ; then + echo "Serviio DNLA server already running or incorrectly stopped!" + echo "If Serviio DNLA server isn't running, please check if" + echo "$PIDFILE exists and delete it." + else + echo 'Starting Serviio DNLA server...' + su --login -c "$SERVIIO_CMD" $SERVIIO_USER + fi +} + +stop(){ + if [ -f "$PIDFILE" ] ; then + echo "Stopping Serviio DNLA server..." + kill -9 $(<"$PIDFILE") + if [ -f "$PIDFILE" ] ; then + rm "$PIDFILE" + fi + else + echo "Serviio DNLA server isn't running or $PIDFILE file is absent!" + fi +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + ;; +esac diff --git a/multimedia/serviio/serviio.SlackBuild b/multimedia/serviio/serviio.SlackBuild new file mode 100644 index 0000000000..b5a1ba4836 --- /dev/null +++ b/multimedia/serviio/serviio.SlackBuild @@ -0,0 +1,107 @@ +#!/bin/bash + +# serviio.SlackBuild: build script for Serviio DNLA Server + +# Copyright 2016 Luís Fernando Carvalho Cavalheiro ( pessoal at profcavalheiro dot com) +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=serviio +VERSION=${VERSION:-1.7.1.1} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +SERVIIOGID=${SERVIIOGID:-337} +SERVIIOUID=${SERVIIOUID:-337} + +if ! grep -q "^serviio:" /etc/group; then + echo "$0: Error: $PRGNAM group ($SERVIIOGID) doesn't exist." + echo "$0: Try creating one with:" + echo " # groupadd -g $SERVIIOGID $PRGNAM" + exit 1 +fi + +if ! grep -q "^serviio:" /etc/passwd; then + echo "$0: Error: $PRGNAM user ($SERVIIOUID) doesn't exist." + echo "$0: Try creating one with:" + echo " # useradd -u $SERVIIOUID -g $SERVIIOGID -d /opt/$PRGNAM $PRGNAM" + exit 1 +fi + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION-linux.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + -type d -exec chmod 755 {} \; -o \ + -type f -exec chmod 644 {} \; + +chmod 755 bin/* + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +mv -t $PKG/usr/doc/$PRGNAM-$VERSION LICENCE.txt NOTICE.txt README.txt RELEASE_NOTES.txt +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# Without this rc.serviio won't work +sed -i '/^exec /s:$: \& echo \$! > /var/run/serviio/serviio.pid:' bin/serviio.sh + +mkdir -p $PKG/opt/$PRGNAM +mv -t $PKG/opt/$PRGNAM * + +mkdir -p $PKG/etc/rc.d +install --mode=644 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/multimedia/serviio/serviio.info b/multimedia/serviio/serviio.info new file mode 100644 index 0000000000..347da16539 --- /dev/null +++ b/multimedia/serviio/serviio.info @@ -0,0 +1,10 @@ +PRGNAM="serviio" +VERSION="1.7.1.1" +HOMEPAGE="http://serviio.org/" +DOWNLOAD="http://download.serviio.org/releases/serviio-1.7.1.1-linux.tar.gz" +MD5SUM="783009f30002510111d7698ce20f2846" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="jdk" +MAINTAINER="Luís Fernando Carvalho Cavalheiro" +EMAIL="pessoal@profcavalheiro.com" diff --git a/multimedia/serviio/slack-desc b/multimedia/serviio/slack-desc new file mode 100644 index 0000000000..a0aa1d8a96 --- /dev/null +++ b/multimedia/serviio/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +serviio: serviio (Java-based DNLA media server) +serviio: +serviio: Serviio DNLA Server is a free media server. It allows you to stream +serviio: your media files (music, video or images) to renderer devices (e.g. +serviio: a TV set, Bluray player, games console or mobile phone) on your +serviio: connected home network. +serviio: +serviio: There is also a paid for Pro edition. If you don't buy a Pro edition +serviio: licence, Serviio automatically will turn to Free version after 14 +serviio: days. This SlackBuild provides no Pro edition licence. +serviio: