diff options
author | Joe Peterson <lavajoe@gentoo.org> | 2008-12-20 01:24:43 +0000 |
---|---|---|
committer | Joe Peterson <lavajoe@gentoo.org> | 2008-12-20 01:24:43 +0000 |
commit | 5abfdf04a2d8c10cafeb1d11de3cba53bc8942ac (patch) | |
tree | 808ed423d2d088184dae76018cd3fa623547fe28 /media-sound | |
parent | Be maintainer. Keyword ~amd64. Bump, fixing bug 206780. Also fixing: Bug 2264... (diff) | |
download | gentoo-2-5abfdf04a2d8c10cafeb1d11de3cba53bc8942ac.tar.gz gentoo-2-5abfdf04a2d8c10cafeb1d11de3cba53bc8942ac.tar.bz2 gentoo-2-5abfdf04a2d8c10cafeb1d11de3cba53bc8942ac.zip |
Add new version 7.3.0
(Portage version: 2.1.6.1/cvs/Linux 2.6.27-gentoo-r4 i686)
Diffstat (limited to 'media-sound')
7 files changed, 564 insertions, 24 deletions
diff --git a/media-sound/squeezecenter/ChangeLog b/media-sound/squeezecenter/ChangeLog index 4816204db72f..c1073af92d22 100644 --- a/media-sound/squeezecenter/ChangeLog +++ b/media-sound/squeezecenter/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for media-sound/squeezecenter # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v 1.34 2008/11/18 16:15:29 tove Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v 1.35 2008/12/20 01:24:43 lavajoe Exp $ + +*squeezecenter-7.3.0 (20 Dec 2008) + + 20 Dec 2008; Joe Peterson <lavajoe@gentoo.org> + files/build-perl-modules-gentoo.patch, +files/gentoo-filepaths.pm, + files/mDNSResponder-gentoo.patch, files/squeezecenter.conf.d, + files/squeezecenter.init.d, +squeezecenter-7.3.0.ebuild: + Add new version 7.3.0 18 Nov 2008; Torsten Veller <tove@gentoo.org> squeezecenter-7.1.0-r1.ebuild, squeezecenter-7.2.0-r1.ebuild, diff --git a/media-sound/squeezecenter/files/build-perl-modules-gentoo.patch b/media-sound/squeezecenter/files/build-perl-modules-gentoo.patch index 94997d56782d..6ae452f8604d 100644 --- a/media-sound/squeezecenter/files/build-perl-modules-gentoo.patch +++ b/media-sound/squeezecenter/files/build-perl-modules-gentoo.patch @@ -1,18 +1,24 @@ ---- Bin/build-perl-modules.pl.old 2008-10-25 13:59:42.000000000 +0100 -+++ Bin/build-perl-modules.pl 2008-10-25 19:28:25.000000000 +0100 -@@ -21,7 +21,6 @@ +--- Bin/build-perl-modules.pl.old 2008-11-18 19:07:45.000000000 +0000 ++++ Bin/build-perl-modules.pl 2008-11-18 19:42:04.000000000 +0000 +@@ -21,13 +21,11 @@ # NOTE: If you change this in a future version of SC, create a new # versioned directory under vendor/src for all files for that version --my $SOURCE = 'http://svn.slimdevices.com/repos/slim/vendor/src/7.2'; +-my $SOURCE = 'http://svn.slimdevices.com/repos/slim/vendor/src/7.3'; my $dlext = $Config{'dlext'}; # The list of all the packages needed. -@@ -197,36 +197,16 @@ + my %packages = ( + 'Class::XSAccessor::Array' => 'Class-XSAccessor-Array-0.05.tar.gz', +- 'Class::C3::XS' => 'Class-C3-XS-0.08.tar.gz', + 'Compress::Zlib' => 'Compress-Zlib-1.41.tar.gz', + 'DBI' => 'DBI-1.604.tar.gz', + 'DBD::mysql' => 'DBD-mysql-3.0002.tar.gz', +@@ -197,36 +195,16 @@ } } -+ # Extract AutoXS::Header as we need that to support the following builds. ++ # Utilise AutoXS::Header as we need that to support the following builds. + chdir($pwd) or die "Couldn't change to $pwd : $!"; + # Include this when performing the following builds. + $ENV{'PERL5LIB'} = cwd() . "/AutoXS-Header-0.03/lib"; @@ -51,3 +57,13 @@ # Just the directory name. my ($packageDir) = ($package =~ /(\S+?)\.tar\.gz/); +--- Slim/bootstrap.pm.old 2008-11-22 15:14:07.000000000 +0000 ++++ Slim/bootstrap.pm 2008-11-22 15:14:30.000000000 +0000 +@@ -176,7 +176,6 @@ + + print "The following modules failed to load: $failed\n\n"; + +- print "To download and compile them, please run: $libPath/Bin/build-perl-modules.pl $failed\n\n"; + print "Exiting..\n"; + + exit; diff --git a/media-sound/squeezecenter/files/gentoo-filepaths.pm b/media-sound/squeezecenter/files/gentoo-filepaths.pm new file mode 100644 index 000000000000..1a0564b6ad25 --- /dev/null +++ b/media-sound/squeezecenter/files/gentoo-filepaths.pm @@ -0,0 +1,120 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/files/gentoo-filepaths.pm,v 1.1 2008/12/20 01:24:43 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 SqueezeCenter. + unshift @INC, '/usr/share/squeezecenter/CPAN'; + + # Make sure plugin files are found. + push @INC, '/var/lib/squeezecenter'; + + return $class->{osDetails}; +} + +=head2 dirsFor( $dir ) + +Return OS Specific directories. + +Argument $dir is a string to indicate which of the SqueezeCenter directories we +need information for. + +=cut + +sub dirsFor { + my ($class, $dir) = @_; + + my @dirs = (); + + if ($dir eq 'oldprefs') { + + push @dirs, $class->SUPER::dirsFor($dir); + + } elsif ($dir =~ /^(?:Firmware|Graphics|HTML|IR|MySQL|SQL|lib|Bin)$/) { + + push @dirs, "/usr/share/squeezecenter/$dir"; + + } elsif ($dir eq 'Plugins') { + + push @dirs, $class->SUPER::dirsFor($dir); + push @dirs, "/var/lib/squeezecenter/Plugins", "/usr/lib/" . $Config{'package'} . "/vendor_perl/" . $Config{'version'} . "/Slim/Plugin"; + + } elsif ($dir =~ /^(?:strings|revision)$/) { + + push @dirs, "/usr/share/squeezecenter"; + + } elsif ($dir eq 'libpath') { + + push @dirs, "/usr/lib/squeezecenter"; + + # 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/squeezecenter"; + + } elsif ($dir =~ /^(?:prefs)$/) { + + push @dirs, $::prefsdir || "/var/lib/squeezecenter/prefs"; + + } elsif ($dir eq 'log') { + + push @dirs, $::logdir || "/var/log/squeezecenter"; + + } elsif ($dir eq 'cache') { + + push @dirs, $::cachedir || "/var/lib/squeezecenter/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/squeezecenter-scanner'; +} + + +1; + + + + +1; + +__END__ diff --git a/media-sound/squeezecenter/files/mDNSResponder-gentoo.patch b/media-sound/squeezecenter/files/mDNSResponder-gentoo.patch index 8a3559ed1ee8..daa2a4ea8bb8 100644 --- a/media-sound/squeezecenter/files/mDNSResponder-gentoo.patch +++ b/media-sound/squeezecenter/files/mDNSResponder-gentoo.patch @@ -1,5 +1,5 @@ ---- Slim/Networking/mDNS.pm.old 2008-07-22 12:25:06.000000000 +0100 -+++ Slim/Networking/mDNS.pm 2008-07-22 12:26:38.000000000 +0100 +--- Slim/Networking/mDNS.pm.old 2008-10-27 08:09:02.000000000 +0000 ++++ Slim/Networking/mDNS.pm 2008-10-27 08:09:02.000000000 +0000 @@ -131,11 +131,10 @@ my ($name, $port) = @$data; diff --git a/media-sound/squeezecenter/files/squeezecenter.conf.d b/media-sound/squeezecenter/files/squeezecenter.conf.d index 535323a60087..4faca2bf422d 100644 --- a/media-sound/squeezecenter/files/squeezecenter.conf.d +++ b/media-sound/squeezecenter/files/squeezecenter.conf.d @@ -1,6 +1,6 @@ # /etc/conf.d/squeezecenter -# Niceness level for the SqueezeCenter process. If not specified then the +# Niceness level for the SqueezeCenter 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 @@ -15,7 +15,7 @@ # 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. +# UPnP devices within your players. # # See "squeezecenter-server --help" for a full list of possible options, # but note that many of them are supplied by /etc/init.d/squeezecenter diff --git a/media-sound/squeezecenter/files/squeezecenter.init.d b/media-sound/squeezecenter/files/squeezecenter.init.d index d6cdd90e4da5..7082830bcb86 100755 --- a/media-sound/squeezecenter/files/squeezecenter.init.d +++ b/media-sound/squeezecenter/files/squeezecenter.init.d @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/files/squeezecenter.init.d,v 1.2 2008/11/11 14:03:15 lavajoe Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/files/squeezecenter.init.d,v 1.3 2008/12/20 01:24:43 lavajoe Exp $ # These fit the SqueezeCenter ebuild and so shouldn't need to be changed; # user-servicable parts go in /etc/conf.d/squeezecenter. @@ -21,20 +21,24 @@ depend() { start() { ebegin "Starting SqueezeCenter" - export SSD_NICELEVEL=${SC_NICENESS} + export SSD_NICELEVEL=${SC_NICENESS} cd / start-stop-daemon \ - --start --exec /usr/bin/perl /usr/sbin/${scname} --chuid ${scuser} \ - -- \ - --quiet --daemon \ - --pidfile=${pidfile} \ - --cachedir=${cachedir} \ - --prefsfile=${prefsfile} \ - --prefsdir=${prefsdir} \ - --logdir=${logdir} \ - --audiodir=${SC_MUSIC_DIR} \ - --playlistdir=${SC_PLAYLISTS_DIR} \ - ${SC_OPTS} + --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=${SC_MUSIC_DIR} \ + --playlistdir=${SC_PLAYLISTS_DIR} \ + ${SC_OPTS} + eend $? "Failed to start SqueezeCenter" } diff --git a/media-sound/squeezecenter/squeezecenter-7.3.0.ebuild b/media-sound/squeezecenter/squeezecenter-7.3.0.ebuild new file mode 100644 index 000000000000..325d121ccea8 --- /dev/null +++ b/media-sound/squeezecenter/squeezecenter-7.3.0.ebuild @@ -0,0 +1,392 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.3.0.ebuild,v 1.1 2008/12/20 01:24:43 lavajoe Exp $ + +inherit eutils + +MAJOR_VER="${PV:0:3}" +MINOR_VER="${PV:4:1}" +SRC_DIR="SqueezeCenter_v${MAJOR_VER}.${MINOR_VER}" +MY_P="squeezecenter-${MAJOR_VER}-noCPAN" + +DESCRIPTION="Logitech SqueezeCenter music server" +HOMEPAGE="http://www.slimdevices.com/pi_features.html" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="lame wavpack musepack alac ogg bonjour flac avahi" + +SRC_URI="http://www.slimdevices.com/downloads/${SRC_DIR}/${MY_P}.tgz + mirror://gentoo/SqueezeCenter-AutoXS-Header-0.03.tar.gz + mirror://gentoo/SqueezeCenter-Class-XSAccessor-Array-0.05.tar.gz + mirror://gentoo/SqueezeCenter-Compress-Zlib-1.41.tar.gz + mirror://gentoo/SqueezeCenter-DBD-mysql-3.0002.tar.gz + mirror://gentoo/SqueezeCenter-DBI-1.604.tar.gz + mirror://gentoo/SqueezeCenter-Digest-SHA1-2.11.tar.gz + mirror://gentoo/SqueezeCenter-Encode-Detect-1.00.tar.gz + mirror://gentoo/SqueezeCenter-HTML-Parser-3.48.tar.gz + mirror://gentoo/SqueezeCenter-JSON-XS-1.5.tar.gz + mirror://gentoo/SqueezeCenter-POE-XS-Queue-Array-0.002.tar.gz + mirror://gentoo/SqueezeCenter-Template-Toolkit-2.15.tar.gz + mirror://gentoo/SqueezeCenter-Time-HiRes-1.86.tar.gz + mirror://gentoo/SqueezeCenter-XML-Parser-2.34.tar.gz + mirror://gentoo/SqueezeCenter-YAML-Syck-0.64.tar.gz" + +# Note: dev-perl/module-build necessary because of SC bug#5882 +# (http://bugs.slimdevices.com/show_bug.cgi?id=5882). +DEPEND=" + dev-perl/File-Which + virtual/perl-Module-Build + virtual/logger + virtual/mysql + avahi? ( net-dns/avahi ) + ogg? ( media-sound/sox ) + " +# Note: dev-perl/GD necessary because of SC bug#6143 +# (http://bugs.slimdevices.com/show_bug.cgi?id=6143). +RDEPEND="${DEPEND} + >=dev-lang/perl-5.8.8 + >=dev-perl/GD-2.35 + >=app-admin/sudo-1.6.8 + alac? ( media-sound/alac_decoder ) + lame? ( media-sound/lame ) + wavpack? ( media-sound/wavpack ) + bonjour? ( net-misc/mDNSResponder ) + flac? ( media-libs/flac ) + musepack? ( media-sound/musepack-tools ) + " + +S="${WORKDIR}/${MY_P}" + +PREFS="/var/lib/squeezecenter/prefs/squeezecenter.prefs" +LIVE_PREFS="/var/lib/squeezecenter/prefs/server.prefs" +DOCDIR="/usr/share/doc/squeezecenter-${PV}" +SHAREDIR="/usr/share/squeezecenter" +LIBDIR="/usr/lib/squeezecenter" +DBUSER="squeezecenter" +OLDPLUGINSDIR=/opt/squeezecenter/Plugins +NEWPLUGINSDIR=/var/lib/squeezecenter/Plugins + +pkg_setup() { + # Sox has optional OGG support, so make sure it has been built that way + if use ogg; then + if ! built_with_use media-sound/sox ogg; then + eerror "media-sound/sox not built with USE=ogg" + die "media-sound/sox not built with USE=ogg" + fi + fi + + # Create the user and group if not already present + enewgroup squeezecenter + enewuser squeezecenter -1 -1 "/dev/null" squeezecenter +} + +src_unpack() { + unpack ${A} + cd "${S}" + + # Apply patches + epatch "${FILESDIR}/mDNSResponder-gentoo.patch" + epatch "${FILESDIR}/build-perl-modules-gentoo.patch" + + # Prune GD from the SqueezeCenter local CPAN. This is due to + # SC bug#5882 which means we need to bring in Portage's version of GD, + # which will fail if it is different to the version in the local CPAN + # tree. SqueezeCenter will then use the system-installed dev-perl/GD. + # (This fixes Gentoo bug #237548) + rm -r CPAN/GD.pm CPAN/GD || die "Unable to remove local CPAN GD" +} + +src_compile() { + einfo "Building required Perl modules (some warnings are normal here) ..." + echo -e "\n${S}\n${WORKDIR}" | Bin/build-perl-modules.pl || die "Unable to build Perl modules" +} + +src_install() { + + # The main Perl executables + exeinto /usr/sbin + newexe slimserver.pl squeezecenter-server + newexe scanner.pl squeezecenter-scanner + newexe cleanup.pl squeezecenter-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/squeezecenter/CPAN" + cp -r CPAN/arch "${D}/usr/lib/squeezecenter/CPAN" || die "Unable to install compiled CPAN modules" + rm -r CPAN/arch || die "Unable to remove compiled CPAN modules from source" + + # 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" + cp -r CPAN "${D}/${SHAREDIR}" || die "Unable to install CPAN" + + # Architecture-dependent static files + dodir "${LIBDIR}" + cp -r lib/* "${D}/${LIBDIR}" || die "Unable to install architecture-dependent files" + + # 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/squeezecenter + doins convert.conf + doins types.conf + doins modules.conf + + # Install init scripts + newconfd "${FILESDIR}/squeezecenter.conf.d" squeezecenter + newinitd "${FILESDIR}/squeezecenter.init.d" squeezecenter + + # Install default preferences + insinto /var/lib/squeezecenter/prefs + newins "${FILESDIR}/squeezecenter.prefs" squeezecenter.prefs + fowners squeezecenter:squeezecenter /var/lib/squeezecenter/prefs + fperms 770 /var/lib/squeezecenter/prefs + + # 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/squeezecenter + fowners squeezecenter:squeezecenter /var/run/squeezecenter + fperms 770 /var/run/squeezecenter + + # Initialize server cache directory + dodir /var/lib/squeezecenter/cache + fowners squeezecenter:squeezecenter /var/lib/squeezecenter/cache + fperms 770 /var/lib/squeezecenter/cache + + # Initialize the log directory + dodir /var/log/squeezecenter + fowners squeezecenter:squeezecenter /var/log/squeezecenter + fperms 770 /var/log/squeezecenter + touch "${D}/var/log/squeezecenter/server.log" + touch "${D}/var/log/squeezecenter/scanner.log" + touch "${D}/var/log/squeezecenter/perfmon.log" + fowners squeezecenter:squeezecenter /var/log/squeezecenter/server.log + fowners squeezecenter:squeezecenter /var/log/squeezecenter/scanner.log + fowners squeezecenter:squeezecenter /var/log/squeezecenter/perfmon.log + + # Initialise the user-installed plugins directory + dodir "${NEWPLUGINSDIR}" + + # Install logrotate support + insinto /etc/logrotate.d + newins "${FILESDIR}/squeezecenter.logrotate.d" squeezecenter + + # Install Avahi support (if USE flag is set) + if use avahi; then + insinto /etc/avahi/services + newins "${FILESDIR}/avahi-squeezecenter.service" squeezecenter.service + fi +} + +sc_starting_instr() { + elog "SqueezeCenter can be started with the following command:" + elog "\t/etc/init.d/squeezecenter start" + elog "" + elog "SqueezeCenter can be automatically started on each boot with the" + elog "following command:" + elog "\trc-update add squeezecenter default" + elog "" + elog "You might want to examine and modify the following configuration" + elog "file before starting SqueezeCenter:" + elog "\t/etc/conf.d/squeezecenter" + 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 SqueezeCenter by browsing to:" + elog "\thttp://localhost:${httpport:-9000}/" +} + +pkg_postinst() { + # FLAC and LAME are quite useful (but not essential) for SqueezeCenter - + # 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, 3," + ewarn "Receiver or Transporter)." + 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 SqueezeCenter'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 SqueezeCenter 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}" + + # 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 SqueezeCenter's web interface on a port other than 9000:" + elog "\t/etc/avahi/services/squeezecenter.service" + fi + + elog "" + sc_starting_instr +} + +sc_remove_db_prefs() { + MY_PREFS=$1 + + einfo "Configuring SqueezeCenter database preferences (${MY_PREFS}) ..." + TMPPREFS="${T}"/squeezecenter-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 squeezecenter:squeezecenter "${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 SqueezeCenter 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 SqueezeCenter 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 "SqueezeCenter 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 SqueezeCenter 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 SqueezeCenter 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 SqueezeCenter 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 SqueezeCenter user and database. + einfo "Creating SqueezeCenter 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" + + # Remove the existing MySQL preferences from SqueezeCenter (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 plugins that he may need to migrate + if [ -d "${OLDPLUGINSDIR}" ]; then + if [ ! -z "$(ls ${OLDPLUGINSDIR})" ]; then + ewarn "Note: It appears that plugins are installed in the old location of:" + ewarn "${OLDPLUGINSDIR}" + ewarn "If these are to be used then they must be migrated to the new location:" + ewarn "${NEWPLUGINSDIR}" + ewarn "" + fi + fi +} |