From 2ea80394f84a1897169ad75f6ec81ca6a3f003aa Mon Sep 17 00:00:00 2001 From: Heinz Wiesinger Date: Mon, 6 Dec 2010 22:44:51 -0600 Subject: [PATCH] network/mediatomb: Added (an open source UPnP MediaServer) Signed-off-by: Robby Workman --- network/mediatomb/README | 7 ++ network/mediatomb/config.xml | 151 +++++++++++++++++++++++++ network/mediatomb/doinst.sh | 29 +++++ network/mediatomb/mediatomb.SlackBuild | 118 +++++++++++++++++++ network/mediatomb/mediatomb.info | 10 ++ network/mediatomb/rc.mediatomb | 80 +++++++++++++ network/mediatomb/rc.mediatomb.conf | 21 ++++ network/mediatomb/slack-desc | 19 ++++ 8 files changed, 435 insertions(+) create mode 100644 network/mediatomb/README create mode 100644 network/mediatomb/config.xml create mode 100644 network/mediatomb/doinst.sh create mode 100644 network/mediatomb/mediatomb.SlackBuild create mode 100644 network/mediatomb/mediatomb.info create mode 100644 network/mediatomb/rc.mediatomb create mode 100644 network/mediatomb/rc.mediatomb.conf create mode 100644 network/mediatomb/slack-desc diff --git a/network/mediatomb/README b/network/mediatomb/README new file mode 100644 index 0000000000..ff48d72002 --- /dev/null +++ b/network/mediatomb/README @@ -0,0 +1,7 @@ +MediaTomb is an open source (GPL) UPnP MediaServer with a nice +web user interface, it allows you to stream your digital media +through your home network and listen to/watch it on a variety +of UPnP compatible devices. + +mediatomb optionally depends on ffmpeg, libmp4v2, lastfmlib and +ffmpegthumbnailer. diff --git a/network/mediatomb/config.xml b/network/mediatomb/config.xml new file mode 100644 index 0000000000..497ae5d2d9 --- /dev/null +++ b/network/mediatomb/config.xml @@ -0,0 +1,151 @@ + + + + + + + + + MediaTomb + + /var/lib/mediatomb + /usr/share/mediatomb/web + + + mediatomb.db + + + localhost + mediatomb + mediatomb + + + + + + + + + + 128 + 5 + yes + no + 8 + + + * + + video + + + + lastfmuser + lastfmpass + + + + + + /usr/share/mediatomb/js/common.js + /usr/share/mediatomb/js/playlists.js + + /usr/share/mediatomb/js/import.js + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + audio/L16 + no + yes + no + + + + + video/mpeg + yes + yes + yes + + + + + + \ No newline at end of file diff --git a/network/mediatomb/doinst.sh b/network/mediatomb/doinst.sh new file mode 100644 index 0000000000..adc456f74f --- /dev/null +++ b/network/mediatomb/doinst.sh @@ -0,0 +1,29 @@ +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 +} + +# Prepare the new configuration files +config etc/mediatomb/config.xml.new +config etc/rc.d/rc.mediatomb.conf.new +preserve_perms etc/rc.d/rc.mediatomb.new + diff --git a/network/mediatomb/mediatomb.SlackBuild b/network/mediatomb/mediatomb.SlackBuild new file mode 100644 index 0000000000..de89416ec0 --- /dev/null +++ b/network/mediatomb/mediatomb.SlackBuild @@ -0,0 +1,118 @@ +#!/bin/sh + +# Slackware build script for mediatomb + +# Copyright 2010 Heinz Wiesinger, Amsterdam, The Netherlands +# 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=mediatomb +VERSION=0.12.1 +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -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 + +if ! grep ^mediatomb: /etc/group 2>&1 > /dev/null; then + echo " Must have a mediatomb group to run this script." + echo " # groupadd -g 241 mediatomb" + echo " Or something similar." + exit 1 +elif ! grep ^mediatomb: /etc/passwd 2>&1 > /dev/null; then + echo " Must have a mediatomb user to run this script." + echo " # useradd -u 241 -g mediatomb -d /var/lib/mediatomb mediatomb" + echo " Or something similar." + exit 1 +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +# We need LDFLAGS="-ldl" for proper sqlite detection +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +LDFLAGS="-ldl" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux + +make +make install-strip DESTDIR=$PKG + +mkdir -p $PKG/etc/rc.d +cp $CWD/rc.mediatomb $PKG/etc/rc.d/rc.mediatomb.new +cp $CWD/rc.mediatomb.conf $PKG/etc/rc.d/rc.mediatomb.conf.new + +mkdir -p $PKG/etc/mediatomb +install -m 644 $CWD/config.xml $PKG/etc/mediatomb/config.xml.new +chown -R mediatomb:mediatomb $PKG/etc/mediatomb + +mkdir -p $PKG/var/{lib,log,run}/mediatomb +chown mediatomb:mediatomb $PKG/var/{lib,log,run}/mediatomb + +find $PKG/usr/man -type f -exec gzip -9 {} \; + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS ChangeLog COPYING INSTALL NEWS README TODO \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +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/network/mediatomb/mediatomb.info b/network/mediatomb/mediatomb.info new file mode 100644 index 0000000000..2ffe006341 --- /dev/null +++ b/network/mediatomb/mediatomb.info @@ -0,0 +1,10 @@ +PRGNAM="mediatomb" +VERSION="0.12.1" +HOMEPAGE="http://mediatomb.cc/" +DOWNLOAD="http://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz" +MD5SUM="e927dd5dc52d3cfcebd8ca1af6f0d3c2" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Heinz Wiesinger" +EMAIL="pprkut@liwjatan.at" +APPROVED="rworkman" diff --git a/network/mediatomb/rc.mediatomb b/network/mediatomb/rc.mediatomb new file mode 100644 index 0000000000..92804835b9 --- /dev/null +++ b/network/mediatomb/rc.mediatomb @@ -0,0 +1,80 @@ +#!/bin/sh +# Start/stop/restart mediatomb. +# $Id: rc.mediatomb,v 1.0 2010/11/01 +# Authors: Heinz Wiesinger +# --------------------------------------------------------------------------- + +MEDIATOMB_PIDFILE="/var/run/mediatomb/mediatomb.pid" +MEDIATOMB_LOGFILE="/var/log/mediatomb/mediatomb.log" + +# Get additional configuration information from /etc/rc.d/rc.mediatomb.conf: +. /etc/rc.d/rc.mediatomb.conf + +mediatomb_start() +{ + echo -n "Starting mediatomb ... " + if [ -e "${MEDIATOMB_PIDFILE}" ]; then + echo "already running!" + else + if [ "${MEDIATOMB_INTERFACE}" != "" ]; then + MEDIATOMB_OPTIONS="$MEDIATOMB_OPTIONS --interface ${MEDIATOMB_INTERFACE}" + fi + if [ "${MEDIATOMB_PORT}" != "" ]; then + MEDIATOMB_OPTIONS="$MEDIATOMB_OPTIONS --port ${MEDIATOMB_PORT}" + fi + /usr/bin/mediatomb \ + --daemon \ + --user ${MEDIATOMB_USER} \ + --group ${MEDIATOMB_GROUP} \ + --pidfile ${MEDIATOMB_PIDFILE} \ + --logfile ${MEDIATOMB_LOGFILE} \ + --config ${MEDIATOMB_CONFIG} \ + ${MEDIATOMB_OPTIONS} + echo "done!" + fi +} + +mediatomb_stop() +{ + echo -n "Stopping mediatomb ... " + if [ -e "${MEDIATOMB_PIDFILE}" ]; then + kill -TERM $(cat ${MEDIATOMB_PIDFILE}) > /dev/null 2>&1 + echo "done!" + rm -f "${MEDIATOMB_PIDFILE}" + else + echo "not running!" + fi +} + +mediatomb_restart() +{ + mediatomb_stop + sleep 1 + mediatomb_start +} + +mediatomb_status() +{ + if [ -e "${MEDIATOMB_PIDFILE}" ]; then + echo "mediatomb is running!" + else + echo "mediatomb is not running!" + fi +} + +case "$1" in +'start') + mediatomb_start + ;; +'stop') + mediatomb_stop + ;; +'status') + mediatomb_status + ;; +'restart') + mediatomb_restart + ;; +*) + echo "usage $0 start|stop|restart|status" +esac diff --git a/network/mediatomb/rc.mediatomb.conf b/network/mediatomb/rc.mediatomb.conf new file mode 100644 index 0000000000..af5ea4feef --- /dev/null +++ b/network/mediatomb/rc.mediatomb.conf @@ -0,0 +1,21 @@ +# /etc/rc.d/rc.mediatomb.conf +# +# This file contains the configuration settings for mediatomb. + +# Main configuration file that should be used for mediatomb +MEDIATOMB_CONFIG="/etc/mediatomb/config.xml" + +# The user under which mediatomb should run +MEDIATOMB_USER="mediatomb" + +# The group under which mediatomb should run +MEDIATOMB_GROUP="mediatomb" + +# Network Interface to bind to +MEDIATOMB_INTERFACE="" + +# Server port (the SDK only permits values >= 49152) +MEDIATOMB_PORT="" + +# Additional mediatomb options +MEDIATOMB_OPTIONS="" diff --git a/network/mediatomb/slack-desc b/network/mediatomb/slack-desc new file mode 100644 index 0000000000..ddfff1fd22 --- /dev/null +++ b/network/mediatomb/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 ':'. + + |-----handy-ruler------------------------------------------------| +mediatomb: mediatomb (UPnP Media Server) +mediatomb: +mediatomb: MediaTomb is an open source (GPL) UPnP MediaServer with a nice +mediatomb: web user interface, it allows you to stream your digital media +mediatomb: through your home network and listen to/watch it on a variety +mediatomb: of UPnP compatible devices. +mediatomb: +mediatomb: Homepage: http://mediatomb.cc/ +mediatomb: +mediatomb: +mediatomb: