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