djoole
Contributor
- Joined
- Oct 3, 2011
- Messages
- 158
Hi,
After providing a couple years ago a package to install LMS on FreeNAS 8, since I recently upgraded to FreeNAS 9, i found out that LMS wasn't starting anymore (thanks to Perl upgrading from 5.14 to 5.16)
As i didn't want to have to downgrade Perl (easy, but ugly solution), i had to spend hours scratching my head to make it work.
I figured i could share that.
Here is an easy installme script, you just have to put it somewhere in your plugin jail, and it will do the rest.
Logitech Media Server Version : 7.8.0 - 1392818344 @ Sat Mar 1 19:18:15 PST 2014
Version de Perl : 5.16.3 - amd64-freebsd-thread-multi
Version de la base de données : DBD::SQLite 1.40 (sqlite 3.7.17)
Enjoy :)
Here is the installme.sh content :
After providing a couple years ago a package to install LMS on FreeNAS 8, since I recently upgraded to FreeNAS 9, i found out that LMS wasn't starting anymore (thanks to Perl upgrading from 5.14 to 5.16)
As i didn't want to have to downgrade Perl (easy, but ugly solution), i had to spend hours scratching my head to make it work.
I figured i could share that.
Here is an easy installme script, you just have to put it somewhere in your plugin jail, and it will do the rest.
Logitech Media Server Version : 7.8.0 - 1392818344 @ Sat Mar 1 19:18:15 PST 2014
Version de Perl : 5.16.3 - amd64-freebsd-thread-multi
Version de la base de données : DBD::SQLite 1.40 (sqlite 3.7.17)
Enjoy :)
Here is the installme.sh content :
Code:
#!/bin/sh
# install script for Logitech Media Server on FreeNAS 9.2.1.1-RELEASE-X64 inside a plugin jail
#- by djoole -
#
#1. Log into your jail (assuming 1 is the id of your jail) :
# jexec 1 /bin/csh
#
#2. Create a temp dir
# mkdir /usr/local/tmp
#
#3. Put the package in your temp dir
#
#4. unpack it :
# cd /usr/local/tmp && tar xzf lms-7.8.0-1392818344-freenas-9.2.1.1-RELEASE-x64.tgz
#
#5. launch the install script :
# ./installme.sh
#
#6. Enjoy your music again :)
#
#
#Updating LMS should be this easy (not tested, make a backup of your prefs and plugins) :
#1. Download latest LMS Freebsd package from http://downloads.slimdevices.com/
#2. Unpack my package
#3. Replace lms.tgz by the package you just downloaded (becareful it must be named lms.tgz!!)
#4. Change VERSION file content exactly by the main dir name of slimdevice tgz
#5. Repack
#6. Share and Use
#
#
set -e
group=lms
user=lms
installdir="/usr/local/lms"
tmpdir="/usr/local/lms-freenas-amd64"
# creation of the daemon lms user
if !(pw group show $group) > /dev/null 2>&1; then
pw groupadd $group
fi
if !(pw user show $user) > /dev/null 2>&1; then
pw useradd $user -g $group -h - -s /bin/sh -c "Logitech Media Server" -d $installdir
fi
# we need the latest package to install it
cd /usr/local
wget http://djoole.free.fr/lms/lms-freenas-amd64.tgz
tar xzf lms-freenas-amd64.tgz
rm lms-freenas-amd64.tgz
version=`cat lms-freenas-amd64/VERSION`
# and install
mkdir $installdir
cd $installdir
tar zxf $tmpdir/lms.tgz
mv -f $version/* $installdir
rmdir $version
cd $tmpdir
# installing some dependencies that Logitech din't feel like provinding for Perl versions > 5.8
pkg install -y p5-DBI p5-EV p5-XML-Parser p5-HTML-Parser p5-JSON-XS p5-Digest-SHA1 p5-YAML-LibYAML p5-Sub-Name p5-Audio-Scan p5-Image-Scale p5-DBD-SQLite p5-Class-XSAccessor p5-Template-Toolkit p5-IO-Interface sox
# removing some obsoletes modules shipped with LMS preventing the server to start
# we are going to use the ones previously installed
mv /usr/local/lms/CPAN/DBD/SQLite.pm /usr/local/lms/CPAN/DBD/SQLite.pm.old
mv /usr/local/lms/CPAN/Class/XSAccessor.pm /usr/local/lms/CPAN/Class/XSAccessor.pm.old
mv /usr/local/lms/CPAN/Template.pm /usr/local/lms/CPAN/Template.pm.old
mv /usr/local/lms/CPAN/Compress/Raw/Zlib.pm /usr/local/lms/CPAN/Compress/Raw/Zlib.pm.old
# installing the Media::Scan module compiled by your servitor
mkdir -p $installdir/CPAN/arch/5.16/amd64-freebsd-thread-multi/auto/Media/Scan
cp Scan.so $installdir/CPAN/arch/5.16/amd64-freebsd-thread-multi/auto/Media/Scan/
chown -R $user:$group $installdir
# service install
cp lms /usr/local/etc/rc.d
chmod +x /usr/local/etc/rc.d/lms
# autostart at boot
if ! fgrep -q lms_enable /etc/rc.conf; then
echo 'lms_enable="YES"' >> /etc/rc.conf
fi
# LMS start
sh /usr/local/etc/rc.d/lms onestart
cat <<EOF
=================================================
Okay, $version is installed in your jail!
It has been configured to auto start at boot, and has been already launched for an instant use.
Just browse to http://your_jail_ip:9000
You can manually stop/start LMS with :
service lms onestop/onestart
You can now delete your tmp dir!
=================================================
EOF