michalpolkowski / alt-f

Automatically exported from code.google.com/p/alt-f
0 stars 0 forks source link

miniDLNA init script #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
minidlna seems to only run with the "-d" option flag, and also can't 
create its pid file. 

As an interim solution, after installing minidlna, replace /etc/init.d/ 
S80minidlna with the file bellow.
minidlna will run as root. 

Maximize this windows, otherwise copy/paste will break wide lines

The good news is that minidlna has a new stable source code release 
(the package will only be available after 0.1B6 is released) 

-----8<--------------- 
#!/bin/sh -e

NAME=minidlna 
DESC="MiniDLNA is a DLNA/UPnP-AV server." 
TYPE=user 

CONFF=/etc/$NAME.conf 
MINIDLNA_USER=$NAME 
MINIDLNA_GROUP=multimedia 
MINIDLNA_ARGS="-d" 

. $(dirname $0)/common 

check_shares() { 
    if test -r "$CONFF"; then 
        MDLNA_DIR="$(awk -F= '/^media_dir/{printf "%s;", $2}' $CONFF)" 
        OIFS="$IFS"; IFS=";" 
        for i in $MDLNA_DIR; do 
            if test ! -d "$i"; then 
                echo "Share $i does not exist." 
                exit 1 
            else 
                conf_ok=1 
            fi 
        done 
        IFS="$OIFS" 
        if test -z "$conf_ok"; then 
            echo "No shares configured." 
            exit 1 
        fi 
        return 0 
    fi 
    echo "Configuration file does not exist." 
    exit 1 
} 

case "$1" in 
    start) 
        echo -n "Starting $NAME: " 
        check_shares 
        minidlna -d > /var/lib/minidlna/minidlna.log 2>&1 & 
        omsg $? 
        ;; 
    stop) stop $NAME 2 ;; 
    status) status $NAME ;; 
    restart) restart $NAME ;; 
    *) 
        echo "Usage: $0 {start|stop|status|restart}" 
        exit 1 
        ;; 
esac

Original issue reported on code.google.com by whoami.j...@gmail.com on 29 Nov 2010 at 11:00

GoogleCodeExporter commented 9 years ago
Use the attached file, instead of copy/paste the one posted in the previous 
comment.

... As an interim solution, after installing minidlna, replace /etc/init.d/ 
S80minidlna with the attached file.

Original comment by whoami.j...@gmail.com on 1 Dec 2010 at 7:25

Attachments:

GoogleCodeExporter commented 9 years ago
Now fixed in the experimental feed, so closing.

Original comment by whoami.j...@gmail.com on 19 Jan 2011 at 7:35