Add new version 7.5.1
authorJoe Peterson <lavajoe@gentoo.org>
Sun, 27 Jun 2010 08:06:10 +0000 (08:06 +0000)
committerJoe Peterson <lavajoe@gentoo.org>
Sun, 27 Jun 2010 08:06:10 +0000 (08:06 +0000)
Package-Manager: portage-2.1.8.3/cvs/Linux x86_64

media-sound/squeezeboxserver/ChangeLog
media-sound/squeezeboxserver/Manifest
media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-build-perl-modules-gentoo.patch [new file with mode: 0644]
media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-squeezeslave.patch [new file with mode: 0644]
media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-uuid-gentoo.patch [new file with mode: 0644]
media-sound/squeezeboxserver/squeezeboxserver-7.5.1.ebuild [new file with mode: 0644]

index 34bb4bace513dc58b4d762cc199fc5986aa94745..0d32f86508cef173a761dfec0db2cdff1c23bdce 100644 (file)
@@ -1,6 +1,15 @@
 # ChangeLog for media-sound/squeezeboxserver
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v 1.7 2010/06/10 14:30:34 lavajoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v 1.8 2010/06/27 08:06:09 lavajoe Exp $
+
+*squeezeboxserver-7.5.1 (27 Jun 2010)
+
+  27 Jun 2010; Joe Peterson <lavajoe@gentoo.org>
+  +squeezeboxserver-7.5.1.ebuild,
+  +files/squeezeboxserver-7.5.1-build-perl-modules-gentoo.patch,
+  +files/squeezeboxserver-7.5.1-squeezeslave.patch,
+  +files/squeezeboxserver-7.5.1-uuid-gentoo.patch:
+  Add new version 7.5.1
 
 *squeezeboxserver-7.4.2-r2 (10 Jun 2010)
 
index cb347b26cd89d6c1b23689835bf5846390564f84..b3bae0068835cf1f6857e26af1f5d4ef751b6530 100644 (file)
@@ -11,6 +11,9 @@ AUX squeezeboxserver-7.4.2-uuid-gentoo.patch 535 RMD160 398d952efb3a14e5096605f8
 AUX squeezeboxserver-7.5.0-build-perl-modules-gentoo.patch 658 RMD160 58f87148754189c5ca67ae8e045126a6f50e0381 SHA1 4a740b4f07e1d2134b4fe23b67fda2239f67dd47 SHA256 75146e7beaa647ce98a0617894c4d398a87216b4842afb63cb718bf0b0276a38
 AUX squeezeboxserver-7.5.0-squeezeslave.patch 642 RMD160 ba95cdf24bc662a38c4265553a07ade5d2567ddd SHA1 07d7436cfa963084d378e78c016679b7a6f471bf SHA256 73dd7f05abe5458d4a9d5438abcee5a4135567d9c855246935a2afd9055175d3
 AUX squeezeboxserver-7.5.0-uuid-gentoo.patch 535 RMD160 3675cfbd5a732fe515e714ab9ccc8de7ebcec9f4 SHA1 1741c3e44526a2b6497811f20c22f38f3329d8ef SHA256 db2780c16cdb36e365c2e1ca6e2e19af8f846168c101ce735836d06d2ba0feed
+AUX squeezeboxserver-7.5.1-build-perl-modules-gentoo.patch 860 RMD160 9c3f1aaea83c6d2374997775fed58e363c23885c SHA1 a99b20e00078c6f780fd954c66eb59070f27fe24 SHA256 d96c4f6b154ea56134636d9ee81a37bea83ba3ccdbf648797061ffeccaf22b33
+AUX squeezeboxserver-7.5.1-squeezeslave.patch 642 RMD160 3a4caa3e625930d99e975e0bf05a0678f83af0a0 SHA1 0930fbb2b68f9bcef3a4ee44bf989c0dde525a26 SHA256 9d52ce93f308ae0a97d67808f833d44d78048cd32b74a81d2370c15486abf0a5
+AUX squeezeboxserver-7.5.1-uuid-gentoo.patch 535 RMD160 c18d20678510af04dd2f3cc964c52e6b9bce66cb SHA1 8b5c3d728e8a51e65b923db2490f1d401c2eb8d6 SHA256 ba89bda0e2b3ae5590a5d5139539ff3b233720bded7f912b6d332175984ebb34
 AUX squeezeboxserver.conf.d 1106 RMD160 39ca36903c4b67e40b5e24c06bc62057e932bbf1 SHA1 0d84ec59e828d6eec7bdd64f7b414748eb2a558a SHA256 4ac6df07ae3b74d44ae410e0879ea2ad2d948383c32fdd750a443717c8648df0
 AUX squeezeboxserver.init.d 1370 RMD160 fb93e1a5e9c085854479ba473b74b732efac7fca SHA1 761cb4d8ed5b657f81b89c7c98a85eb2996c3b52 SHA256 4f38348e9ae12c176da18e97b4b0af981aa2769a044bd155cfc28eb7fe63a1de
 AUX squeezeboxserver.logrotate.d 422 RMD160 694fdc002fee090f503ec757873b838d73bebb65 SHA1 98606d8dd8323d67a6a45339ec64d793224afbf2 SHA256 0eef63753f1072b20ad0418fc33a47b08412eb901283c7d3a984293f64ae3a8d
