How to autostart Firefly (mt-daapd)?

According to the information on ITunes - openSUSE, I’m supposed to issue the commands

chkconfig --add mt-daapd
chkconfig --add mdnsd

to make sure Firefly Media Server starts at boot and

service mt-daapd start
service mdnsd start

to actually start them. Thing is, it gives me the error(s)

linux-fzcf:/home/ryan # chkconfig --add mt-daapd
mt-daapd: unknown service
linux-fzcf:/home/ryan # service mt-daapd start
service: no such service mt-daapd
linux-fzcf:/home/ryan # chkconfig --add mdnsd
mdnsd: unknown service

when I try those commands. So how do I automatically start mt-daapd?

You need to write your own startup script for mt-daapd since there are only rc scripts for Debian and Gentoo included.

Heres a step by step instruction on how I installed firefly on openSUSE 11.1

  1. Get the latest version of firefly here: Firefly Media Server :: Download

  2. untar the source and go to the directory using a terminal.

  3. Then run ./config and install the required packages if it gives you errors and try again.

  4. run make and then sudo make install

  5. Next you have to create your config file, open the mt-daapd.conf in the /contrib directory and tailor it to your needs.
    Here’s an example from my config:

NOTE I had to change this from the default “/usr/share/mt-daapd/admin-root” value.

web_root /usr/local/share/mt-daapd/admin-root
port 3689
admin_pw yourpassword
db_dir /var/cache/mt-daapd
mp3_dir /mymusic
servername Musicshare
playlist /etc/mt-daapd.playlist
extensions .mp3,.m4a,.m4p,.ogg,.flac
scan_type 1
compress 1

You should also edit mt-daapd.playlist in the same directory to suit your needs.

  1. Next copy the config files over to /etc with
    sudo cp mt-daapd.conf /etc/mt-daapd.conf” and
    sudo cp mt-daapd.playlist /etc-mt-daapd.playlist

  2. Here it gets a bit tricky, since there aren’t any startup scripts for openSUSE we need to create our own.
    You can download my startup script here or create a new file using your favorite text editor and copy/paste this: (I’m assuming that mt-daapd is located in “/usr/local/sbin/”, which was the default installation path for me. (NOTE that this is my first startup script and it might be a bit messy, but it works)):


#!/bin/bash
#
# chkconfig: 2345 85 15
# description: mt-daapd is a multi-threaded DAAP server for iTunes
# processname: mt-daapd
# pidfile: /var/run/mt-daapd
#

# source function library
# . /etc/init.d/functions
#  -e /etc/daapd.conf ]

test -x /usr/local/sbin/mt-daapd || { echo "/usr/local/sbin/mt-daapd not installed";
        if  "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }

. /etc/rc.status

# Reset status of this service
rc_reset


case "$1" in
  start)
	echo -n $"Starting DAAP server: "
	
	## Start daemon with startproc(8). If this fails
        ## the return value is set appropriately by startproc.
	/sbin/startproc /usr/local/sbin/mt-daapd

	# Remember status and be verbose
        rc_status -v
	;;
  stop)
	echo -n $"Shutting down DAAP server: "

        ## Stop daemon with killproc(8) and if this fails
        ## killproc sets the return value according to LSB.
	/sbin/killproc -TERM /usr/local/sbin/mt-daapd

        # Remember status and be verbose
        rc_status -v
	;;
  restart|reload)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status

	;;
  status)
        echo -n "Checking for service DAAP server "
        ## Check status with checkproc(8), if process is running
        ## checkproc will return with exit status 0.

        # NOTE: checkproc returns LSB compliant status values.
        /sbin/checkproc /usr/local/sbin/mt-daapd
        # NOTE: rc_status knows that we called this init script with
        # "status" option and adapts its messages accordingly.
        rc_status -v
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	exit 1
esac

exit

Next make sure that your file is “runnable”, that is “Is excecutable” is checked in the properties menu on your file.

Then we need to move our startup script to /etc/init.d
sudo cp mt-daapd-opensuse /etc/init.d/mt-daapd

  1. Now that we’ve got our startup script we can start mt-daapd by typing:
    sudo /etc/init.d/mt-daapd start”.
    If we want mt-daapd to start automatically we can open up YAST -> System -> System Services (Runlevel)
    then select Expert mode and select mt-daapd from the list and click on the “Set/Reset” button and select “Enable Service”.

  2. Congratulations, unless something went wrong you mt-daapd should be up and running. You can confirm it by opening http://localhost:3689/ in your web browser, you should be greeted with the admin site of mt-daapd.

  3. If you’re going to share your music you will probably have to adjust your firewall to allow traffic on port 3689.

  4. If you’re going to share your music over the internet you can use a SSH Tunnel or Rendevous Proxy. If you’re fairly to moderately paranoid then I recommend SSH Tunneling.

I think that’s all of it. Good luck and Enjoy:P