aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2016-09-23 15:56:34 +0100
committerStuart Shelton <stuart@shelton.me>2016-09-23 16:12:31 +0100
commitdfb9c5a0e603bd2e6a29af64c6107a732a0e7ae3 (patch)
treeaf3aba1df0a459425fb16d4448d52dd6ac1407d1 /media-sound
parentAdd sys-apps/lsusb-apple-1.1, update README.md (diff)
downloadsrcshelton-dfb9c5a0e603bd2e6a29af64c6107a732a0e7ae3.tar.gz
srcshelton-dfb9c5a0e603bd2e6a29af64c6107a732a0e7ae3.tar.bz2
srcshelton-dfb9c5a0e603bd2e6a29af64c6107a732a0e7ae3.zip
Add media-sound/logitechmediaserver-bin-9999, update README.md
Diffstat (limited to 'media-sound')
-rw-r--r--media-sound/logitechmediaserver-bin/Manifest10
-rw-r--r--media-sound/logitechmediaserver-bin/files/Gentoo-detailed-changelog.txt3
-rw-r--r--media-sound/logitechmediaserver-bin/files/Gentoo-plugins-README.txt25
-rw-r--r--media-sound/logitechmediaserver-bin/files/gentoo-filepaths.pm76
-rw-r--r--media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-client-playlists-gentoo.patch11
-rw-r--r--media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-uuid-gentoo.patch14
-rw-r--r--media-sound/logitechmediaserver-bin/files/logitechmediaserver.conf.d11
-rwxr-xr-xmedia-sound/logitechmediaserver-bin/files/logitechmediaserver.init.d51
-rw-r--r--media-sound/logitechmediaserver-bin/files/logitechmediaserver.logrotate.d12
-rw-r--r--media-sound/logitechmediaserver-bin/files/logitechmediaserver.service17
-rw-r--r--media-sound/logitechmediaserver-bin/logitechmediaserver-bin-9999.ebuild338
11 files changed, 568 insertions, 0 deletions
diff --git a/media-sound/logitechmediaserver-bin/Manifest b/media-sound/logitechmediaserver-bin/Manifest
new file mode 100644
index 00000000..dab08ccf
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/Manifest
@@ -0,0 +1,10 @@
+AUX Gentoo-detailed-changelog.txt 62 SHA256 15757e6ae40879f3041b7b3ec8c952cbc86e5b50b0020ebb90770418dffec7cb SHA512 57513b5b61b4bcbf6e15f5b414030172b1b50b058b9ea2d237929d0a83a25d0d57cbdf1385614fd0fc4a5e684d9ccf36cb1f2b6fcf42bd2fa0c07c56cf659738 WHIRLPOOL deb5ab41eded99daf0f60f61ac8dbd519970a8c9fec88d94563abb907443aa62013809e70c94aa37b9f2bb1b8ac1ea6b22afe9ce4227232dd7dd37e1e34257ed
+AUX Gentoo-plugins-README.txt 884 SHA256 44491e0815c1a188968bd07732c3f99a056990afdb8d8bd5100355fa0aa5bf2b SHA512 3248240c97f866fa63674553622daf4e5060c20d2dbf7f5ab92cc5d9f6a2002852d7c5ccb30b7f0c6fe7fb3b136fa03770977cd3b767d9c241fa65861517ec2a WHIRLPOOL c2d9df95ceab02b289b377fc529cbdcec8df08a666482bf36eb262ea4fcfab029f7da565cd3076bdc9cfcec71430957d89a6d9d9cf20168ee1fb5503ba3a5029
+AUX gentoo-filepaths.pm 1790 SHA256 f001f68aef00d0b104ce33dfff65a02c233ad753aa368e5b1ae1142acfbe6613 SHA512 8f9236bdbb4894bb39856acda6316c230f65600190d240b4bb68aaa71e592317951047403e595eb00d02f34e7381f62f78018e80610d7864b234c9c58242131c WHIRLPOOL b947ad80b2827ce51a6b6e46071ad66e54aa195688464ceb16b22fee641a01859b4fb8befb1f75dc9f36ee60fae152a23d7906c92de2d3d480ce1145d8d9cc13
+AUX logitechmediaserver-bin-9999-client-playlists-gentoo.patch 395 SHA256 6ffa1ba22f6e519c02abafd4ae16055a4cb555af113bbac25f3a30d0a85f8845 SHA512 45ee8ee475b5dc798081608c95a8c0fffa4e4f5e4b03c53f38288fc534bf9818d6c7b8829fbbef2e5e5d8790922a7f77b557277ffda863ba20c937c795fefc4a WHIRLPOOL 481f9451a125119edf92e9e5f413628b3bdfb698b27271ccc36d033f91c538f1ac0796f5dc0117cfcb80ae0bfbbc6d8b3fea62985fcce1a1900ae0f8e631be4b
+AUX logitechmediaserver-bin-9999-uuid-gentoo.patch 525 SHA256 032f9edec613661f691797934cf73191c8ac94269cff59773c365f20603f01c4 SHA512 4c8a65893842aa9c0be21b3ad59fcf9f350e4c1b169099f4ffafe18b298ee7860693d529a3a7d81d7f4251bad5904f975e26e5fc2a33312003354bdda3e4bb87 WHIRLPOOL e74772fec480bc46d73073d5ce11e6052758ef20f636e99a74498ae3fe624b96241f3df7d36f63a94b34dbfc3017385872ada16698c6ff6c6f4c33e471c88348
+AUX logitechmediaserver.conf.d 477 SHA256 4a2a77f66f35e6ea9867784de04c7552cfe36d9d583bf423ab2e871f85606713 SHA512 686c00e7a28df15369aad74d46700d5a943bf539a57828f83e313d82014c8610c41481aff2678908f90f6bf702c0ac5408bfc7909b155c21ddc5fec21fccac28 WHIRLPOOL 615d2acdeb804507082fe858925a16c228e7d07199ead5443219a5a78c891ae035b7e9046e9a4487e8c838f288d8421fd3cc642a38a0ee21ed3d919c3f673df3
+AUX logitechmediaserver.init.d 1137 SHA256 e4b6730b87ebafb71aa88d54df10ef6b58826bb3f1cb6f63def7df5cdee02066 SHA512 821b4f86d5adb5de425419ce69648787c20fef684b7475111da42b1705609cb1d775a41151188c4e7b0d4ede969dde9de4ae56ac2a073e0b20a98cfb3ea064a1 WHIRLPOOL e037a88bd293a72a18a432922470737349ddc282f518dcde40f28e7dd1e39e054a55868977e30cb63f1379edb7f14f8bb318c0d74818c6d54e5b52674485c5d2
+AUX logitechmediaserver.logrotate.d 347 SHA256 82fd4cdb8537b610ec220545afc606c4b39481d449c08215073732fa27a247d0 SHA512 5787166d7318e494c574e965f47f6074805371283f5fd33955e02302ba43ffc64b2aa18f1c5a081d23ba49fb76cf512cfd966e5d68496fa54c05f911bab422b6 WHIRLPOOL 297329d107bc41846a4cc617c5cb05983e2839372b2684801d01ecea171d7a31603659d539e19b31559338de1702334d053c174acab697eda3d5f09e01c0efc5
+AUX logitechmediaserver.service 505 SHA256 b3042d06c4ed0217888d3d94ac78825b47bf2f667a6662c98781bd1fcc3781f4 SHA512 e07226d91a9806ff2c57e5868ef1cabbcda3bd90df0de3447071ee5d9b9b014a15c4b85885c0682b556addb8a103daf2a60a0d06539ea64decb75e7b84ad957b WHIRLPOOL 3a6846ccbd14ce5a167e72cbf97c9c316e99ff77f6c690887861e61376c3fdb975008be2f625ec946e01feab567fd21b35bad5b8331a699502f3243a67a9dc4b
+EBUILD logitechmediaserver-bin-9999.ebuild 11512 SHA256 4b42b050bde398da5db8c99425c3061964bad4ea6eb2f6b8b2082179df310ab9 SHA512 9b2e11c063f82ef149e6014c71beb52d18b82c1268c0bb70ec5a2cb83d402b8ee06566723e93013a46d61cea25a0b4010ed3f8e3923bb30b300abe2c2d1c0ffb WHIRLPOOL a118d7619a15be18167a5af535518eccc251fe908f78acca3c409b2b096e5458ad1ce05b885c18427f1bdb09a4f3c7578c298d9afdbdc6234c55577e023db13c
diff --git a/media-sound/logitechmediaserver-bin/files/Gentoo-detailed-changelog.txt b/media-sound/logitechmediaserver-bin/files/Gentoo-detailed-changelog.txt
new file mode 100644
index 00000000..b46f7384
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/Gentoo-detailed-changelog.txt
@@ -0,0 +1,3 @@
+---- logitechmediaserver-bin-7.8.1_preXXXXX
+
+Initial version.
diff --git a/media-sound/logitechmediaserver-bin/files/Gentoo-plugins-README.txt b/media-sound/logitechmediaserver-bin/files/Gentoo-plugins-README.txt
new file mode 100644
index 00000000..437b9b40
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/Gentoo-plugins-README.txt
@@ -0,0 +1,25 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+The standard Logitech Media Server package is installed differently on Gentoo
+in order that the installation complies with Gentoo's filesystem layout. These
+notes are provided to give guidance for installing plugins within this
+modified layout.
+
+MANUALLY INSTALLING PLUGINS
+
+The installation instructions of plugins should be followed but with the
+following Gentoo specifics:
+
+* Plugins should be installed into the directory:
+ /var/lib/logitechmediaserver/Plugins
+* Extension binaries (which sometimes accompany plugins) should be installed
+ into the directory:
+ /opt/logitechmediaserver/Bin
+
+BACKGROUND
+
+Those interested can refer to the following for details of Gentoo's filesystem
+standard:
+http://devmanual.gentoo.org/general-concepts/filesystem/index.html
diff --git a/media-sound/logitechmediaserver-bin/files/gentoo-filepaths.pm b/media-sound/logitechmediaserver-bin/files/gentoo-filepaths.pm
new file mode 100644
index 00000000..eb239e29
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/gentoo-filepaths.pm
@@ -0,0 +1,76 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+# This file contains a custom OS package to provide information on the
+# installation structure on Gentoo.
+
+package Slim::Utils::OS::Custom;
+
+use strict;
+
+use base qw(Slim::Utils::OS::Linux);
+
+sub initDetails {
+ my $class = shift;
+
+ $class->{osDetails} = $class->SUPER::initDetails();
+
+ $class->{osDetails}->{isGentoo} = 1 ;
+
+ # Ensure we find manually installed plugin files.
+ push @INC, '/var/lib/logitechmediaserver';
+ push @INC, '/var/lib/logitechmediaserver/Plugins';
+
+ return $class->{osDetails};
+}
+
+=head2 dirsFor( $dir )
+
+Return OS Specific directories.
+
+Argument $dir is a string to indicate which of the Logitech Media Server
+directories we need information for.
+
+=cut
+
+sub dirsFor {
+ my ($class, $dir) = @_;
+
+ my @dirs = ();
+
+ # Overrides for specific directories.
+ if ($dir eq 'Plugins') {
+
+ # Look in the normal places.
+ push @dirs, $class->SUPER::dirsFor($dir);
+
+ # User-installed plugins are in a different place, so add it.
+ push @dirs, '/var/lib/logitechmediaserver/Plugins';
+
+ } elsif ($dir eq 'ClientPlaylists') {
+
+ # LMS would normally try to put client playlists in the prefs
+ # directory, but they aren't really prefs since they're dynamic
+ # state of the clients. Effectively, they're the same as the
+ # database cache, so we move these under /var/lib.
+ push @dirs, '/var/lib/logitechmediaserver/ClientPlaylists';
+
+ } elsif ($dir =~ /^(?:prefs)$/) {
+
+ # Server and plugin preferences are in a different place.
+ push @dirs, $::prefsdir || '/etc/logitechmediaserver';
+
+ } else {
+
+ # Use the default behaviour to locate the directory.
+ push @dirs, $class->SUPER::dirsFor($dir);
+
+ }
+
+ return wantarray() ? @dirs : $dirs[0];
+}
+
+1;
+
+__END__
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-client-playlists-gentoo.patch b/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-client-playlists-gentoo.patch
new file mode 100644
index 00000000..b906595e
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-client-playlists-gentoo.patch
@@ -0,0 +1,11 @@
+--- Slim/Player/Playlist.pm.orig 2012-05-29 13:43:52.700212318 +0100
++++ Slim/Player/Playlist.pm 2012-05-29 13:43:52.692212037 +0100
+@@ -1042,7 +1042,7 @@
+ $id =~ s/://g;
+
+ return Slim::Utils::Misc::fileURLFromPath(
+- catfile(Slim::Utils::OSDetect::dirsFor('prefs'), "clientplaylist_$id.m3u")
++ catfile(Slim::Utils::OSDetect::dirsFor('ClientPlaylists'), "clientplaylist_$id.m3u")
+ );
+ }
+
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-uuid-gentoo.patch b/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-uuid-gentoo.patch
new file mode 100644
index 00000000..c94aef8d
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver-bin-9999-uuid-gentoo.patch
@@ -0,0 +1,14 @@
+--- slimserver.pl.orig 2012-05-29 13:43:52.700212318 +0100
++++ slimserver.pl 2012-04-01 22:00:00.111597353 +0100
+@@ -440,8 +440,9 @@
+
+ # Generate a UUID for this SC instance on first-run
+ if ( !$prefs->get('server_uuid') ) {
+- require UUID::Tiny;
+- $prefs->set( server_uuid => UUID::Tiny::create_UUID_as_string( UUID::Tiny::UUID_V4() ) );
++ require Data::UUID;
++ my $ug = new Data::UUID;
++ $prefs->set( server_uuid => lc $ug->create_str() );
+ }
+
+ main::INFOLOG && $log->info("Server binary search path init...");
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver.conf.d b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.conf.d
new file mode 100644
index 00000000..146d9576
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.conf.d
@@ -0,0 +1,11 @@
+# /etc/conf.d/logitechmediaserver
+
+# The following contains any other options you want to specify, such as default
+# logging options. The example below will prevent the discovery and display of
+# UPnP devices within your players.
+#
+# See "/opt/logitechmediaserver/slimserver.pl --help" for a full list of possible
+# options, but note that many of them are supplied by
+# /etc/init.d/logitechmediaserver and so don't need to be present here.
+#LMS_OPTS="--d_startup"
+LMS_OPTS=""
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver.init.d b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.init.d
new file mode 100755
index 00000000..eadbe727
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.init.d
@@ -0,0 +1,51 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+# These fit the Logitech Media Server ebuild and so shouldn't need to be
+# changed; user-servicable parts go in /etc/conf.d/logitechmediaserver.
+lms=logitechmediaserver
+rundir=/var/run/${lms}
+logdir=/var/log/${lms}
+optdir=/opt/${lms}
+vardir=/var/lib/${lms}
+pidfile=${rundir}/${lms}.pid
+cachedir=${vardir}/cache
+prefsdir=/etc/${lms}
+lmsuser=${lms}
+lmsbin=${optdir}/slimserver.pl
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath -q -d -o ${lmsuser}:${lmsuser} -m 0770 "${rundir}"
+}
+
+start() {
+ ebegin "Starting Logitech Media Server"
+
+ cd /
+ start-stop-daemon \
+ --start --exec ${lmsbin} \
+ --pidfile ${pidfile} \
+ --user ${lmsuser} \
+ --background \
+ -- \
+ --quiet \
+ --pidfile=${pidfile} \
+ --cachedir=${cachedir} \
+ --prefsdir=${prefsdir} \
+ --logdir=${logdir} \
+ ${LMS_OPTS}
+
+ eend $? "Failed to start Logitech Media Server"
+}
+
+stop() {
+ ebegin "Stopping Logitech Media Server"
+ start-stop-daemon --retry 10 --stop --pidfile ${pidfile}
+ eend $? "Failed to stop Logitech Media Server"
+}
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver.logrotate.d b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.logrotate.d
new file mode 100644
index 00000000..1ae4cc03
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.logrotate.d
@@ -0,0 +1,12 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+
+/var/log/logitechmediaserver/scanner.log /var/log/logitechmediaserver/server.log /var/log/logitechmediaserver/perfmon.log {
+ missingok
+ notifempty
+ copytruncate
+ rotate 5
+ size 100k
+ su logitechmediaserver logitechmediaserver
+}
diff --git a/media-sound/logitechmediaserver-bin/files/logitechmediaserver.service b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.service
new file mode 100644
index 00000000..8ee4c485
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/files/logitechmediaserver.service
@@ -0,0 +1,17 @@
+# unit file for media-sound/logitechmediaserver-bin
+#
+# Thanks to Caj Zell for the draft.
+
+[Unit]
+Description=Logitech Media Server Daemon
+After=network.target
+
+[Service]
+User=logitechmediaserver
+Group=logitechmediaserver
+WorkingDirectory=/opt/logitechmediaserver
+EnvironmentFile=/etc/conf.d/logitechmediaserver
+ExecStart=/opt/logitechmediaserver/slimserver.pl --prefsdir=/etc/logitechmediaserver --cachedir=/var/lib/logitechmediaserver/cache --logfile=syslog $LMS_OPTS
+
+[Install]
+WantedBy=network.target
diff --git a/media-sound/logitechmediaserver-bin/logitechmediaserver-bin-9999.ebuild b/media-sound/logitechmediaserver-bin/logitechmediaserver-bin-9999.ebuild
new file mode 100644
index 00000000..05d1907d
--- /dev/null
+++ b/media-sound/logitechmediaserver-bin/logitechmediaserver-bin-9999.ebuild
@@ -0,0 +1,338 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+MY_PN="${PN/-bin}"
+
+if [[ ${PV} == *_pre* ]] ; then
+ GIT_COMMIT="c17601c5892eaac40a359d1392e454ad5c69db9d"
+ SRC_URI="https://github.com/Logitech/slimserver/archive/${GIT_COMMIT}.zip"
+ HOMEPAGE="http://github.com/Logitech/slimserver"
+ S="${WORKDIR}/slimserver-${GIT_COMMIT}"
+ INHERIT_VCS=""
+ KEYWORDS="~amd64 ~x86"
+elif [[ ${PV} == "9999" ]] ; then
+ EGIT_BRANCH="public/7.9"
+ EGIT_REPO_URI="https://github.com/Logitech/slimserver.git"
+ HOMEPAGE="http://github.com/Logitech/slimserver"
+ S="${WORKDIR}/slimserver"
+ INHERIT_VCS="git-2"
+ KEYWORDS="~amd64 ~x86"
+else
+ SRC_DIR="LogitechMediaServer_v${PV}"
+ SRC_URI="http://downloads.slimdevices.com/${SRC_DIR}/${MY_P}.tgz"
+ HOMEPAGE="http://www.mysqueezebox.com/download"
+ BUILD_NUM="1375965195"
+ MY_PV="${PV/_*}"
+ MY_P_BUILD_NUM="${MY_PN}-${MY_PV}-${BUILD_NUM}"
+ MY_P="${MY_PN}-${MY_PV}"
+ S="${WORKDIR}/${MY_P_BUILD_NUM}"
+ INHERIT_VCS=""
+ KEYWORDS="~amd64 ~x86"
+fi
+
+inherit ${INHERIT_VCS} eutils user systemd
+
+DESCRIPTION="Server for Logitech Squeezebox players"
+LICENSE="${PN}"
+RESTRICT="bindist mirror"
+SLOT="0"
+IUSE="doc html systemd"
+
+LANGS="de en es fr he it nl"
+for lang in ${LANGS}; do
+ IUSE+=" l10n_${lang}"
+done
+unset lang
+
+# Installation dependencies.
+DEPEND="
+ !media-sound/squeezecenter
+ !media-sound/squeezeboxserver
+ app-arch/unzip
+ "
+
+# Runtime dependencies.
+RDEPEND="
+ !prefix? ( >=sys-apps/baselayout-2.0.0 )
+ !prefix? ( virtual/logger )
+ >=dev-lang/perl-5.10.0[ithreads]
+ x86? ( <dev-lang/perl-5.23[ithreads] )
+ amd64? ( <dev-lang/perl-5.23[ithreads] )
+ >=dev-perl/Data-UUID-1.202
+ "
+
+# This is a binary package and contains prebuilt executable and library
+# files. We need to identify those to suppress the QA warnings during
+# installation.
+QA_PREBUILT="
+*
+"
+
+RUN_UID=logitechmediaserver
+RUN_GID=logitechmediaserver
+
+# Installation locations
+OPTDIR="/opt/${MY_PN}"
+VARDIR="/var/lib/${MY_PN}"
+CACHEDIR="${VARDIR}/cache"
+USRPLUGINSDIR="${VARDIR}/Plugins"
+SVRPLUGINSDIR="${CACHEDIR}/InstalledPlugins"
+CLIENTPLAYLISTSDIR="${VARDIR}/ClientPlaylists"
+PREFSDIR="/etc/${MY_PN}"
+LOGDIR="/var/log/${MY_PN}"
+SVRPREFS="${PREFSDIR}/server.prefs"
+
+# Old Squeezebox Server file locations
+SBS_PREFSDIR='/etc/squeezeboxserver/prefs'
+SBS_SVRPREFS="${SBS_PREFSDIR}/server.prefs"
+SBS_VARLIBDIR='/var/lib/squeezeboxserver'
+SBS_SVRPLUGINSDIR="${SBS_VARLIBDIR}/cache/InstalledPlugins"
+SBS_USRPLUGINSDIR="${SBS_VARLIBDIR}/Plugins"
+
+pkg_setup() {
+ # Create the user and group if not already present
+ enewgroup ${RUN_GID}
+ enewuser ${RUN_UID} -1 -1 "/dev/null" ${RUN_GID}
+}
+
+src_prepare() {
+ # Apply patches to make LMS work on Gentoo.
+ epatch "${FILESDIR}/${P}-uuid-gentoo.patch"
+ epatch "${FILESDIR}/${P}-client-playlists-gentoo.patch"
+}
+
+src_install() {
+ local pv lang
+
+ # The custom OS module for Gentoo - provides OS-specific path details
+ cp "${FILESDIR}/gentoo-filepaths.pm" "Slim/Utils/OS/Custom.pm" || die "Unable to install Gentoo custom OS module"
+
+ # We're only keywording for amd64 and x86...
+ #
+ # Bin: armhf-linux arm-linux darwin i386-freebsd-64int i386-linux MSWin32-x86-multi-thread powerpc-linux sparc-linux x86_64-linux
+ # CPAN/arch/*: arm-linux-gnueabihf-thread-multi-64int arm-linux-gnueabi-thread-multi-64int i386-linux-thread-multi i386-linux-thread-multi-64int MSWin32-x86-multi-thread powerpc-linux-thread-multi-64int x86_64-linux-thread-multi darwin-thread-multi-2level i386-freebsd-64int sparc-linux
+ # CPAN/arch: 5.10 5.12 5.14 5.16 5.18 5.20 5.22 5.8
+ if use amd64; then
+ rm -r "${S}"/Bin/{armhf-linux,arm-linux,darwin,i386-freebsd-64int,i386-linux,MSWin32-x86-multi-thread,powerpc-linux,sparc-linux}
+ rm -r "${S}"/CPAN/arch/*/{arm-linux-gnueabihf-thread-multi-64int,arm-linux-gnueabi-thread-multi-64int,i386-linux-thread-multi,i386-linux-thread-multi-64int,MSWin32-x86-multi-thread,powerpc-linux-thread-multi-64int,darwin-thread-multi-2level,i386-freebsd-64int,sparc-linux} 2>/dev/null
+ #for pv in 5.8 5.10 5.12 5.14 5.16 5.18 5.20 5.22; do
+ for pv in $( ls -1 CPAN/arch/ ); do
+ if ! has_version "dev-lang/perl:0/${pv}"; then
+ rm -r CPAN/arch/"${pv}"
+ fi
+ done
+ fi
+ # Some files are incorrectly marked as being executable...
+ chmod 644 Firmware/*.{bin,version}
+ chmod 644 \
+ CPAN/DBI/Format/SQLMinus.pm \
+ CPAN/DBI/Shell/*.pm \
+ CPAN/DBI/Shell.pm \
+ CPAN/Log/Log4perl/Layout/PatternLayout/Multiline.pm \
+ CPAN/Net/UPnP/{AV,GW}/*.pm \
+ CPAN/Net/UPnP/*.pm \
+ CPAN/Net/UPnP.pm \
+ HTML/Default/html/images/*.png \
+ HTML/EN/html/ext/resources/images/default/form/*.gif \
+ HTML/EN/html/images/*.png \
+ HTML/EN/html/images/ServiceProviders/*.png \
+ Slim/Plugin/Favorites/HTML/EN/html/images/*.png \
+ Slim/Plugin/InternetRadio/HTML/EN/plugins/TuneIn/html/images/*.png \
+ Slim/Plugin/JiveExtras/HTML/EN/plugins/JiveExtras/settings/*.html \
+ Slim/Plugin/Live365/HTML/EN/plugins/Live365/html/images/icon.png \
+ Slim/Plugin/MP3tunes/HTML/EN/plugins/MP3tunes/html/images/icon.png \
+ Slim/Plugin/Pandora/HTML/EN/plugins/Pandora/html/images/icon.png \
+ Slim/Plugin/Podcast/HTML/EN/plugins/Podcast/html/images/icon.png \
+ Slim/Plugin/RandomPlay/HTML/EN/plugins/RandomPlay/html/images/icon.png \
+ Slim/Plugin/Slacker/HTML/EN/plugins/Slacker/html/images/icon.png
+
+ # Documentation
+ for lang in ${LANGS}; do
+ if use "l10n_${lang}"; then
+ if [[ 'en' == "${lang}" ]]; then
+ lang=''
+ else
+ lang+='.'
+ fi
+ if [[ -e "License.${lang}txt" ]]; then
+ rm "License.${lang}txt"
+ fi
+ fi
+ done
+
+ use html && dohtml Changelog*.html
+ if use doc; then
+ dodoc Installation.txt
+ dodoc License*.txt
+ fi
+ rm Changelog*.html
+ rm Installation.txt
+ rm License*.txt
+
+ # Everthing into our package in the /opt hierarchy (LHS)
+ dodir "${OPTDIR}"
+ cp -aR "${S}"/* "${ED}${OPTDIR}" || die "Unable to install package files"
+
+ dodoc "${FILESDIR}/Gentoo-plugins-README.txt"
+ dodoc "${FILESDIR}/Gentoo-detailed-changelog.txt"
+
+ # Preferences directory
+ dodir "${PREFSDIR}"
+ fowners ${RUN_UID}:${RUN_GID} "${PREFSDIR}"
+ fperms 770 "${PREFSDIR}"
+
+ # Install init scripts (OpenRC)
+ newconfd "${FILESDIR}/logitechmediaserver.conf.d" "${MY_PN}"
+ newinitd "${FILESDIR}/logitechmediaserver.init.d" "${MY_PN}"
+
+ # Install unit file (systemd)
+ use systemd && systemd_dounit "${FILESDIR}/${MY_PN}.service"
+
+ # Initialize server cache directory
+ dodir "${CACHEDIR}"
+ fowners ${RUN_UID}:${RUN_GID} "${CACHEDIR}"
+ fperms 770 "${CACHEDIR}"
+
+ # Initialize the log directory
+ dodir "${LOGDIR}"
+ fowners ${RUN_UID}:${RUN_GID} "${LOGDIR}"
+ fperms 770 "${LOGDIR}"
+ touch "${ED}/${LOGDIR}/server.log"
+ touch "${ED}/${LOGDIR}/scanner.log"
+ touch "${ED}/${LOGDIR}/perfmon.log"
+ fowners ${RUN_UID}:${RUN_GID} "${LOGDIR}/server.log"
+ fowners ${RUN_UID}:${RUN_GID} "${LOGDIR}/scanner.log"
+ fowners ${RUN_UID}:${RUN_GID} "${LOGDIR}/perfmon.log"
+
+ # Initialise the user-installed plugins directory
+ dodir "${USRPLUGINSDIR}"
+ fowners ${RUN_UID}:${RUN_GID} "${USRPLUGINSDIR}"
+ fperms 770 "${USRPLUGINSDIR}"
+
+ # Initialise the client playlists directory
+ dodir "${CLIENTPLAYLISTSDIR}"
+ fowners ${RUN_UID}:${RUN_GID} "${CLIENTPLAYLISTSDIR}"
+ fperms 770 "${CLIENTPLAYLISTSDIR}"
+
+ # Install logrotate support
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/logitechmediaserver.logrotate.d" "${MY_PN}"
+}
+
+lms_starting_instr() {
+ elog "Logitech Media Server can be started with the following command (OpenRC):"
+ elog "\t/etc/init.d/logitechmediaserver start"
+ if use systemd; then
+ elog "or (systemd):"
+ elog "\tsystemctl start logitechmediaserver"
+ fi
+ elog ""
+ elog "Logitech Media Server can be automatically started on each boot"
+ elog "with the following command (OpenRC):"
+ elog "\trc-update add logitechmediaserver default"
+ if use systemd; then
+ elog "or (systemd):"
+ elog "\tsystemctl enable logitechmediaserver"
+ fi
+ elog ""
+ elog "You might want to examine and modify the following configuration"
+ elog "file before starting Logitech Media Server:"
+ elog "\t/etc/conf.d/logitechmediaserver"
+ elog ""
+
+ # Discover the port number from the preferences, but if it isn't there
+ # then report the standard one.
+ httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${SVRPREFS}" 2>/dev/null)
+ elog "You may access and configure Logitech Media Server by browsing to:"
+ elog "\thttp://localhost:${httpport:-9000}/"
+ elog ""
+}
+
+pkg_postinst() {
+ # Point user to database configuration step, if an old installation
+ # of SBS is found.
+ if [ -f "${SBS_SVRPREFS}" ]; then
+ elog "If this is a new installation of Logitech Media Server and you"
+ elog "previously used Squeezebox Server (media-sound/squeezeboxserver)"
+ elog "then you may migrate your previous preferences and plugins by"
+ elog "running the following command (note that this will overwrite any"
+ elog "current preferences and plugins):"
+ elog "\temerge --config =${CATEGORY}/${PF}"
+ elog ""
+ fi
+
+ # Tell use user where they should put any manually-installed plugins.
+ elog "Manually installed plugins should be placed in the following"
+ elog "directory:"
+ elog "\t${USRPLUGINSDIR}"
+ elog ""
+
+ # Show some instructions on starting and accessing the server.
+ lms_starting_instr
+}
+
+lms_remove_db_prefs() {
+ MY_PREFS=$1
+
+ einfo "Correcting database connection configuration:"
+ einfo "\t${MY_PREFS}"
+ TMPPREFS="${T}"/lmsserver-prefs-$$
+ touch "${EROOT}${MY_PREFS}"
+ sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${EROOT}${MY_PREFS}" > "${TMPPREFS}"
+ mv "${TMPPREFS}" "${EROOT}${MY_PREFS}"
+ chown ${RUN_UID}:${RUN_GID} "${EROOT}${MY_PREFS}"
+ chmod 660 "${EROOT}${MY_PREFS}"
+}
+
+pkg_config() {
+ einfo "Press ENTER to migrate any preferences from a previous installation of"
+ einfo "Squeezebox Server (media-sound/squeezeboxserver) to this installation"
+ einfo "of Logitech Media Server."
+ einfo ""
+ einfo "Note that this will remove any current preferences and plugins and"
+ einfo "therefore you should take a backup if you wish to preseve any files"
+ einfo "from this current Logitech Media Server installation."
+ einfo ""
+ einfo "Alternatively, press Control-C to abort now..."
+ read
+
+ # Preferences.
+ einfo "Migrating previous Squeezebox Server configuration:"
+ if [ -f "${SBS_SVRPREFS}" ]; then
+ [ -d "${EROOT}${PREFSDIR}" ] && rm -rf "${EROOT}${PREFSDIR}"
+ einfo "\tPreferences (${SBS_PREFSDIR})"
+ cp -r "${EROOT}${SBS_PREFSDIR}" "${EROOT}${PREFSDIR}"
+ chown -R ${RUN_UID}:${RUN_GID} "${EROOT}${PREFSDIR}"
+ chmod -R u+w,g+w "${EROOT}${PREFSDIR}"
+ chmod 770 "${EROOT}${PREFSDIR}"
+ fi
+
+ # Plugins installed through the built-in extension manager.
+ if [ -d "${EROOT}${SBS_SVRPLUGINSDIR}" ]; then
+ einfo "\tServer plugins (${SBS_SVRPLUGINSDIR})"
+ [ -d "${EROOT}${SVRPLUGINSDIR}" ] && rm -rf "${EROOT}${SVRPLUGINSDIR}"
+ cp -r "${EROOT}${SBS_SVRPLUGINSDIR}" "${EROOT}${SVRPLUGINSDIR}"
+ chown -R ${RUN_UID}:${RUN_GID} "${EROOT}${SVRPLUGINSDIR}"
+ chmod -R u+w,g+w "${EROOT}${SVRPLUGINSDIR}"
+ chmod 770 "${EROOT}${SVRPLUGINSDIR}"
+ fi
+
+ # Plugins manually installed by the user.
+ if [ -d "${EROOT}${SBS_USRPLUGINSDIR}" ]; then
+ einfo "\tUser plugins (${SBS_USRPLUGINSDIR})"
+ [ -d "${EROOT}${USRPLUGINSDIR}" ] && rm -rf "${EROOT}${USRPLUGINSDIR}"
+ cp -r "${EROOT}${SBS_USRPLUGINSDIR}" "${EROOT}${USRPLUGINSDIR}"
+ chown -R ${RUN_UID}:${RUN_GID} "${EROOT}${USRPLUGINSDIR}"
+ chmod -R u+w,g+w "${EROOT}${USRPLUGINSDIR}"
+ chmod 770 "${EROOT}${USRPLUGINSDIR}"
+ fi
+
+ # Remove the existing MySQL preferences from Squeezebox Server (if any).
+ lms_remove_db_prefs "${SVRPREFS}"
+
+ # Phew - all done. Give some tips on what to do now.
+ einfo "Done."
+ einfo ""
+}