Gentoo Archives: gentoo-commits

From: "Joe Peterson (lavajoe)" <lavajoe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-sound/squeezeboxserver: ChangeLog metadata.xml squeezeboxserver-7.5.2.ebuild squeezeboxserver-7.5.0-r1.ebuild squeezeboxserver-7.5.1.ebuild squeezeboxserver-7.4.2-r2.ebuild
Date: Wed, 05 Jan 2011 19:53:37
Message-Id: 20110105195327.A4D0020047@flycatcher.gentoo.org
1 lavajoe 11/01/05 19:53:27
2
3 Modified: ChangeLog metadata.xml
4 Added: squeezeboxserver-7.5.2.ebuild
5 Removed: squeezeboxserver-7.5.0-r1.ebuild
6 squeezeboxserver-7.5.1.ebuild
7 squeezeboxserver-7.4.2-r2.ebuild
8 Log:
9 Add new version 7.5.2; remove old versions
10
11 (Portage version: 2.1.9.29/cvs/Linux x86_64)
12
13 Revision Changes Path
14 1.12 media-sound/squeezeboxserver/ChangeLog
15
16 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/ChangeLog?rev=1.12&view=markup
17 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/ChangeLog?rev=1.12&content-type=text/plain
18 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/ChangeLog?r1=1.11&r2=1.12
19
20 Index: ChangeLog
21 ===================================================================
22 RCS file: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v
23 retrieving revision 1.11
24 retrieving revision 1.12
25 diff -u -r1.11 -r1.12
26 --- ChangeLog 19 Sep 2010 14:47:02 -0000 1.11
27 +++ ChangeLog 5 Jan 2011 19:53:27 -0000 1.12
28 @@ -1,6 +1,25 @@
29 # ChangeLog for media-sound/squeezeboxserver
30 -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
31 -# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v 1.11 2010/09/19 14:47:02 lavajoe Exp $
32 +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
33 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/ChangeLog,v 1.12 2011/01/05 19:53:27 lavajoe Exp $
34 +
35 +*squeezeboxserver-7.5.2 (05 Jan 2011)
36 +
37 + 05 Jan 2011; Joe Peterson <lavajoe@g.o>
38 + -squeezeboxserver-7.4.2-r2.ebuild,
39 + -files/squeezeboxserver-7.4.2-build-perl-modules-gentoo.patch,
40 + -files/squeezeboxserver-7.4.2-squeezeslave.patch,
41 + -files/squeezeboxserver-7.4.2-uuid-gentoo.patch,
42 + -squeezeboxserver-7.5.0-r1.ebuild,
43 + -files/squeezeboxserver-7.5.0-build-perl-modules-gentoo.patch,
44 + -files/squeezeboxserver-7.5.0-squeezeslave.patch,
45 + -files/squeezeboxserver-7.5.0-uuid-gentoo.patch,
46 + -squeezeboxserver-7.5.1.ebuild, -files/build-modules-7.5.1.sh,
47 + +squeezeboxserver-7.5.2.ebuild,
48 + +files/squeezeboxserver-7.5.2-build-perl-modules-gentoo.patch,
49 + +files/squeezeboxserver-7.5.2-squeezeslave.patch,
50 + +files/squeezeboxserver-7.5.2-uuid-gentoo.patch,
51 + +files/build-modules-7.5.2.sh, files/squeezeboxserver.init.d, metadata.xml:
52 + Add new version 7.5.2; remove old versions
53
54 *squeezeboxserver-7.5.1-r1 (19 Sep 2010)
55
56
57
58
59 1.4 media-sound/squeezeboxserver/metadata.xml
60
61 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/metadata.xml?rev=1.4&view=markup
62 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/metadata.xml?rev=1.4&content-type=text/plain
63 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/metadata.xml?r1=1.3&r2=1.4
64
65 Index: metadata.xml
66 ===================================================================
67 RCS file: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/metadata.xml,v
68 retrieving revision 1.3
69 retrieving revision 1.4
70 diff -u -r1.3 -r1.4
71 --- metadata.xml 25 Apr 2010 22:26:28 -0000 1.3
72 +++ metadata.xml 5 Jan 2011 19:53:27 -0000 1.4
73 @@ -19,6 +19,5 @@
74 </longdescription>
75 <use>
76 <flag name='aac'>Enable playback support for AAC (.m4a) encoded files</flag>
77 - <flag name='alac'>Enable support for alac</flag>
78 </use>
79 </pkgmetadata>
80
81
82
83 1.1 media-sound/squeezeboxserver/squeezeboxserver-7.5.2.ebuild
84
85 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.5.2.ebuild?rev=1.1&view=markup
86 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.5.2.ebuild?rev=1.1&content-type=text/plain
87
88 Index: squeezeboxserver-7.5.2.ebuild
89 ===================================================================
90 # Copyright 1999-2011 Gentoo Foundation
91 # Distributed under the terms of the GNU General Public License v2
92 # $Header: /var/cvsroot/gentoo-x86/media-sound/squeezeboxserver/squeezeboxserver-7.5.2.ebuild,v 1.1 2011/01/05 19:53:27 lavajoe Exp $
93
94 EAPI="2"
95
96 inherit eutils
97
98 MAJOR_VER="${PV:0:3}"
99 MINOR_VER="${PV:4:1}"
100 BUILD_NUM="31632"
101 SRC_DIR="SqueezeboxServer_v${MAJOR_VER}.${MINOR_VER}"
102 MY_P="squeezeboxserver-${MAJOR_VER}.${MINOR_VER}-noCPAN"
103 MY_P_BUILD_NUM="squeezeboxserver-${MAJOR_VER}.${MINOR_VER}-${BUILD_NUM}-noCPAN"
104
105 DESCRIPTION="Logitech SqueezeboxServer music server"
106 HOMEPAGE="http://www.mysqueezebox.com/download"
107 LICENSE="GPL-2"
108 SLOT="0"
109 KEYWORDS="~amd64 ~x86"
110 IUSE="lame wavpack ogg flac aac"
111
112 # Note: EV present because of bug#287857.
113 SRC_URI="http://downloads.slimdevices.com/${SRC_DIR}/${MY_P}.tgz
114 mirror://gentoo/SqueezeboxServer-EV-3.8.tar.gz"
115
116 # Note: common-sense currently required due to bundled EV (Gentoo bug#287257)
117 DEPEND="
118 !media-sound/squeezecenter
119 virtual/logger
120 virtual/mysql
121 >=dev-perl/common-sense-2.01
122 "
123 # Note: dev-perl/GD necessary because of SC bug#6143
124 # (http://bugs.slimdevices.com/show_bug.cgi?id=6143).
125 RDEPEND="
126 dev-perl/File-Which
127 virtual/logger
128 virtual/mysql
129 >=dev-lang/perl-5.8.8
130 ~dev-perl/Audio-Scan-0.82
131 >=dev-perl/GD-2.41
132 >=virtual/perl-IO-Compress-2.015
133 >=dev-perl/YAML-Syck-1.05
134 >=dev-perl/DBD-mysql-4.00.5
135 >=dev-perl/DBI-1.607
136 >=dev-perl/Digest-SHA1-2.11
137 >=dev-perl/Encode-Detect-1.01
138 >=dev-perl/HTML-Parser-3.56
139 >=dev-perl/JSON-XS-2.2.3.1
140 >=dev-perl/Template-Toolkit-2.19
141 >=virtual/perl-Time-HiRes-1.97.15
142 >=dev-perl/XML-Parser-2.36
143 >=dev-perl/Cache-Cache-1.04
144 >=dev-perl/Class-Data-Inheritable-0.08
145 >=dev-perl/Class-Inspector-1.23
146 >=dev-perl/File-Next-1.02
147 >=virtual/perl-File-Temp-0.20
148 >=dev-perl/File-Which-0.05
149 >=perl-core/i18n-langtags-0.35
150 >=dev-perl/IO-String-1.08
151 >=dev-perl/Log-Log4perl-1.13
152 >=dev-perl/libwww-perl-5.805
153 >=perl-core/CGI-3.29
154 >=dev-perl/TimeDate-1.16
155 >=dev-perl/Math-VecStat-0.08
156 >=dev-perl/Net-DNS-0.63
157 >=dev-perl/Path-Class-0.16
158 >=dev-perl/SQL-Abstract-1.56
159 >=dev-perl/SQL-Abstract-Limit-0.12
160 >=dev-perl/URI-1.35
161 >=dev-perl/XML-Simple-2.18
162 >=perl-core/version-0.76
163 >=dev-perl/Carp-Clan-5.9
164 >=dev-perl/Readonly-1.03
165 >=dev-perl/Carp-Assert-0.20
166 >=dev-perl/Class-Virtual-0.06
167 >=dev-perl/File-Slurp-9999.13
168 >=dev-perl/Exporter-Lite-0.02
169 >=dev-perl/Tie-IxHash-1.21
170 >=virtual/perl-Module-Pluggable-3.6
171 >=dev-perl/Archive-Zip-1.23
172 >=dev-perl/AnyEvent-5.2
173 >=dev-perl/Sub-Name-0.04
174 >=dev-perl/Module-Find-0.08
175 >=dev-perl/Class-Accessor-0.31
176 >=dev-perl/Class-XSAccessor-1.05
177 >=dev-perl/AutoXS-Header-1.02
178 >=dev-perl/Scope-Guard-0.03
179 >=dev-perl/Class-C3-XS-0.13
180 >=dev-perl/Class-C3-0.21
181 >=dev-perl/Class-C3-Componentised-1.0006
182 >=dev-perl/File-ReadBackwards-1.04
183 ~dev-perl/DBIx-Class-0.08120
184 >=dev-perl/JSON-XS-VersionOneAndTwo-0.31
185 >=dev-perl/MRO-Compat-0.11
186 >=dev-perl/PAR-0.994
187 >=dev-perl/enum-1.016
188 >=dev-perl/URI-Find-20100211
189 >=dev-perl/Algorithm-C3-0.08
190 >=dev-perl/Text-Unidecode-0.04
191 >=dev-perl/Net-UPnP-1.4.2
192 >=dev-perl/File-BOM-0.14
193 >=dev-perl/Proc-Background-1.10
194 >=dev-perl/Tie-Cache-LRU-20081023.2116
195 >=dev-perl/Tie-Cache-LRU-Expires-0.54
196 >=dev-perl/Data-Dump-1.15
197 >=dev-perl/Data-Page-2.02
198 >=dev-perl/Data-URIEncode-0.11
199 >=dev-perl/Tie-LLHash-1.003
200 >=dev-perl/Tie-RegexpHash-0.15
201 >=dev-perl/Data-UUID-1.202
202 >=perl-core/Class-ISA-0.36
203 lame? ( media-sound/lame )
204 wavpack? ( media-sound/wavpack )
205 flac? (
206 media-libs/flac
207 media-sound/sox[flac]
208 )
209 ogg? ( media-sound/sox[ogg] )
210 aac? ( media-libs/faad2 )
211 "
212
213 S="${WORKDIR}/${MY_P_BUILD_NUM}"
214
215 ETCDIR="/etc/squeezeboxserver"
216 PREFS="${ETCDIR}/squeezeboxserver.prefs"
217 PREFSDIR="${ETCDIR}/prefs"
218 PREFS2="${PREFSDIR}/server.prefs"
219 DOCDIR="/usr/share/doc/squeezeboxserver-${PV}"
220 SHAREDIR="/usr/share/squeezeboxserver"
221 LIBDIR="/usr/$(get_libdir)/squeezeboxserver"
222 OLDDBUSER="squeezecenter"
223 DBUSER="squeezeboxserver"
224 VARLIBSBS="/var/lib/squeezeboxserver"
225 PLUGINSDIR="${VARLIBSBS}/Plugins"
226
227 # To support Migration
228 OLDETCDIR="/etc/squeezecenter"
229 OLDPREFSDIR="/var/lib/squeezecenter/prefs"
230 OLDPREFSFILE="${OLDPREFSDIR}/server.prefs"
231 OLDPLUGINSDIR="/var/lib/squeezecenter/Plugins"
232 MIGMARKER=".migrated"
233
234 pkg_setup() {
235 # Create the user and group if not already present
236 enewgroup squeezeboxserver
237 enewuser squeezeboxserver -1 -1 "/dev/null" squeezeboxserver
238 }
239
240 src_prepare() {
241 # Apply patches
242 epatch "${FILESDIR}/${P}-build-perl-modules-gentoo.patch"
243 epatch "${FILESDIR}/${P}-uuid-gentoo.patch"
244 epatch "${FILESDIR}/${P}-squeezeslave.patch"
245
246 # Copy in the module builder - can't run it from the files directory in case
247 # Portage is mounted 'noexec'.
248 cp "${FILESDIR}/build-modules-${PVR}.sh" "${S}/build-modules.sh" || die
249 chmod 555 "${S}/build-modules.sh" || die
250 }
251
252 # Building of EV present because of bug#287857.
253 src_compile() {
254 einfo "Building bundled Perl modules (some warnings are normal here)..."
255 "./build-modules.sh" "${DISTDIR}" "${S}/perl-modules" || die "Unable to build Perl modules"
256 }
257
258 src_install() {
259
260 # The main Perl executables
261 exeinto /usr/sbin
262 newexe slimserver.pl squeezeboxserver || die "Failed to install server executable"
263 newexe scanner.pl squeezeboxserver-scanner || die "Failed to install scanner executable"
264 newexe cleanup.pl squeezeboxserver-cleanup || die "Failed to install cleanup executable"
265
266 # The custom OS module for Gentoo - provides OS-specific path details
267 cp "${FILESDIR}/gentoo-filepaths.pm" "Slim/Utils/OS/Custom.pm" || die "Unable to install Gentoo custom OS module"
268
269 # The server Perl modules
270 local installvendorlib
271 eval `perl '-V:installvendorlib'`
272 dodir "${installvendorlib}"
273 cp -r Slim "${D}${installvendorlib}" || die "Unable to install server Perl modules"
274
275 # Various directories of architecture-independent static files
276 dodir "${SHAREDIR}"
277 cp -r Firmware "${D}/${SHAREDIR}" || die "Unable to install firmware"
278 cp -r Graphics "${D}/${SHAREDIR}" || die "Unable to install Graphics"
279 cp -r HTML "${D}/${SHAREDIR}" || die "Unable to install HTML"
280 cp -r IR "${D}/${SHAREDIR}" || die "Unable to install IR"
281 cp -r SQL "${D}/${SHAREDIR}" || die "Unable to install SQL"
282
283 # Remove bundled modified AnyEvent - we depend on a newer version now
284 rm -r lib/AnyEvent.pm lib/AnyEvent || die "Unable to remove bundled AnyEvent"
285
286 # Architecture-dependent static files
287 dodir "${LIBDIR}"
288 cp -r lib/* "${D}${LIBDIR}" || die "Unable to install architecture-dependent files"
289
290 # Install compiled Perl modules because of bug#287857.
291 dodir "${LIBDIR}/CPAN/arch"
292 mv perl-modules/*/*/*/* "${D}${LIBDIR}/CPAN/arch" || die "Unable to install compiled CPAN modules"
293
294 # Strings and version identification
295 insinto "${SHAREDIR}"
296 doins strings.txt
297 doins revision.txt
298
299 # Documentation
300 dodoc Changelog*.html
301 dodoc Installation.txt
302 dodoc License*.txt
303 dodoc "${FILESDIR}/Gentoo-plugins-README.txt"
304 dodoc "${FILESDIR}/Gentoo-detailed-changelog.txt"
305
306 # Configuration files and preferences
307 insinto "${ETCDIR}"
308 doins convert.conf
309 doins types.conf
310 doins modules.conf
311 newins "${FILESDIR}/squeezeboxserver.prefs" squeezeboxserver.prefs
312
313 # Preferences directory
314 dodir "${PREFSDIR}"
315 fowners squeezeboxserver:squeezeboxserver "${PREFSDIR}"
316 fperms 770 "${PREFSDIR}"
317
318 # Install init scripts
319 newconfd "${FILESDIR}/squeezeboxserver.conf.d" squeezeboxserver
320 newinitd "${FILESDIR}/squeezeboxserver.init.d" squeezeboxserver
321
322 # Install the SQL configuration scripts
323 insinto "${SHAREDIR}/SQL/mysql"
324 doins "${FILESDIR}/dbdrop-gentoo.sql"
325 doins "${FILESDIR}/dbcreate-gentoo.sql"
326
327 # Initialize run directory (where the PID file lives)
328 dodir /var/run/squeezeboxserver
329 fowners squeezeboxserver:squeezeboxserver /var/run/squeezeboxserver
330 fperms 770 /var/run/squeezeboxserver
331
332 # Initialize server cache directory
333 dodir /var/lib/squeezeboxserver/cache
334 fowners squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver/cache
335 fperms 770 /var/lib/squeezeboxserver/cache
336
337 # Initialize the log directory
338 dodir /var/log/squeezeboxserver
339 fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver
340 fperms 770 /var/log/squeezeboxserver
341 touch "${D}/var/log/squeezeboxserver/server.log"
342 touch "${D}/var/log/squeezeboxserver/scanner.log"
343 touch "${D}/var/log/squeezeboxserver/perfmon.log"
344 fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/server.log
345 fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/scanner.log
346 fowners squeezeboxserver:squeezeboxserver /var/log/squeezeboxserver/perfmon.log
347
348 # Initialise the user-installed plugins directory
349 dodir "${PLUGINSDIR}"
350 fowners squeezeboxserver:squeezeboxserver "${PLUGINSDIR}"
351 fperms 770 "${PLUGINSDIR}"
352
353 # Install logrotate support
354 insinto /etc/logrotate.d
355 newins "${FILESDIR}/squeezeboxserver.logrotate.d" squeezeboxserver
356 }
357
358 sc_starting_instr() {
359 elog "Squeezebox Server can be started with the following command:"
360 elog "\t/etc/init.d/squeezeboxserver start"
361 elog ""
362 elog "Squeezebox Server can be automatically started on each boot with the"
363 elog "following command:"
364 elog "\trc-update add squeezeboxserver default"
365 elog ""
366 elog "You might want to examine and modify the following configuration"
367 elog "file before starting Squeezebox Server:"
368 elog "\t/etc/conf.d/squeezeboxserver"
369 elog ""
370
371 # Discover the port number from the preferences, but if it isn't there
372 # then report the standard one.
373 httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${LIVE_PREFS}" 2>/dev/null)
374 elog "You may access and configure Squeezebox Server by browsing to:"
375 elog "\thttp://localhost:${httpport:-9000}/"
376 }
377
378 pkg_postinst() {
379 # FLAC and LAME are quite useful (but not essential) for Squeezebox Server -
380 # if they're not enabled then make sure the user understands that.
381 if ! use flac; then
382 ewarn "'flac' USE flag is not set. Although not essential, FLAC is required"
383 ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for"
384 ewarn "playing other less common file types (if you have a Squeezebox 2 or newer)."
385 ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag".
386 ewarn ""
387 fi
388 if ! use lame; then
389 ewarn "'lame' USE flag is not set. Although not essential, LAME is"
390 ewarn "required if you want to limit the bandwidth your Squeezebox or"
391 ewarn "Transporter uses when streaming audio."
392 ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag".
393 ewarn ""
394 fi
395
396 # Album art requires PNG and JPEG support from GD, so if it's not there
397 # then warn the user. It's not mandatory as the user may not be using
398 # album art.
399 if ! has_version dev-perl/GD[jpeg] || \
400 ! has_version dev-perl/GD[png] || \
401 ! has_version media-libs/gd[jpeg] || \
402 ! has_version media-libs/gd[png]; then
403 ewarn "For correct operation of album art through Squeezebox Server's web"
404 ewarn "interface the GD library and Perl module must be built with PNG"
405 ewarn "and JPEG support. If necessary you can add the following lines"
406 ewarn "to the file /etc/portage/package.use:"
407 ewarn "\tdev-perl/GD jpeg png"
408 ewarn "\tmedia-libs/gd jpeg png"
409 ewarn "And then rebuild those packages with:"
410 ewarn "\temerge --newuse dev-perl/GD media-libs/gd"
411 ewarn ""
412 fi
413
414 # Point user to database configuration step
415 elog "If this is a new installation of Squeezebox Server then the database"
416 elog "must be configured prior to use. This can be done by running the"
417 elog "following command:"
418 elog "\temerge --config =${CATEGORY}/${PF}"
419 elog "This command will also migrate old SqueezeCenter preferences and"
420 elog "plugins (if present)."
421
422 elog ""
423
424 ewarn "Note: If Squeezebox Server dies after the initial configuration"
425 ewarn " after an upgrade from a previous installation, try removing"
426 ewarn " /var/lib/squeezeboxserver and /etc/squeezeboxserver and"
427 ewarn " then reinstalling the package (note that old preferences"
428 ewarn " and plugins will be lost). See bug #307119."
429
430 elog ""
431
432 sc_starting_instr
433 }
434
435 sc_remove_db_prefs() {
436 MY_PREFS=$1
437
438 einfo "Configuring Squeezebox Server database preferences (${MY_PREFS}) ..."
439 TMPPREFS="${T}"/squeezeboxserver-prefs-$$
440 touch "${ROOT}${MY_PREFS}"
441 sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}"
442 mv "${TMPPREFS}" "${ROOT}${MY_PREFS}"
443 chown squeezeboxserver:squeezeboxserver "${ROOT}${MY_PREFS}"
444 chmod 660 "${ROOT}${MY_PREFS}"
445 }
446
447 sc_update_prefs() {
448 MY_PREFS=$1
449 MY_DBUSER=$2
450 MY_DBUSER_PASSWD=$3
451
452 echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}"
453 echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}"
454 echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}"
455 }
456
457 pkg_config() {
458 einfo "Press ENTER to create the Squeezebox Server database and set proper"
459 einfo "permissions on it. You will be prompted for the MySQL 'root' user's"
460 einfo "password during this process (note that the MySQL 'root' user is"
461 einfo "independent of the Linux 'root' user and so may have a different"
462 einfo "password)."
463 einfo ""
464 einfo "If you already have a Squeezebox Server database set up then this"
465 einfo "process will clear the existing database (your music files will not,"
466 einfo "however, be affected)."
467 einfo ""
468 einfo "Alternatively, press Control-C to abort now..."
469 read
470
471 # Get the MySQL root password from the user (not echoed to the terminal)
472 einfo "The MySQL 'root' user password is required to create the"
473 einfo "Squeezebox Server user and database."
474 DONE=0
475 while [ $DONE -eq 0 ]; do
476 trap "stty echo; echo" EXIT
477 stty -echo
478 read -p "MySQL root password: " ROOT_PASSWD; echo
479 stty echo
480 trap ":" EXIT
481 echo quit | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 && DONE=1
482 if [ $DONE -eq 0 ]; then
483 eerror "Incorrect MySQL root password, or MySQL is not running"
484 fi
485 done
486
487 # Get the new password for the Squeezebox Server MySQL database user, and
488 # have it re-entered to confirm it. We should trivially check it's not
489 # the same as the MySQL root password.
490 einfo "A new MySQL user will be added to own the Squeezebox Server database."
491 einfo "Please enter the password for this new user (${DBUSER})."
492 DONE=0
493 while [ $DONE -eq 0 ]; do
494 trap "stty echo; echo" EXIT
495 stty -echo
496 read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo
497 stty echo
498 trap ":" EXIT
499 if [ -z "$DBUSER_PASSWD" ]; then
500 eerror "The password should not be blank; try again."
501 elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then
502 eerror "The ${DBUSER} password should be different to the root password"
503 else
504 DONE=1
505 fi
506 done
507
508 # Drop the existing database and user - note we don't care about errors
509 # from this as it probably just indicates that the database wasn't
510 # yet present.
511 einfo "Dropping old Squeezebox Server database and user ..."
512 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
513
514 # Drop and create the Squeezebox Server user and database.
515 einfo "Creating Squeezebox Server MySQL user and database (${DBUSER}) ..."
516 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"
517
518 # Migrate old preferences, if present.
519 if [ -d "${OLDPREFSFILE}" ]; then
520 if [ -f "${ETCDIR}/${MIGMARKER}" ]; then
521 einfo ""
522 einfo "Old preferences are present, but they appear to have been"
523 einfo "migrated before. If you would like to re-migrate the old"
524 einfo "SqueezeCenter preferences remove the following file, and"
525 einfo "then restart the configuration."
526 einfo "\t${ETCDIR}/${MIGMARKER}"
527 else
528 einfo "Migrating old SqueezeCenter preferences"
529 cp -r "${OLDPREFSDIR}" "${VARLIBSBS}"
530 mv "${VARLIBSBS}/prefs/server.prefs" "/etc/squeezeboxserver/squeezeboxserver.prefs"
531 chown -R squeezeboxserver:squeezeboxserver "${PREFSDIR}"
532 touch "${PREFSDIR}/${MIGMARKER}"
533 fi
534 fi
535
536 # Migrate old plugins, if present.
537 if [ -d "${OLDPLUGINSDIR}" ]; then
538 if [ -f "${PLUGINSDIR}/${MIGMARKER}" ]; then
539 einfo ""
540 einfo "Old plugins are present, but they appear to have been"
541 einfo "migrated before. If you would like to re-migrate the old"
542 einfo "SqueezeCenter preferences remove the following file, and"
543 einfo "then restart the configuration."
544 einfo "\t${PLUGINSDIR}/${MIGMARKER}"
545 else
546 einfo "Migrating old SqueezeCenter plugins"
547 cp -r "${OLDPLUGINSDIR}" "${VARLIBSBS}"
548 chown -R squeezeboxserver:squeezeboxserver "${PLUGINSDIR}"
549 touch "${PLUGINSDIR}/${MIGMARKER}"
550 fi
551 fi
552
553 # Remove the existing MySQL preferences from Squeezebox Server (if any).
554 sc_remove_db_prefs "${PREFS}"
555 sc_remove_db_prefs "${PREFS2}"
556
557 # Insert the external MySQL configuration into the preferences.
558 sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}"
559 sc_update_prefs "${PREFS2}" "${DBUSER}" "${DBUSER_PASSWD}"
560
561 # Phew - all done. Give some tips on what to do now.
562 einfo "Database configuration complete."
563 einfo ""
564 sc_starting_instr
565 }
566
567 pkg_preinst() {
568 # Warn the user if there are old preferences that may need migrating.
569 if [ -d "${OLDPREFSDIR}" -a ! -f "${PREFSDIR}/${MIGMARKER}" ]; then
570 if [ ! -z "$(ls ${OLDPREFSDIR})" ]; then
571 ewarn "Note: It appears that old SqueezeCenter preferences are
572 installed at:"
573 ewarn "\t${OLDPREFSDIR}"
574 ewarn "These may be migrated by running the following command:"
575 ewarn "\temerge --config =${CATEGORY}/${PF}"
576 ewarn "(Please note that this will require your music collection to
577 be rescanned.)"
578 ewarn ""
579 fi
580 fi
581 }