Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bullshit/8850040 to your computer and use it in GitHub Desktop.
Save bullshit/8850040 to your computer and use it in GitHub Desktop.

Created 2013-12-10

Install logitechmediaserver server on cubieboard 2

Howto install the logitech media server formerly known as squeezebox server on Cubieboard 2 (arm linux) via cubian.

Prepare build environment

sudo dpkg-reconfigure locales # choose en_US.UTF-8, de_DE.UTF-8 (the later just for my convenience)
sudo dpkg-reconfigure tzdata # i choose Europe/Berlin
sudo apt-get install build-essential bzip2

Install perl via homebrew

This keeps the system perl untouched.

wget -O - http://install.perlbrew.pl | bash

Append the follwoing to ~/.zshrc or ~/.bashrc:

source ~/perl5/perlbrew/etc/bashrc

Re-login to the machine or start a new zsh or just source the mentioned file.

Now install perl-5.14 to the home directory:

perlbrew install perl-5.12.4 -D usethreads -D use64bitint -A ccflags=-fno-stack-protector -A ldflags=-fno-stack-protector
perlbrew switch perl-5.14.2

Build required perl modules

sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install subversion
svn co http://svn.slimdevices.com/repos/slim/7.7/trunk/vendor/ slimdevices-vendor
cd slimdevices-vendor/CPAN
export PERL_514=$HOME/perl5/perlbrew/perls/perl-5.14.2/bin/perl5.14.2
./buildme.sh

The perl modules can be found in $HOME/slimdevices-vendor/CPAN/build/5.12/lib/perl5/armv7l-linux-thread-multi-64int or if on a different arch, in the corresponding directory.

Fetch and test logitechmediaserver

wget http://downloads.slimdevices.com/LogitechMediaServer_v7.7.3/
tar xvfz logitechmediaserver-7.7.3-noCPAN.tgz
cd logitechmediaserver-7.7.3-1375965195-noCPAN
perl -I $HOME/slimdevices-vendor/CPAN/build/5.12/lib/perl5/armv7l-linux-thread-multi-64int ./slimserver.pl -v

Browse to http://your-ip:9000/ to try the server.

Start on boot

Place the attached logitechmediaserver file to /etc/init.d.

To make the server really autostart on boot:

sudo update-rc.d logitechmediaserver defaults

Added bonus

Announce device in local network without hassle and messing with DNS:

sudo apt-get install avahi-daemon

Spindown harddisk to reduce noise:

cat /etc/hdparm.conf

/dev/disk/by-id/ata-ST9500325AS_5VEGWP68 {
	apm = 1
	spindown_time = 12
}

cat /etc/sysfs.conf

devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 60000 
devices/system/cpu/cpu1/cpufreq/scaling_min_freq = 60000

EOF

#!/bin/sh
### BEGIN INIT INFO
# Provides: logitechmediaserver
# Required-Start: $remote_fs $syslog
# Required-Stop:
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Logitechmediaserver start script
# Description: Starts logitechmediaserver.
### END INIT INFO
#set -x
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Logitech Media Server"
NAME=logitechmediaserver
SCRIPTNAME=/etc/init.d/$NAME
PIDFILE=/var/run/$NAME.pid
BIN=/home/cubie/logitechmediaserver-7.7.3-1375965195-noCPAN/slimserver.pl
PERL=/home/cubie/perl5/perlbrew/perls/perl-5.12.4/bin/perl
DIR=/home/cubie/logitechmediaserver-7.7.3-1375965195-noCPAN
PERLINC=/home/cubie/slimdevices-vendor/CPAN/build/5.12/lib/perl5/armv7l-linux-thread-multi-64int
# Exit if the package is not installed
[ -x "$BIN" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Define LSB log_* functions.
. /lib/lsb/init-functions
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# other if daemon could not be started or a failure occured
start-stop-daemon --start --quiet --exec $PERL --chdir $DIR --pidfile $PIDFILE -- -I $PERLINC ./slimserver.pl --user cubie --daemon --pidfile $PIDFILE
}
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# other if daemon could not be stopped or a failure occurred
start-stop-daemon --stop --quiet --exec $PERL --chdir $DIR --pidfile $PIDFILE
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$RSYSLOGD"
#create_xconsole
do_start
case "$?" in
0) sendsigs_omit
log_end_msg 0 ;;
1) log_progress_msg "already started"
log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$RSYSLOGD"
do_stop
case "$?" in
0) log_end_msg 0 ;;
1) log_progress_msg "already stopped"
log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|rotate|restart|force-reload|status}" >&2
exit 3
;;
esac
:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment