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