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