diff options
author | Joe Peterson <lavajoe@gentoo.org> | 2009-11-25 22:52:26 +0000 |
---|---|---|
committer | Joe Peterson <lavajoe@gentoo.org> | 2009-11-25 22:52:26 +0000 |
commit | aa391c07c51dc050df52e7943380d95499c01382 (patch) | |
tree | f0e2eb1bc498b5c2f38f77fe0127485f70bd0151 /media-sound | |
parent | amd64 stable, bug #294264 (diff) | |
download | gentoo-2-aa391c07c51dc050df52e7943380d95499c01382.tar.gz gentoo-2-aa391c07c51dc050df52e7943380d95499c01382.tar.bz2 gentoo-2-aa391c07c51dc050df52e7943380d95499c01382.zip |
New package that replaces media-sound/squeezecenter
(Portage version: 2.1.7.1/cvs/Linux x86_64)
Diffstat (limited to 'media-sound')
14 files changed, 1432 insertions, 0 deletions
diff --git a/media-sound/squeezeboxserver/ChangeLog b/media-sound/squeezeboxserver/ChangeLog new file mode 100644 index 000000000000..caee5312c436 --- /dev/null +++ b/media-sound/squeezeboxserver/ChangeLog @@ -0,0 +1,17 @@ +# ChangeLog for media-sound/squeezeboxserver +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v 1.1 2009/11/25 22:52:26 lavajoe Exp $ + +*squeezeboxserver-7.4.1 (25 Nov 2009) + + 25 Nov 2009; Joe Peterson <lavajoe@gentoo.org> + +squeezeboxserver-7.4.1.ebuild, + +files/squeezeboxserver-7.4.1-build-perl-modules-gentoo.patch, + +files/Gentoo-plugins-README.txt, +files/avahi-squeezeboxserver.service, + +files/build-modules.sh, +files/dbcreate-gentoo.sql, + +files/dbdrop-gentoo.sql, +files/gentoo-filepaths.pm, + +files/squeezeboxserver.conf.d, +files/squeezeboxserver.init.d, + +files/squeezeboxserver.logrotate.d, +files/squeezeboxserver.prefs, + +metadata.xml: + New package that replaces media-sound/squeezecenter + diff --git a/media-sound/squeezeboxserver/files/Gentoo-plugins-README.txt b/media-sound/squeezeboxserver/files/Gentoo-plugins-README.txt new file mode 100644 index 000000000000..4b29b8ee53af --- /dev/null +++ b/media-sound/squeezeboxserver/files/Gentoo-plugins-README.txt @@ -0,0 +1,25 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/files/Gentoo-plugins-README.txt,v 1.1 2009/11/25 22:52:25 lavajoe Exp $ + +The standard Squeezebox 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. + +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/squeezeboxserver/Plugins +* Extension binaries (which sometimes accompany plugins) should be installed + into the directory: + /usr/lib/squeezeboxserver/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/squeezeboxserver/files/avahi-squeezeboxserver.service b/media-sound/squeezeboxserver/files/avahi-squeezeboxserver.service new file mode 100644 index 000000000000..8b9bdff7aedf --- /dev/null +++ b/media-sound/squeezeboxserver/files/avahi-squeezeboxserver.service @@ -0,0 +1,18 @@ +<?xml version="1.0" standalone='no'?><!--*-nxml-*--> +<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> + +<service-group> + + <name>Squeezebox Server</name> + + <service> + <type>_http._tcp</type> + <port>9000</port> + </service> + + <service> + <type>_slimhttp._tcp</type> + <port>9000</port> + </service> + +</service-group> diff --git a/media-sound/squeezeboxserver/files/build-modules.sh b/media-sound/squeezeboxserver/files/build-modules.sh new file mode 100755 index 000000000000..ecfa8d43bd81 --- /dev/null +++ b/media-sound/squeezeboxserver/files/build-modules.sh @@ -0,0 +1,577 @@ +#!/bin/bash +# +# $Id: build-modules.sh,v 1.1 2009/11/25 22:52:25 lavajoe Exp $ +# +# This script builds all binary Perl modules required by Squeezebox Server. +# +# Supported OSes: +# +# Linux (Perl 5.8.8 & 5.10.0) +# i386/x86_64 Linux +# ARM Linux +# PowerPC Linux +# Mac OSX 10.5, 10.6, (Perl 5.8.8 & 5.10.0) +# Under 10.5, builds Universal Binaries for i386/ppc +# Under 10.6, builds Universal Binaries for i386/x86_64 +# FreeBSD 7.2 (Perl 5.8.9) + +DISTDIR="$1"; shift + +OS=`uname` + +# get system arch, stripping out extra -gnu on Linux +ARCH=`/usr/bin/perl -MConfig -le 'print $Config{archname}' | sed 's/gnu-//' | sed 's/^i[3456]86-/i386-/' ` + +if [ $OS = "Linux" -o $OS = "Darwin" -o $OS = "FreeBSD" ]; then + echo "Building for $OS / $ARCH" +else + echo "Unsupported platform: $OS, please submit a patch or provide us with access to a development system." + exit +fi + +# Build dir +BUILD=$PWD + +# Path to Perl 5.8.8 +if [ -x "/usr/bin/perl5.8.8" ]; then + PERL_58=/usr/bin/perl5.8.8 +elif [ -x "/usr/local/bin/perl5.8.8" ]; then + PERL_58=/usr/local/bin/perl5.8.8 +elif [ -x "/usr/local/bin/perl5.8.9" ]; then # FreeBSD 7.2 + PERL_58=/usr/local/bin/perl5.8.9 +fi + +if [ $PERL_58 ]; then + echo "Building with Perl 5.8.x at $PERL_58" +fi + +# Install dir for 5.8 +BASE_58=$BUILD/5.8 + +# Path to Perl 5.10.0 +if [ -x "/usr/bin/perl5.10.0" ]; then + PERL_510=/usr/bin/perl5.10.0 +elif [ -x "/usr/local/bin/perl5.10.0" ]; then + PERL_510=/usr/local/bin/perl5.10.0 +fi + +if [ $PERL_510 ]; then + echo "Building with Perl 5.10 at $PERL_510" +fi + +# Install dir for 5.10 +BASE_510=$BUILD/5.10 + +# Require modules to pass tests +RUN_TESTS=1 + +FLAGS="" +# Mac-specific flags +if [ $OS = "Darwin" ]; then + if [ $PERL_58 ]; then + # build 32-bit version + FLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" + elif [ $PERL_510 ]; then + # Build 64-bit version + FLAGS="-arch x86_64 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" + fi +fi + +# FreeBSD's make sucks +if [ $OS = "FreeBSD" ]; then + if [ !-x /usr/local/bin/gmake ]; then + echo "ERROR: Please install GNU make (gmake)" + exit + fi + export GNUMAKE=/usr/local/bin/gmake + export MAKE=/usr/local/bin/gmake +else + export MAKE=/usr/bin/make +fi + +# Clean up +# XXX command-line flag to skip cleanup +#rm -rf $BUILD + +#mkdir $BUILD + +# $1 = module to build +# $2 = Makefile.PL arg(s) +function build_module { + tar zxvf $DISTDIR/SqueezeboxServer-$1.tar.gz || exit 1 + cd $1 +# cp -R ../hints . + if [ $PERL_58 ]; then + # Running 5.8 + export PERL5LIB=$BASE_58/lib/perl5 + + $PERL_58 Makefile.PL PREFIX=$BASE_58 $2 + if [ $RUN_TESTS -eq 1 ]; then + make test + else + make + fi + if [ $? != 0 ]; then + if [ $RUN_TESTS -eq 1 ]; then + echo "make test failed, aborting" + else + echo "make failed, aborting" + fi + exit $? + fi + make install || exit 1 + make clean || exit 1 + fi + if [ $PERL_510 ]; then + # Running 5.10 + export PERL5LIB=$BASE_510/lib/perl5 + + $PERL_510 Makefile.PL PREFIX=$BASE_510 $2 + if [ $RUN_TESTS -eq 1 ]; then + make test + else + make + fi + if [ $? != 0 ]; then + if [ $RUN_TESTS -eq 1 ]; then + echo "make test failed, aborting" + else + echo "make failed, aborting" + fi + exit $? + fi + make install || exit 1 + fi + cd .. + rm -rf $1 +} + +function build_all { + build Audio::Scan +# build AutoXS::Header +# build Class::C3::XS +# build Class::XSAccessor +# build Class::XSAccessor::Array +# build Compress::Raw::Zlib +# build DBI +# build DBD::mysql +# build Digest::SHA1 + build EV +# build Encode::Detect +# build GD +# build HTML::Parser +# build JSON::XS +# build Locale::Hebrew +# build Sub::Name +# build Template +# build XML::Parser +# build YAML::Syck +} + +function build { + case "$1" in + AutoXS::Header) + # AutoXS::Header support module + build_module AutoXS-Header-1.02 + ;; + + Class::C3::XS) + if [ $PERL_58 ]; then + build_module Class-C3-XS-0.11 + fi + ;; + + Class::XSAccessor) + build_module Class-XSAccessor-1.03 + ;; + + Class::XSAccessor::Array) + build_module Class-XSAccessor-Array-1.04 + ;; + + Compress::Raw::Zlib) + build_module Compress-Raw-Zlib-2.017 + ;; + + DBI) + build_module DBI-1.608 + ;; + + Digest::SHA1) + build_module Digest-SHA1-2.11 + ;; + + EV) +# build_module common-sense-2.0 + + export PERL_MM_USE_DEFAULT=1 + RUN_TESTS=0 + build_module EV-3.8 + RUN_TESTS=1 + export PERL_MM_USE_DEFAULT= + ;; + + Encode::Detect) + build_module Data-Dump-1.15 + build_module ExtUtils-CBuilder-0.260301 + RUN_TESTS=0 + build_module Module-Build-0.35 + RUN_TESTS=1 + build_module Encode-Detect-1.00 + ;; + + HTML::Parser) + build_module HTML-Tagset-3.20 + build_module HTML-Parser-3.60 + ;; + + JSON::XS) + build_module JSON-XS-2.232 + ;; + + Locale::Hebrew) + build_module Locale-Hebrew-1.04 + ;; + + Sub::Name) + build_module Sub-Name-0.04 + ;; + + YAML::Syck) + build_module YAML-Syck-1.05 + ;; + + Audio::Scan) + build_module Audio-Scan-0.45 + ;; + + Template) + # Template, custom build due to 2 Makefile.PL's + tar zxvf Template-Toolkit-2.21.tar.gz + cd Template-Toolkit-2.21 + cp -R ../hints . + cp -R ../hints ./xs + if [ $PERL_58 ]; then + # Running 5.8 + $PERL_58 Makefile.PL PREFIX=$BASE_58 TT_ACCEPT=y TT_EXAMPLES=n TT_EXTRAS=n + make # minor test failure, so don't test + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + make clean + fi + if [ $PERL_510 ]; then + # Running 5.10 + $PERL_510 Makefile.PL PREFIX=$BASE_510 TT_ACCEPT=y TT_EXAMPLES=n TT_EXTRAS=n + make # minor test failure, so don't test + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + fi + cd .. + rm -rf Template-Toolkit-2.21 + ;; + + DBD::mysql) + # Build libmysqlclient + tar jxvf mysql-5.1.37.tar.bz2 + cd mysql-5.1.37 + CC=gcc CXX=gcc \ + CFLAGS="-O3 -fno-omit-frame-pointer $FLAGS" \ + CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti $FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking \ + --enable-thread-safe-client \ + --without-server --disable-shared --without-docs --without-man + make + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + rm -rf mysql-5.1.37 + + # DBD::mysql custom, statically linked with libmysqlclient + tar zxvf DBD-mysql-3.0002.tar.gz + cd DBD-mysql-3.0002 + cp -R ../hints . + mkdir mysql-static + cp $BUILD/lib/mysql/libmysqlclient.a mysql-static + if [ $PERL_58 ]; then + # Running 5.8 + export PERL5LIB=$BASE_58/lib/perl5 + + $PERL_58 Makefile.PL --mysql_config=$BUILD/bin/mysql_config --libs="-Lmysql-static -lmysqlclient -lz -lm" PREFIX=$BASE_58 + make + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + make clean + fi + if [ $PERL_510 ]; then + # Running 5.10 + export PERL5LIB=$BASE_510/lib/perl5 + + $PERL_510 Makefile.PL --mysql_config=$BUILD/bin/mysql_config --libs="-Lmysql-static -lmysqlclient -lz -lm" PREFIX=$BASE_510 + make + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + fi + cd .. + rm -rf DBD-mysql-3.0002 + ;; + + XML::Parser) + # build expat + tar zxvf expat-2.0.1.tar.gz + cd expat-2.0.1 + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking + make + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + + # Symlink static versions of libraries to avoid OSX linker choosing dynamic versions + cd build/lib + ln -sf libexpat.a libexpat_s.a + cd ../.. + + # XML::Parser custom, built against expat + tar zxvf XML-Parser-2.36.tar.gz + cd XML-Parser-2.36 + cp -R ../hints . + cp -R ../hints ./Expat # needed for second Makefile.PL + patch -p0 < ../XML-Parser-Expat-Makefile.patch + if [ $PERL_58 ]; then + # Running 5.8 + $PERL_58 Makefile.PL PREFIX=$BASE_58 EXPATLIBPATH=$BUILD/lib EXPATINCPATH=$BUILD/include + make test + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + make clean + fi + if [ $PERL_510 ]; then + # Running 5.10 + $PERL_510 Makefile.PL PREFIX=$BASE_510 EXPATLIBPATH=$BUILD/lib EXPATINCPATH=$BUILD/include + make test + if [ $? != 0 ]; then + echo "make failed, aborting" + exit $? + fi + make install + fi + cd .. + rm -rf XML-Parser-2.36 + rm -rf expat-2.0.1 + ;; + + GD) + # build libjpeg + # Makefile doesn't create directories properly, so make sure they exist + # Note none of these directories are deleted until GD is built + mkdir -p build/bin build/lib build/include build/man/man1 + tar zxvf jpegsrc.v6b.tar.gz + cd jpeg-6b + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking + make && make test + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install-lib + cd .. + + # build libpng + tar zxvf libpng-1.2.39.tar.gz + cd libpng-1.2.39 + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking + make && make test + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + + # build freetype + tar zxvf freetype-2.3.9.tar.gz + cd freetype-2.3.9 + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking + patch -p0 < ../freetype-arm-asm.patch # patch to fix ARM asm + $MAKE + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + $MAKE install + cd .. + + # build expat + tar zxvf expat-2.0.1.tar.gz + cd expat-2.0.1 + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking + make + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + + # build fontconfig + tar zxvf fontconfig-2.6.0.tar.gz + cd fontconfig-2.6.0 + CFLAGS="$FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking --disable-docs \ + --with-expat-includes=$BUILD/include --with-expat-lib=$BUILD/lib \ + --with-freetype-config=$BUILD/bin/freetype-config + make + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + + # build gd + tar zxvf gd-2.0.35.tar.gz + cd gd-2.0.35 + # gd's configure is really dumb, adjust PATH so it can find the correct libpng config scripts + # and need to manually specify include dir + PATH="$BUILD/bin:$PATH" \ + CFLAGS="-I$BUILD/include $FLAGS" \ + LDFLAGS="$FLAGS" \ + ./configure --prefix=$BUILD \ + --disable-dependency-tracking --without-xpm --without-x \ + --with-libiconv-prefix=/usr \ + --with-jpeg=$BUILD \ + --with-png=$BUILD \ + --with-freetype=$BUILD \ + --with-fontconfig=$BUILD + make + if [ $? != 0 ]; then + echo "make failed" + exit $? + fi + make install + cd .. + + # Symlink static versions of libraries to avoid OSX linker choosing dynamic versions + cd build/lib + ln -sf libexpat.a libexpat_s.a + ln -sf libjpeg.a libjpeg_s.a + ln -sf libpng12.a libpng12_s.a + ln -sf libgd.a libgd_s.a + ln -sf libfontconfig.a libfontconfig_s.a + ln -sf libfreetype.a libfreetype_s.a + cd ../.. + + # GD + tar zxvf GD-2.41.tar.gz + cd GD-2.41 + patch -p0 < ../GD-Makefile.patch # patch to build statically + cp -R ../hints . + if [ $PERL_58 ]; then + # Running 5.8 + PATH="$BUILD/bin:$PATH" \ + $PERL_58 Makefile.PL PREFIX=$BASE_58 + + make test + if [ $? != 0 ]; then + echo "make test failed, aborting" + exit $? + fi + make install + make clean + fi + if [ $PERL_510 ]; then + # Running 5.10 + PATH="$BUILD/bin:$PATH" \ + $PERL_510 Makefile.PL PREFIX=$BASE_510 + + make test + if [ $? != 0 ]; then + echo "make test failed, aborting" + exit $? + fi + make install + fi + + cd .. + rm -rf GD-2.41 + rm -rf gd-2.0.35 + rm -rf fontconfig-2.6.0 + rm -rf expat-2.0.1 + rm -rf freetype-2.3.9 + rm -rf libpng-1.2.39 + rm -rf jpeg-6b + ;; + esac +} + +# Build a single module if requested, or all +if [ $1 ]; then + build $1 +else + build_all +fi + +# Reset PERL5LIB +export PERL5LIB= + +# clean out useless .bs/.packlist files, etc +find $BUILD -name '*.bs' -exec rm -f {} \; +find $BUILD -name '*.packlist' -exec rm -f {} \; + +# create our directory structure +# XXX there is still some crap left in here by some modules such as DBI, GD +if [ $PERL_58 ]; then + mkdir -p $BUILD/CPAN-arch/5.8/$ARCH + mkdir -p $BUILD/CPAN-pm + mv $BASE_58/lib*/perl5/site_perl/*/*/auto $BUILD/CPAN-arch/5.8/$ARCH/ + mv $BASE_58/lib*/perl5/site_perl/*/*/* $BUILD/CPAN-pm +fi +if [ $PERL_510 ]; then + mkdir -p $BUILD/CPAN-arch/5.10/$ARCH + mkdir -p $BUILD/CPAN-pm + mv $BASE_510/lib*/perl5/site_perl/*/*/auto $BUILD/CPAN-arch/5.10/$ARCH/ + mv $BASE_510/lib*/perl5/site_perl/*/*/* $BUILD/CPAN-pm +fi + +# could remove rest of build data, but let's leave it around in case +#rm -rf $BASE_58 +#rm -rf $BASE_510 +#rm -rf $BUILD/bin $BUILD/etc $BUILD/include $BUILD/lib $BUILD/man $BUILD/share $BUILD/var diff --git a/media-sound/squeezeboxserver/files/dbcreate-gentoo.sql b/media-sound/squeezeboxserver/files/dbcreate-gentoo.sql new file mode 100644 index 000000000000..939b75a90bad --- /dev/null +++ b/media-sound/squeezeboxserver/files/dbcreate-gentoo.sql @@ -0,0 +1,6 @@ +CREATE DATABASE __DATABASE__; + +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER + ON *.* + TO '__DBUSER__'@'localhost' + IDENTIFIED BY '__DBPASSWORD__' diff --git a/media-sound/squeezeboxserver/files/dbdrop-gentoo.sql b/media-sound/squeezeboxserver/files/dbdrop-gentoo.sql new file mode 100644 index 000000000000..1d3bc8d696aa --- /dev/null +++ b/media-sound/squeezeboxserver/files/dbdrop-gentoo.sql @@ -0,0 +1,2 @@ +DROP DATABASE __DATABASE__; +DROP USER '__DBUSER__'@'localhost'; diff --git a/media-sound/squeezeboxserver/files/gentoo-filepaths.pm b/media-sound/squeezeboxserver/files/gentoo-filepaths.pm new file mode 100644 index 000000000000..dae66c4afa23 --- /dev/null +++ b/media-sound/squeezeboxserver/files/gentoo-filepaths.pm @@ -0,0 +1,120 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/files/gentoo-filepaths.pm,v 1.1 2009/11/25 22:52:25 lavajoe Exp $ + +# This file contains a custom OS package to provide information on the +# installation structure on Gentoo. It is based on the Debian OS equivalent +# that is built into SqueezeCenter. + +package Slim::Utils::OS::Custom; + +use strict; +use File::Spec::Functions qw(:ALL); +use FindBin qw($Bin); +use Config; + +use base qw(Slim::Utils::OS::Linux); + +sub initDetails { + my $class = shift; + + $class->{osDetails} = $class->SUPER::initDetails(); + + $class->{osDetails}->{isGentoo} = 1 ; + + # Make sure we can find any CPAN modules packaged with Squeezebox Server. + unshift @INC, '/usr/share/squeezeboxserver/CPAN'; + + # Make sure plugin files are found. + push @INC, '/var/lib/squeezeboxserver'; + + return $class->{osDetails}; +} + +=head2 dirsFor( $dir ) + +Return OS Specific directories. + +Argument $dir is a string to indicate which of the Squeezebox Server directories we +need information for. + +=cut + +sub dirsFor { + my ($class, $dir) = @_; + + my @dirs = (); + + if ($dir =~ /^(?:oldprefs|updates)$/) { + + push @dirs, $class->SUPER::dirsFor($dir); + + } elsif ($dir =~ /^(?:Firmware|Graphics|HTML|IR|MySQL|SQL|lib|Bin)$/) { + + push @dirs, "/usr/share/squeezeboxserver/$dir"; + + } elsif ($dir eq 'Plugins') { + + push @dirs, $class->SUPER::dirsFor($dir); + push @dirs, "/var/lib/squeezeboxserver/Plugins", "/usr/lib/" . $Config{'package'} . "/vendor_perl/" . $Config{'version'} . "/Slim/Plugin"; + + } elsif ($dir =~ /^(?:strings|revision)$/) { + + push @dirs, "/usr/share/squeezeboxserver"; + + } elsif ($dir eq 'libpath') { + + push @dirs, "/usr/lib/squeezeboxserver"; + + # Because we use the system MySQL, we need to point to the right + # directory for the errmsg. files. Default to english. + } elsif ($dir eq 'mysql-language') { + + push @dirs, "/usr/share/mysql/english"; + + } elsif ($dir =~ /^(?:types|convert)$/) { + + push @dirs, "/etc/squeezeboxserver"; + + } elsif ($dir =~ /^(?:prefs)$/) { + + push @dirs, $::prefsdir || "/var/lib/squeezeboxserver/prefs"; + + } elsif ($dir eq 'log') { + + push @dirs, $::logdir || "/var/log/squeezeboxserver"; + + } elsif ($dir eq 'cache') { + + push @dirs, $::cachedir || "/var/lib/squeezeboxserver/cache"; + + } elsif ($dir =~ /^(?:music|playlists)$/) { + + push @dirs, ''; + + } else { + + warn "dirsFor: Didn't find a match request: [$dir]\n"; + } + + return wantarray() ? @dirs : $dirs[0]; +} + +# Bug 9488, always decode on Ubuntu/Debian +sub decodeExternalHelperPath { + return Slim::Utils::Unicode::utf8decode_locale($_[1]); +} + +sub scanner { + return '/usr/sbin/squeezeboxserver-scanner'; +} + + +1; + + + + +1; + +__END__ diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver-7.4.1-build-perl-modules-gentoo.patch b/media-sound/squeezeboxserver/files/squeezeboxserver-7.4.1-build-perl-modules-gentoo.patch new file mode 100644 index 000000000000..8f763c75df71 --- /dev/null +++ b/media-sound/squeezeboxserver/files/squeezeboxserver-7.4.1-build-perl-modules-gentoo.patch @@ -0,0 +1,25 @@ +--- Slim/bootstrap.pm~ 2009-10-20 08:56:41.000000000 -0600 ++++ Slim/bootstrap.pm 2009-11-25 15:36:14.000000000 -0700 +@@ -193,22 +193,6 @@ sub loadModules { + print "To run from source on Windows, please install ActivePerl 5.10. ActivePerl 5.8.8 is no longer supported.\n"; + print "http://www.activestate.com/activeperl/\n\n"; + } +- else { +- print qq{ +-******* +- +-NOTE: +- +-Please use the buildme.sh script located here: +-http://svn.slimdevices.com/repos/slim/7.4/trunk/vendor/CPAN/ +- +-If 7.4 is outdated by the time you read this, Replace "7.4" with the major version +-of Squeezebox Server you are running. +- +-******* +- +- \n}; +- } + + print "Exiting..\n"; + diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver.conf.d b/media-sound/squeezeboxserver/files/squeezeboxserver.conf.d new file mode 100644 index 000000000000..5948fd49b253 --- /dev/null +++ b/media-sound/squeezeboxserver/files/squeezeboxserver.conf.d @@ -0,0 +1,24 @@ +# /etc/conf.d/squeezeboxserver + +# Niceness level for the Squeezebox Server process. If not specified then the +# default is to run at standard priority. Uncomment the following to run at a +# high priority (in order to try to minimise drop-outs due to audio starvation +# of the players). Note that this requires "OpenRC", which will become the +# standard init system for Gentoo at some point. If you are not using OpenRC +# yet, this setting will have no effect: +#SBS_NICENESS=-10 + +# Default path of your music library and playlists. You can leave these +# undefined and configure them through the web interface instead. +#SBS_DIR=/mnt/media/Music +#SBS_PLAYLISTS_DIR=/mnt/media/Playlists + +# 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 "squeezeboxserver --help" for a full list of possible options, +# but note that many of them are supplied by /etc/init.d/squeezeboxserver +# and so don't need to be present here. +#SBS_OPTS="--d_startup" +SBS_OPTS="" diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver.init.d b/media-sound/squeezeboxserver/files/squeezeboxserver.init.d new file mode 100755 index 000000000000..7bd376fcbc55 --- /dev/null +++ b/media-sound/squeezeboxserver/files/squeezeboxserver.init.d @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/files/squeezeboxserver.init.d,v 1.1 2009/11/25 22:52:25 lavajoe Exp $ + +# These fit the Squeezebox Server ebuild and so shouldn't need to be changed; +# user-servicable parts go in /etc/conf.d/squeezeboxserver. +pidfile=/var/run/squeezeboxserver/squeezeboxserver.pid +logdir=/var/log/squeezeboxserver +varlibdir=/var/lib/squeezeboxserver +prefsdir=${varlibdir}/prefs +cachedir=${varlibdir}/cache +prefsfile=${prefsdir}/squeezeboxserver.prefs +scuser=squeezeboxserver +scname=squeezeboxserver + +depend() { + need net mysql +} + +start() { + ebegin "Starting Squeezebox Server" + + cd / + start-stop-daemon \ + --start --exec /usr/bin/perl /usr/sbin/${scname} \ + --pidfile ${pidfile} \ + --startas /usr/sbin/${scname} \ + --chuid ${scuser} \ + -- \ + --quiet --daemon \ + --pidfile=${pidfile} \ + --cachedir=${cachedir} \ + --prefsfile=${prefsfile} \ + --prefsdir=${prefsdir} \ + --logdir=${logdir} \ + --audiodir=${SBS_MUSIC_DIR} \ + --playlistdir=${SBS_PLAYLISTS_DIR} \ + ${SBS_OPTS} + + eend $? "Failed to start Squeezebox Server" +} + +stop() { + ebegin "Stopping Squeezebox Server" + start-stop-daemon -o --stop --pidfile ${pidfile} + eend $? "Failed to stop Squeezebox Server" +} diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver.logrotate.d b/media-sound/squeezeboxserver/files/squeezeboxserver.logrotate.d new file mode 100644 index 000000000000..21b7c388f8fd --- /dev/null +++ b/media-sound/squeezeboxserver/files/squeezeboxserver.logrotate.d @@ -0,0 +1,11 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/files/squeezeboxserver.logrotate.d,v 1.1 2009/11/25 22:52:25 lavajoe Exp $ + +/var/log/squeezeboxserver/scanner.log /var/log/squeezeboxserver/server.log /var/log/squeezeboxserver/perfmon.log { + missingok + notifempty + copytruncate + rotate 5 + size 100k +} diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver.prefs b/media-sound/squeezeboxserver/files/squeezeboxserver.prefs new file mode 100644 index 000000000000..be8484b9cad8 --- /dev/null +++ b/media-sound/squeezeboxserver/files/squeezeboxserver.prefs @@ -0,0 +1,3 @@ +dbusername: squeezeboxserver +dbpassword: TBA +dbsource: dbi:mysql:database=squeezeboxserver;mysql_socket=/var/run/mysqld/mysqld.sock diff --git a/media-sound/squeezeboxserver/metadata.xml b/media-sound/squeezeboxserver/metadata.xml new file mode 100644 index 000000000000..01812b5df564 --- /dev/null +++ b/media-sound/squeezeboxserver/metadata.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>no-herd</herd> + <maintainer> + <email>lavajoe@gentoo.org</email> + </maintainer> + <maintainer> + <email>stuart@hickinbottom.com</email> + <name>Stuart Hickinbottom</name> + </maintainer> + <longdescription lang="en"> + This package provides the Logitech Squeezebox Server audio server. + Squeezebox Server will allow access to your audio collection over local + and wide-area networks, as well as serving content to the Logitech + Squeezebox and Transporter streaming media players. In addition to + local content, Squeezebox Server will also provide access to internet + radio and audio podcasts. + </longdescription> + <use> + <flag name='alac'>Enable support for alac</flag> + <flag name='bonjour'>Enable support for bonjour</flag> + </use> +</pkgmetadata> diff --git a/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild b/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild new file mode 100644 index 000000000000..58b341a8b8f9 --- /dev/null +++ b/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild @@ -0,0 +1,532 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.4.1.ebuild,v 1.1 2009/11/25 22:52:26 lavajoe Exp $ + +inherit eutils + +MAJOR_VER="${PV:0:3}" +MINOR_VER="${PV:4:1}" +BUILD_NUM="28947" +SRC_DIR="SqueezeboxServer_v${MAJOR_VER}.${MINOR_VER}" +MY_P="squeezeboxserver-${MAJOR_VER}.${MINOR_VER}-noCPAN" +MY_P_BUILD_NUM="squeezeboxserver-${MAJOR_VER}.${MINOR_VER}-${BUILD_NUM}-noCPAN" + +DESCRIPTION="Logitech SqueezeboxServer music server" +HOMEPAGE="http://www.logitechsqueezebox.com/support/download-squeezebox-server.html" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="lame wavpack musepack alac ogg flac avahi aac bonjour" + +# Note: Audio::Scan and EV present because of bug#287264 and bug#287857. +SRC_URI="http://www.slimdevices.com/downloads/${SRC_DIR}/${MY_P}.tgz + mirror://gentoo/SqueezeboxServer-Audio-Scan-0.45.tar.gz + mirror://gentoo/SqueezeboxServer-EV-3.8.tar.gz" + +# Note: common-sense currently required due to bundled EV (Gentoo bug#287257) +DEPEND=" + !media-sound/squeezecenter + virtual/logger + virtual/mysql + avahi? ( net-dns/avahi ) + >=dev-perl/common-sense-2.01 + " +# Note: dev-perl/GD necessary because of SC bug#6143 +# (http://bugs.slimdevices.com/show_bug.cgi?id=6143). +RDEPEND=" + dev-perl/File-Which + virtual/logger + virtual/mysql + avahi? ( net-dns/avahi ) + >=dev-lang/perl-5.8.8 + >=dev-perl/GD-2.41 + >=virtual/perl-IO-Compress-2.015 + >=dev-perl/YAML-Syck-1.05 + >=dev-perl/DBD-mysql-4.00.5 + >=dev-perl/DBI-1.607 + >=dev-perl/Digest-SHA1-2.11 + >=dev-perl/Encode-Detect-1.01 + >=dev-perl/HTML-Parser-3.56 + >=dev-perl/JSON-XS-2.2.3.1 + >=dev-perl/Template-Toolkit-2.19 + >=virtual/perl-Time-HiRes-1.97.15 + >=dev-perl/XML-Parser-2.36 + >=dev-perl/Cache-Cache-1.04 + >=dev-perl/Class-Data-Inheritable-0.08 + >=dev-perl/Class-Inspector-1.23 + >=dev-perl/File-Next-1.02 + >=virtual/perl-File-Temp-0.20 + >=dev-perl/File-Which-0.05 + >=perl-core/i18n-langtags-0.35 + >=dev-perl/IO-String-1.08 + >=dev-perl/Log-Log4perl-1.13 + >=dev-perl/libwww-perl-5.805 + >=perl-core/CGI-3.29 + >=dev-perl/TimeDate-1.16 + >=dev-perl/Math-VecStat-0.08 + >=dev-perl/Net-DNS-0.63 + >=dev-perl/Net-IP-1.25 + >=dev-perl/Path-Class-0.16 + >=dev-perl/SQL-Abstract-1.56 + >=dev-perl/SQL-Abstract-Limit-0.12 + >=dev-perl/URI-1.35 + >=dev-perl/XML-Simple-2.18 + >=perl-core/version-0.76 + >=dev-perl/Carp-Clan-5.9 + >=dev-perl/Readonly-1.03 + >=dev-perl/Carp-Assert-0.20 + >=dev-perl/Class-Virtual-0.06 + >=dev-perl/File-Slurp-9999.13 + >=dev-perl/Exporter-Lite-0.02 + >=dev-perl/Tie-IxHash-1.21 + >=virtual/perl-Module-Pluggable-3.6 + >=dev-perl/Archive-Zip-1.23 + >=dev-perl/AnyEvent-5.2 + >=dev-perl/Sub-Name-0.04 + >=dev-perl/Module-Find-0.08 + >=dev-perl/Class-XSAccessor-1.03 + >=dev-perl/Class-XSAccessor-Array-1.04 + >=dev-perl/AutoXS-Header-1.02 + >=dev-perl/Scope-Guard-0.03 + >=dev-perl/Class-C3-XS-0.13 + >=dev-perl/Class-C3-0.21 + >=dev-perl/Class-C3-Componentised-1.0006 + >=dev-perl/File-ReadBackwards-1.04 + lame? ( media-sound/lame ) + alac? ( media-sound/alac_decoder ) + wavpack? ( media-sound/wavpack ) + bonjour? ( net-misc/mDNSResponder ) + flac? ( + media-libs/flac + media-sound/sox + ) + ogg? ( media-sound/sox ) + aac? ( media-libs/faad2 ) + " + +S="${WORKDIR}/${MY_P_BUILD_NUM}" + +# Selected contents of SqueezeCenter's local CPAN collection that we include +# in the installation. This removes duplication of CPAN modules. (See Gentoo +# bug #251494). +CPANKEEP=" + Class/XSAccessor/Array.pm + + JSON/XS/VersionOneAndTwo.pm + Class/Accessor/ + Class/Accessor.pm + MRO/Compat.pm + Algorithm/C3.pm + Data/ + DBIx/ + File/BOM.pm + Net/UPnP/ + Net/UPnP.pm + Proc/Background/ + Proc/Background.pm + Text/Unidecode/ + Text/Unidecode.pm + Tie/Cache/LRU/ + Tie/Cache/LRU.pm + Tie/LLHash.pm + Tie/RegexpHash.pm + UUID/Tiny.pm + URI/Find.pm + PAR/ + PAR.pm + enum.pm + " + +VARLIBSBS="/var/lib/squeezeboxserver" +PREFSDIR="${VARLIBSBS}/prefs" +PREFS="${PREFSDIR}/squeezeboxserver.prefs" +LIVE_PREFS="${PREFSDIR}/server.prefs" +DOCDIR="/usr/share/doc/squeezeboxserver-${PV}" +SHAREDIR="/usr/share/squeezeboxserver" +LIBDIR="/usr/lib/squeezeboxserver" +OLDDBUSER="squeezecenter" +DBUSER="squeezeboxserver" +PLUGINSDIR="${VARLIBSBS}/Plugins" +ETCDIR=/etc/squeezecenter + +# To support Migration +OLDETCDIR=/etc/squeezecenter +OLDPREFSDIR=/var/lib/squeezecenter/prefs +OLDPLUGINSDIR=/var/lib/squeezecenter/Plugins +MIGMARKER=.migrated + +pkg_setup() { + # Sox has optional OGG and FLAC support, so make sure it has that included + # if required + if use ogg; then + if ! built_with_use media-sound/sox ogg; then + eerror "media-sound/sox not built with USE=ogg" + die "Squeezebox Server needs media-sound/sox to be built with USE=ogg" + fi + fi + if use flac; then + if ! built_with_use media-sound/sox flac; then + eerror "media-sound/sox not built with USE=flac" + die "Squeezebox Server needs media-sound/sox to be built with USE=flac" + fi + fi + + # Create the user and group if not already present + enewgroup squeezeboxserver + enewuser squeezeboxserver -1 -1 "/dev/null" squeezeboxserver +} + +src_unpack() { + unpack ${A} + cd "${S}" + + # Apply patches + epatch "${FILESDIR}/${P}-build-perl-modules-gentoo.patch" +} + +# Build Audio::Scan and EV present because of bug#287264 and bug#287857. +src_compile() { + einfo "Building bundled Perl modules (some warnings are normal here)..." + "${FILESDIR}/build-modules.sh" "${DISTDIR}" || die "Unable to build Perl modules" +} + +src_install() { + + # The main Perl executables + exeinto /usr/sbin + newexe slimserver.pl squeezeboxserver + newexe scanner.pl squeezeboxserver-scanner + newexe cleanup.pl squeezeboxserver-cleanup + + # Get the Perl package name and version + eval `perl '-V:package'` + eval `perl '-V:version'` + + # 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" + + # The server Perl modules + dodir "/usr/lib/${package}/vendor_perl/${version}" + cp -r Slim "${D}/usr/lib/${package}/vendor_perl/${version}" || die "Unable to install server Perl modules" + + # Compiled CPAN module go under lib as they are arch-specific + dodir "/usr/lib/squeezeboxserver/CPAN" + cp -r CPAN/arch "${D}/usr/lib/squeezeboxserver/CPAN" || die "Unable to install compiled CPAN modules" + + # Preseve some of the Squeezebox Server-packaged CPAN modules that Gentoo + # doesn't provide ebuilds for. + for ITEM in ${CPANKEEP}; do + dodir "/usr/share/squeezeboxserver/CPAN/$(dirname ${ITEM})" + cp -r "CPAN/${ITEM}" "${D}/usr/share/squeezeboxserver/CPAN/${ITEM}" || die "Unable to preserve CPAN item ${ITEM}" + done + + # Various directories of architecture-independent static files + dodir "${SHAREDIR}" + cp -r Firmware "${D}/${SHAREDIR}" || die "Unable to install firmware" + cp -r Graphics "${D}/${SHAREDIR}" || die "Unable to install Graphics" + cp -r HTML "${D}/${SHAREDIR}" || die "Unable to install HTML" + cp -r IR "${D}/${SHAREDIR}" || die "Unable to install IR" + cp -r SQL "${D}/${SHAREDIR}" || die "Unable to install SQL" + + # Architecture-dependent static files + dodir "${LIBDIR}" + cp -r lib/* "${D}/${LIBDIR}" || die "Unable to install architecture-dependent files" + + # Install compiled Perl modules because of bug#287264 and bug#287857. + dodir "/usr/lib/squeezeboxserver/CPAN/arch" + cp -r CPAN-arch/* "${D}/usr/lib/squeezeboxserver/CPAN/arch" || die "Unable to install compiled CPAN modules" + cp -r CPAN-pm/* "${D}/usr/share/squeezeboxserver/CPAN" || die "Unable to install compiled CPAN modules" + + # Strings and version identification + insinto "${SHAREDIR}" + doins strings.txt + doins revision.txt + + # Documentation + dodoc Changelog*.html + dodoc Installation.txt + dodoc License*.txt + newdoc "${FILESDIR}/Gentoo-plugins-README.txt" Gentoo-plugins-README.txt + + # Configuration files + insinto /etc/squeezeboxserver + doins convert.conf + doins types.conf + doins modules.conf + + # Install init scripts + newconfd "${FILESDIR}/squeezeboxserver.conf.d" squeezeboxserver + newinitd "${FILESDIR}/squeezeboxserver.init.d" squeezeboxserver + + # Install preferences + insinto "${PREFSDIR}" + if [ ! -f "${PREFSDIR}/squeezeboxserver.prefs" ]; then + newins "${FILESDIR}/squeezeboxserver.prefs" squeezeboxserver.prefs + fi + fowners squeezeboxserver:squeezeboxserver "${PREFSDIR}" + fperms 770 "${PREFSDIR}" + + # Install the SQL configuration scripts + insinto "${SHAREDIR}/SQL/mysql" + doins "${FILESDIR}/dbdrop-gentoo.sql" + doins "${FILESDIR}/dbcreate-gentoo.sql" + + # Initialize run directory (where the PID file lives) + dodir /var/run/squeezeboxserver + fowners squeezeboxserver:squeezeboxserver /var/run/squeezeboxserver + fperms 770 /var/run/squeezeboxserver + + # Initialize server cache directory + dodir /var/lib/squeezeboxserver/cache + fowners squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver/cache + fperms 770 /var/lib/squeezeboxserver/cache + + # Initialize the log directory + dodir /var/log/squeezeboxserver + fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver + fperms 770 /var/log/squeezeboxserver + touch "${D}/var/log/squeezeboxserver/server.log" + touch "${D}/var/log/squeezeboxserver/scanner.log" + touch "${D}/var/log/squeezeboxserver/perfmon.log" + fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/server.log + fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/scanner.log + fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/perfmon.log + + # Initialise the user-installed plugins directory + dodir "${PLUGINSDIR}" + fowners squeezeboxserver:squeezeboxserver "${PLUGINSDIR}" + fperms 770 "${PLUGINSDIR}" + + # Install logrotate support + insinto /etc/logrotate.d + newins "${FILESDIR}/squeezeboxserver.logrotate.d" squeezeboxserver + + # Install Avahi support (if USE flag is set) + if use avahi; then + insinto /etc/avahi/services + newins "${FILESDIR}/avahi-squeezeboxserver.service" squeezeboxserver.service + fi +} + +sc_starting_instr() { + elog "Squeezebox Server can be started with the following command:" + elog "\t/etc/init.d/squeezeboxserver start" + elog "" + elog "Squeezebox Server can be automatically started on each boot with the" + elog "following command:" + elog "\trc-update add squeezeboxserver default" + elog "" + elog "You might want to examine and modify the following configuration" + elog "file before starting Squeezebox Server:" + elog "\t/etc/conf.d/squeezeboxserver" + 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}${LIVE_PREFS}" 2>/dev/null) + elog "You may access and configure Squeezebox Server by browsing to:" + elog "\thttp://localhost:${httpport:-9000}/" +} + +pkg_postinst() { + # FLAC and LAME are quite useful (but not essential) for Squeezebox Server - + # if they're not enabled then make sure the user understands that. + if ! use flac; then + ewarn "'flac' USE flag is not set. Although not essential, FLAC is required" + ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for" + ewarn "playing other less common file types (if you have a Squeezebox 2 or newer)." + ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag". + ewarn "" + fi + if ! use lame; then + ewarn "'lame' USE flag is not set. Although not essential, LAME is" + ewarn "required if you want to limit the bandwidth your Squeezebox or" + ewarn "Transporter uses when streaming audio." + ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag". + ewarn "" + fi + + # Album art requires PNG and JPEG support from GD, so if it's not there + # then warn the user. It's not mandatory as the user may not be using + # album art. + if ! built_with_use dev-perl/GD jpeg || \ + ! built_with_use dev-perl/GD png || \ + ! built_with_use media-libs/gd jpeg || \ + ! built_with_use media-libs/gd png; then + ewarn "For correct operation of album art through Squeezebox Server's web" + ewarn "interface the GD library and Perl module must be built with PNG" + ewarn "and JPEG support. If necessary you can add the following lines" + ewarn "to the file /etc/portage/package.use:" + ewarn "\tdev-perl/GD jpeg png" + ewarn "\tmedia-libs/gd jpeg png" + ewarn "And then rebuild those packages with:" + ewarn "\temerge --newuse dev-perl/GD media-libs/gd" + ewarn "" + fi + + # Point user to database configuration step + elog "If this is a new installation of Squeezebox Server then the database" + elog "must be configured prior to use. This can be done by running the" + elog "following command:" + elog "\temerge --config =${CATEGORY}/${PF}" + elog "This command will also migrate old SqueezeCenter preferences and" + elog "plugins (if present)." + + # Remind user to configure Avahi if necessary + if use avahi; then + elog "" + elog "Avahi support installed. Remember to edit the folowing file if" + elog "you run Squeezebox Server's web interface on a port other than 9000:" + elog "\t/etc/avahi/services/squeezeboxserver.service" + fi + + elog "" + sc_starting_instr +} + +sc_remove_db_prefs() { + MY_PREFS=$1 + + einfo "Configuring Squeezebox Server database preferences (${MY_PREFS}) ..." + TMPPREFS="${T}"/squeezeboxserver-prefs-$$ + touch "${ROOT}${MY_PREFS}" + sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}" + mv "${TMPPREFS}" "${ROOT}${MY_PREFS}" + chown squeezeboxserver:squeezeboxserver "${ROOT}${MY_PREFS}" + chmod 660 "${ROOT}${MY_PREFS}" +} + +sc_update_prefs() { + MY_PREFS=$1 + MY_DBUSER=$2 + MY_DBUSER_PASSWD=$3 + + echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}" + echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}" + echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}" +} + +pkg_config() { + einfo "Press ENTER to create the Squeezebox Server database and set proper" + einfo "permissions on it. You will be prompted for the MySQL 'root' user's" + einfo "password during this process (note that the MySQL 'root' user is" + einfo "independent of the Linux 'root' user and so may have a different" + einfo "password)." + einfo "" + einfo "If you already have a Squeezebox Server database set up then this" + einfo "process will clear the existing database (your music files will not," + einfo "however, be affected)." + einfo "" + einfo "Alternatively, press Control-C to abort now..." + read + + # Get the MySQL root password from the user (not echoed to the terminal) + einfo "The MySQL 'root' user password is required to create the" + einfo "Squeezebox Server user and database." + DONE=0 + while [ $DONE -eq 0 ]; do + trap "stty echo; echo" EXIT + stty -echo + read -p "MySQL root password: " ROOT_PASSWD; echo + stty echo + trap ":" EXIT + echo quit | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 && DONE=1 + if [ $DONE -eq 0 ]; then + eerror "Incorrect MySQL root password, or MySQL is not running" + fi + done + + # Get the new password for the Squeezebox Server MySQL database user, and + # have it re-entered to confirm it. We should trivially check it's not + # the same as the MySQL root password. + einfo "A new MySQL user will be added to own the Squeezebox Server database." + einfo "Please enter the password for this new user (${DBUSER})." + DONE=0 + while [ $DONE -eq 0 ]; do + trap "stty echo; echo" EXIT + stty -echo + read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo + stty echo + trap ":" EXIT + if [ -z "$DBUSER_PASSWD" ]; then + eerror "The password should not be blank; try again." + elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then + eerror "The ${DBUSER} password should be different to the root password" + else + DONE=1 + fi + done + + # Drop the existing database and user - note we don't care about errors + # from this as it probably just indicates that the database wasn't + # yet present. + einfo "Dropping old Squeezebox Server database and user ..." + sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" < "${SHAREDIR}/SQL/mysql/dbdrop-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 + + # Drop and create the Squeezebox Server user and database. + einfo "Creating Squeezebox Server MySQL user and database (${DBUSER}) ..." + sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" -e "s/__DBPASSWORD__/${DBUSER_PASSWD}/" < "${SHAREDIR}/SQL/mysql/dbcreate-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" || die "Unable to create MySQL database and user" + + # Migrate old preferences, if present. + if [ -d "${OLDPREFSDIR}" ]; then + if [ -f "${PREFSDIR}/${MIGMARKER}" ]; then + einfo "" + einfo "Old preferences are present, but they appear to have been" + einfo "migrated before. If you would like to re-migrate the old" + einfo "SqueezeCenter preferences remove the following file, and" + einfo "then restart the configuration." + einfo "\t${PREFSDIR}/${MIGMARKER}" + else + einfo "Migrating old SqueezeCenter preferences" + cp -r "${OLDPREFSDIR}" "${VARLIBSBS}" + chown -R squeezeboxserver:squeezeboxserver "${PREFSDIR}" + touch "${PREFSDIR}/${MIGMARKER}" + fi + fi + + # Migrate old plugins, if present. + if [ -d "${OLDPLUGINSDIR}" ]; then + if [ -f "${PLUGINSDIR}/${MIGMARKER}" ]; then + einfo "" + einfo "Old plugins are present, but they appear to have been" + einfo "migrated before. If you would like to re-migrate the old" + einfo "SqueezeCenter preferences remove the following file, and" + einfo "then restart the configuration." + einfo "\t${PLUGINSDIR}/${MIGMARKER}" + else + einfo "Migrating old SqueezeCenter plugins" + cp -r "${OLDPLUGINSDIR}" "${VARLIBSBS}" + chown -R squeezeboxserver:squeezeboxserver "${PLUGINSDIR}" + touch "${PLUGINSDIR}/${MIGMARKER}" + fi + fi + + # Remove the existing MySQL preferences from Squeezebox Server (if any). + sc_remove_db_prefs "${PREFS}" + [ -f "${LIVE_PREFS}" ] && sc_remove_db_prefs ${LIVE_PREFS} + + # Insert the external MySQL configuration into the preferences. + sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" + [ -f "${LIVE_PREFS}" ] && sc_update_prefs "${LIVE_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" + + # Phew - all done. Give some tips on what to do now. + einfo "Database configuration complete." + einfo "" + sc_starting_instr +} + +pkg_preinst() { + # Warn the user if there are old preferences that may need migrating. + if [ -d "${OLDPREFSDIR}" -a ! -f "${PREFSDIR}/${MIGMARKER}" ]; then + if [ ! -z "$(ls ${OLDPREFSDIR})" ]; then + ewarn "Note: It appears that old SqueezeCenter preferences are +installed at:" + ewarn "\t${OLDPREFSDIR}" + ewarn "These may be migrated by running the following command:" + ewarn "\temerge --config =${CATEGORY}/${PF}" + ewarn "(Please note that this will require your music collection to +be rescanned.)" + ewarn "" + fi + fi +} |