@@ -18,7 +21,9 @@ AUX squeezeboxserver.prefs 132 RMD160 194039dc2ef4b0c579ed13096ff6151fbbd27c02 S
 DIST SqueezeboxServer-EV-3.8.tar.gz 151268 RMD160 0bb514debdb615b37f5c16164a47c5934aacbdd9 SHA1 a205192861aa5a668592468833d0e99749274aeb SHA256 3be30c896026fe1a873ac16eac9473f80f62c164da88e3815ed6eee56e229345
 DIST squeezeboxserver-7.4.2-noCPAN.tgz 22197375 RMD160 a52088edcb01d8114d02e80eb35c2eaacdca215f SHA1 0d59db03cd4162f5162f75443e46fef2963f5ba4 SHA256 6f2555c53f0514477935593526e027eb35e9f8735283fe996ecfcfdf0d563b8b
 DIST squeezeboxserver-7.5.0-noCPAN.tgz 20701362 RMD160 a2758d2a0340851bdf860a26d7bdcb227de987a2 SHA1 8519061735cc61b690fe96d883e2094ffd06b458 SHA256 a92116e702809087fa12c8e2386375101a9ead4c8bc42452f0be979e39c67a9f
+DIST squeezeboxserver-7.5.1-noCPAN.tgz 20719890 RMD160 f042feab287da2835905b50b9b08e197c9746d9e SHA1 ff6bdffa4f421d066ef4cce86b8963cb67f3cac2 SHA256 bab313b1bf68c4e4825d821352ce6d59a0eaa883ae487cd273a9cd9b4a5245ff
 EBUILD squeezeboxserver-7.4.2-r2.ebuild 17537 RMD160 41d95626dad6f8eeef9062cbe1119fb150eb38fd SHA1 960da41b9f5aa3fb1acc995b729098a2e3c1a021 SHA256 b3d1e72ae55a8a5e5e9378cf4d10df8a8a00b4dac0eb675040976c75c3fa0813
 EBUILD squeezeboxserver-7.5.0-r1.ebuild 17666 RMD160 4b36d4efd6762eb04ec5f1fa24f3ecfdb730c945 SHA1 8b2562683ecd01703eadf20c4c6f248d1837a820 SHA256 0e1727a206d98f816f199702804d17ba4737bf617c57615a35edb949e2f6fcea
-MISC ChangeLog 2814 RMD160 44a145af8d1ee1730d77b60c624b8778e0c04dcd SHA1 17757f7f7403440c240ae792581621459c50b34e SHA256 4438a5019562579d9818cf6d83a5b501ee435eb2f3cee26b1eeafdf83775d52b
+EBUILD squeezeboxserver-7.5.1.ebuild 17594 RMD160 30a1dc52cc787cd4248467e46a68309db6e113b4 SHA1 dcdf3e056cdf59e340788ffbda4c56ade9db8a05 SHA256 61234ccd541b9d9690c5b02d49329a2f1e37589f97aafeaf51995ffbe615142e
+MISC ChangeLog 3129 RMD160 abe78df28dacef725e54573e89780a91bae39f9e SHA1 d01d42d76d71be87519bc615bc5684190dded325 SHA256 3919f4ba7ea1f70f9c445f6944db9e8e046c1ccbd91d3e5aa79881e85a6cb3e3
 MISC metadata.xml 935 RMD160 bed42783ef261d072900ba296052be0e67143d6e SHA1 13567e24801ecf74fe91c6bc2bc2d1202c3fac49 SHA256 6e17e84756f35acb251d9134fac66ba08b41a78861edadc523f065a9eb1016d6
diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-build-perl-modules-gentoo.patch b/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-build-perl-modules-gentoo.patch
new file mode 100644 (file)
index 0000000..092b817
--- /dev/null
@@ -0,0 +1,30 @@
+--- Slim/bootstrap.pm.old      2010-06-17 12:55:12.173284161 +0100
++++ Slim/bootstrap.pm  2010-06-17 12:56:17.465364370 +0100
+@@ -192,27 +192,6 @@
+                       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:
+-
+-If you're running some unsupported Linux/Unix platform, please use the buildme.sh 
+-script located here:
+-
+-http://svn.slimdevices.com/repos/slim/7.5/trunk/vendor/CPAN/
+-
+-You should never need to do this if you're on Windows or Mac OSX. If the installers
+-don't work for you, ask for help and/or report a bug.
+-
+-If 7.5 is outdated by the time you read this, Replace "7.5" with the major version
+-of Squeezebox Server you are running.
+-
+-*******
+-
+-                      \n};
+-              }
+               
+               print "Exiting..\n";
+ 
diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-squeezeslave.patch b/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-squeezeslave.patch
new file mode 100644 (file)
index 0000000..0e6ebb9
--- /dev/null
@@ -0,0 +1,15 @@
+--- Slim/Web/HTTP.pm.old       2010-06-10 13:15:09.050446973 +0100
++++ Slim/Web/HTTP.pm   2010-06-10 13:15:09.046446912 +0100
+@@ -2214,9 +2214,10 @@
+               # only kill the timer if we were called for the active streaming connection;
+               # otherwise we might kill the timer related to the next connection too.
+               Slim::Utils::Timers::killTimers($client, \&tryStreamingLater);
+-              
+-              Slim::Networking::Select::addWrite($httpClient, \&sendStreamingResponse, 1);
+       }
++
++      # Bug 14740 - always call sendStreamingResponse so we ensure the socket gets closed
++      Slim::Networking::Select::addWrite($httpClient, \&sendStreamingResponse, 1);
+ }
+ 
+ sub forgetClient {
diff --git a/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-uuid-gentoo.patch b/media-sound/squeezeboxserver/files/squeezeboxserver-7.5.1-uuid-gentoo.patch
new file mode 100644 (file)
index 0000000..a249aee
--- /dev/null
@@ -0,0 +1,14 @@
+--- slimserver.pl.old  2010-06-10 13:15:09.050446973 +0100
++++ slimserver.pl      2010-06-10 13:15:09.050446973 +0100
+@@ -397,8 +397,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("Squeezebox Server binary search path init...");
diff --git a/media-sound/squeezeboxserver/squeezeboxserver-7.5.1.ebuild b/media-sound/squeezeboxserver/squeezeboxserver-7.5.1.ebuild
new file mode 100644 (file)
index 0000000..0bb8328
--- /dev/null
@@ -0,0 +1,489 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.5.1.ebuild,v 1.1 2010/06/27 08:06:10 lavajoe Exp $
+
+EAPI="2"
+
+inherit eutils
+
+MAJOR_VER="${PV:0:3}"
+MINOR_VER="${PV:4:1}"
+BUILD_NUM="30836"
+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 ogg flac aac"
+
+# Note: EV present because of bug#287857.
+SRC_URI="http://downloads.slimdevices.com/${SRC_DIR}/${MY_P}.tgz
+       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
+       >=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
+       >=dev-lang/perl-5.8.8
+       ~dev-perl/Audio-Scan-0.82
+       >=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/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-Accessor-0.31
+       >=dev-perl/Class-XSAccessor-1.05
+       >=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
+       ~dev-perl/DBIx-Class-0.08120
+       >=dev-perl/JSON-XS-VersionOneAndTwo-0.31
+       >=dev-perl/MRO-Compat-0.11
+       >=dev-perl/PAR-0.994
+       >=dev-perl/enum-1.016
+       >=dev-perl/URI-Find-20100211
+       >=dev-perl/Algorithm-C3-0.08
+       >=dev-perl/Text-Unidecode-0.04
+       >=dev-perl/Net-UPnP-1.4.2
+       >=dev-perl/File-BOM-0.14
+       >=dev-perl/Proc-Background-1.10
+       >=dev-perl/Tie-Cache-LRU-20081023.2116
+       >=dev-perl/Tie-Cache-LRU-Expires-0.54
+       >=dev-perl/Data-Dump-1.15
+       >=dev-perl/Data-Page-2.02
+       >=dev-perl/Data-URIEncode-0.11
+       >=dev-perl/Tie-LLHash-1.003
+       >=dev-perl/Tie-RegexpHash-0.15
+       >=dev-perl/Data-UUID-1.202
+       lame? ( media-sound/lame )
+       wavpack? ( media-sound/wavpack )
+       flac? (
+               media-libs/flac
+               media-sound/sox[flac]
+               )
+       ogg? ( media-sound/sox[ogg] )
+       aac? ( media-libs/faad2 )
+       "
+
+S="${WORKDIR}/${MY_P_BUILD_NUM}"
+
+ETCDIR="/etc/squeezeboxserver"
+PREFS="${ETCDIR}/squeezeboxserver.prefs"
+PREFSDIR="${ETCDIR}/prefs"
+DOCDIR="/usr/share/doc/squeezeboxserver-${PV}"
+SHAREDIR="/usr/share/squeezeboxserver"
+LIBDIR="/usr/$(get_libdir)/squeezeboxserver"
+OLDDBUSER="squeezecenter"
+DBUSER="squeezeboxserver"
+VARLIBSBS="/var/lib/squeezeboxserver"
+PLUGINSDIR="${VARLIBSBS}/Plugins"
+
+# To support Migration
+OLDETCDIR="/etc/squeezecenter"
+OLDPREFSDIR="/var/lib/squeezecenter/prefs"
+OLDPREFSFILE="${OLDPREFSDIR}/server.prefs"
+OLDPLUGINSDIR="/var/lib/squeezecenter/Plugins"
+MIGMARKER=".migrated"
+
+pkg_setup() {
+       # Create the user and group if not already present
+       enewgroup squeezeboxserver
+       enewuser squeezeboxserver -1 -1 "/dev/null" squeezeboxserver
+}
+
+src_prepare() {
+       # Apply patches
+       epatch "${FILESDIR}/${P}-build-perl-modules-gentoo.patch"
+       epatch "${FILESDIR}/${P}-uuid-gentoo.patch"
+       epatch "${FILESDIR}/${P}-squeezeslave.patch"
+
+       # Copy in the module builder - can't run it from the files directory in case
+       # Portage is mounted 'noexec'.
+       cp "${FILESDIR}/build-modules.sh" "${S}"        || die
+       chmod 555 "${S}/build-modules.sh"                       || die
+}
+
+# Building of EV present because of bug#287857.
+src_compile() {
+       einfo "Building bundled Perl modules (some warnings are normal here)..."
+       "./build-modules.sh" "${DISTDIR}" || die "Unable to build Perl modules"
+}
+
+src_install() {
+
+       # The main Perl executables
+       exeinto /usr/sbin
+       newexe slimserver.pl squeezeboxserver           || die "Failed to install server executable"
+       newexe scanner.pl squeezeboxserver-scanner      || die "Failed to install scanner executable"
+       newexe cleanup.pl squeezeboxserver-cleanup      || die "Failed to install cleanup executable"
+
+       # 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
+       local installvendorlib
+       eval `perl '-V:installvendorlib'`
+       dodir "${installvendorlib}"
+       cp -r Slim "${D}${installvendorlib}" || die "Unable to install server Perl modules"
+
+       # 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"
+
+       # Remove bundled modified AnyEvent - we depend on a newer version now
+       rm -r lib/AnyEvent.pm lib/AnyEvent || die "Unable to remove bundled AnyEvent"
+
+       # 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#287857.
+       dodir "${LIBDIR}/CPAN/arch"
+       cp -r CPAN-arch/* "${D}${LIBDIR}/CPAN/arch" || die "Unable to install compiled CPAN modules"
+       cp -r CPAN-pm/* "${D}${LIBDIR}/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
+       dodoc "${FILESDIR}/Gentoo-plugins-README.txt"
+       dodoc "${FILESDIR}/Gentoo-detailed-changelog.txt"
+
+       # Configuration files and preferences
+       insinto "${ETCDIR}"
+       doins convert.conf
+       doins types.conf
+       doins modules.conf
+       newins "${FILESDIR}/squeezeboxserver.prefs" squeezeboxserver.prefs
+
+       # Preferences directory
+       dodir "${PREFSDIR}"
+       fowners squeezeboxserver:squeezeboxserver "${PREFSDIR}"
+       fperms 770 "${PREFSDIR}"
+
+       # Install init scripts
+       newconfd "${FILESDIR}/squeezeboxserver.conf.d" squeezeboxserver
+       newinitd "${FILESDIR}/squeezeboxserver.init.d" squeezeboxserver
+
+       # 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
+}
+
+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 ! has_version dev-perl/GD[jpeg] || \
+          ! has_version dev-perl/GD[png] || \
+          ! has_version media-libs/gd[jpeg] || \
+          ! has_version 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)."
+
+       elog ""
+
+       ewarn "Note: If Squeezebox Server dies after the initial configuration"
+       ewarn "      after an upgrade from a previous installation, try removing"
+       ewarn "      /var/lib/squeezeboxserver and /etc/squeezeboxserver and"
+       ewarn "      then reinstalling the package (note that old preferences"
+       ewarn "      and plugins will be lost).  See bug #307119."
+
+       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 "${OLDPREFSFILE}" ]; then
+               if [ -f "${ETCDIR}/${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${ETCDIR}/${MIGMARKER}"
+               else
+                       einfo "Migrating old SqueezeCenter preferences"
+                       cp -r "${OLDPREFSDIR}" "${VARLIBSBS}"
+                       mv "${VARLIBSBS}/prefs/server.prefs" "/etc/squeezeboxserver/squeezeboxserver.prefs"
+                       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}"
+
+       # Insert the external MySQL configuration into the preferences.
+       sc_update_prefs "${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
+}