1 |
lavajoe 08/09/13 22:47:01 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: squeezecenter-7.1.0-r1.ebuild |
5 |
squeezecenter-7.2.0-r1.ebuild |
6 |
Log: |
7 |
Do not install perl GD files so as not to conflict with installed dev-perl/GD package (bug #237548) |
8 |
(Portage version: 2.2_rc8/cvs/Linux 2.6.26-gentoo-r1 i686) |
9 |
|
10 |
Revision Changes Path |
11 |
1.25 media-sound/squeezecenter/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?rev=1.25&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?rev=1.25&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?r1=1.24&r2=1.25 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v |
20 |
retrieving revision 1.24 |
21 |
retrieving revision 1.25 |
22 |
diff -u -r1.24 -r1.25 |
23 |
--- ChangeLog 10 Sep 2008 20:02:16 -0000 1.24 |
24 |
+++ ChangeLog 13 Sep 2008 22:47:01 -0000 1.25 |
25 |
@@ -1,6 +1,14 @@ |
26 |
# ChangeLog for media-sound/squeezecenter |
27 |
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v 1.24 2008/09/10 20:02:16 lavajoe Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v 1.25 2008/09/13 22:47:01 lavajoe Exp $ |
30 |
+ |
31 |
+*squeezecenter-7.2.0-r1 (13 Sep 2008) |
32 |
+*squeezecenter-7.1.0-r1 (13 Sep 2008) |
33 |
+ |
34 |
+ 13 Sep 2008; Joe Peterson <lavajoe@g.o> |
35 |
+ +squeezecenter-7.1.0-r1.ebuild, +squeezecenter-7.2.0-r1.ebuild: |
36 |
+ Do not install perl GD files so as not to conflict with installed |
37 |
+ dev-perl/GD package (bug #237548) |
38 |
|
39 |
10 Sep 2008; Joe Peterson <lavajoe@g.o> squeezecenter-7.1.0.ebuild, |
40 |
squeezecenter-7.2.0.ebuild: |
41 |
|
42 |
|
43 |
|
44 |
1.1 media-sound/squeezecenter/squeezecenter-7.1.0-r1.ebuild |
45 |
|
46 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.1.0-r1.ebuild?rev=1.1&view=markup |
47 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.1.0-r1.ebuild?rev=1.1&content-type=text/plain |
48 |
|
49 |
Index: squeezecenter-7.1.0-r1.ebuild |
50 |
=================================================================== |
51 |
# Copyright 1999-2008 Gentoo Foundation |
52 |
# Distributed under the terms of the GNU General Public License v2 |
53 |
# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.1.0-r1.ebuild,v 1.1 2008/09/13 22:47:01 lavajoe Exp $ |
54 |
|
55 |
inherit eutils |
56 |
|
57 |
MAJOR_VER="${PV:0:3}" |
58 |
MINOR_VER="${PV:4:1}" |
59 |
SRC_DIR="SqueezeCenter_v${MAJOR_VER}.${MINOR_VER}" |
60 |
MY_P="squeezecenter-${MAJOR_VER}-noCPAN" |
61 |
|
62 |
DESCRIPTION="Logitech SqueezeCenter music server" |
63 |
HOMEPAGE="http://www.slimdevices.com/pi_features.html" |
64 |
SRC_URI="http://www.slimdevices.com/downloads/${SRC_DIR}/${MY_P}.tgz" |
65 |
LICENSE="GPL-2" |
66 |
SLOT="0" |
67 |
KEYWORDS="~amd64 ~ppc ~x86" |
68 |
IUSE="lame wavpack musepack alac ogg bonjour flac avahi" |
69 |
|
70 |
# Note: dev-perl/module-build necessary because of SC bug#5882 |
71 |
# (http://bugs.slimdevices.com/show_bug.cgi?id=5882). |
72 |
DEPEND=" |
73 |
dev-perl/File-Which |
74 |
dev-perl/module-build |
75 |
virtual/logger |
76 |
virtual/mysql |
77 |
avahi? ( net-dns/avahi ) |
78 |
ogg? ( media-sound/sox ) |
79 |
" |
80 |
# Note: dev-perl/GD necessary because of SC bug#6143 |
81 |
# (http://bugs.slimdevices.com/show_bug.cgi?id=6143). |
82 |
RDEPEND="${DEPEND} |
83 |
>=dev-lang/perl-5.8.8 |
84 |
>=dev-perl/GD-2.35 |
85 |
>=app-admin/sudo-1.6.8 |
86 |
alac? ( media-sound/alac_decoder ) |
87 |
lame? ( media-sound/lame ) |
88 |
wavpack? ( media-sound/wavpack ) |
89 |
bonjour? ( net-misc/mDNSResponder ) |
90 |
flac? ( media-libs/flac ) |
91 |
musepack? ( media-sound/musepack-tools ) |
92 |
" |
93 |
|
94 |
S="${WORKDIR}/${MY_P}" |
95 |
|
96 |
PREFS="/var/lib/squeezecenter/prefs/squeezecenter.prefs" |
97 |
LIVE_PREFS="/var/lib/squeezecenter/prefs/server.prefs" |
98 |
DOCDIR="/usr/share/doc/squeezecenter-${MAJOR_VER}.${MINOR_VER}" |
99 |
SHAREDIR="/usr/share/squeezecenter" |
100 |
LIBDIR="/usr/lib/squeezecenter" |
101 |
DBUSER="squeezecenter" |
102 |
OLDPLUGINSDIR=/opt/squeezecenter/Plugins |
103 |
NEWPLUGINSDIR=/var/lib/squeezecenter/Plugins |
104 |
|
105 |
pkg_setup() { |
106 |
# Sox has optional OGG support, so make sure it has been built that way |
107 |
if use ogg; then |
108 |
if ! built_with_use media-sound/sox ogg; then |
109 |
eerror "media-sound/sox not built with USE=ogg" |
110 |
die "media-sound/sox not built with USE=ogg" |
111 |
fi |
112 |
fi |
113 |
|
114 |
# Create the user and group if not already present |
115 |
enewgroup squeezecenter |
116 |
enewuser squeezecenter -1 -1 "/dev/null" squeezecenter |
117 |
} |
118 |
|
119 |
src_unpack() { |
120 |
unpack ${A} |
121 |
cd "${S}" |
122 |
|
123 |
# Apply patches |
124 |
epatch "${FILESDIR}/mDNSResponder-${MAJOR_VER}-gentoo.patch" |
125 |
epatch "${FILESDIR}/filepaths-${MAJOR_VER}-gentoo.patch" |
126 |
|
127 |
# Prune GD from the SqueezeCenter local CPAN. This is due to |
128 |
# SC bug#5882 which means we need to bring in Portage's version of GD, |
129 |
# which will fail if it is different to the version in the local CPAN |
130 |
# tree. SqueezeCenter will then use the system-installed dev-perl/GD. |
131 |
# (This fixes Gentoo bug #237548) |
132 |
rm -r CPAN/GD.pm CPAN/GD || die "Unable to remove local CPAN GD" |
133 |
} |
134 |
|
135 |
src_compile() { |
136 |
einfo "Building required Perl modules (some warnings are normal here) ..." |
137 |
mkdir "${T}/sc_compile" |
138 |
echo -e "\n${S}\n${T}/sc_compile" | Bin/build-perl-modules.pl || die "Unable to build Perl modules" |
139 |
} |
140 |
|
141 |
src_install() { |
142 |
|
143 |
# The main Perl executables |
144 |
exeinto /usr/sbin |
145 |
newexe slimserver.pl squeezecenter-server |
146 |
newexe scanner.pl squeezecenter-scanner |
147 |
|
148 |
# Get the Perl package name and version |
149 |
eval `perl '-V:package'` |
150 |
eval `perl '-V:version'` |
151 |
|
152 |
# The server Perl modules |
153 |
dodir "/usr/lib/${package}/vendor_perl/${version}" |
154 |
cp -r Slim "${D}/usr/lib/${package}/vendor_perl/${version}" |
155 |
|
156 |
# Various directories of architecture-independent static files |
157 |
dodir "${SHAREDIR}" |
158 |
cp -r Firmware "${D}/${SHAREDIR}" |
159 |
cp -r Graphics "${D}/${SHAREDIR}" |
160 |
cp -r HTML "${D}/${SHAREDIR}" |
161 |
cp -r IR "${D}/${SHAREDIR}" |
162 |
cp -r SQL "${D}/${SHAREDIR}" |
163 |
cp -r CPAN "${D}/${SHAREDIR}" |
164 |
|
165 |
# Architecture-dependent static files |
166 |
dodir "${LIBDIR}" |
167 |
cp -r lib/* "${D}/${LIBDIR}" |
168 |
|
169 |
# Strings and version identification |
170 |
insinto "${SHAREDIR}" |
171 |
doins strings.txt |
172 |
doins revision.txt |
173 |
|
174 |
# Documentation |
175 |
dodoc Changelog*.html |
176 |
dodoc Installation.txt |
177 |
dodoc License*.txt |
178 |
newdoc "${FILESDIR}/Gentoo-plugins-README.txt" Gentoo-plugins-README.txt |
179 |
|
180 |
# Configuration files |
181 |
insinto /etc/squeezecenter |
182 |
doins convert.conf |
183 |
doins types.conf |
184 |
doins modules.conf |
185 |
|
186 |
# Install init scripts |
187 |
newconfd "${FILESDIR}/squeezecenter.conf.d" squeezecenter |
188 |
newinitd "${FILESDIR}/squeezecenter.init.d" squeezecenter |
189 |
|
190 |
# Install default preferences |
191 |
insinto /var/lib/squeezecenter/prefs |
192 |
newins "${FILESDIR}/squeezecenter.prefs" squeezecenter.prefs |
193 |
fowners squeezecenter:squeezecenter /var/lib/squeezecenter/prefs |
194 |
fperms 770 /var/lib/squeezecenter/prefs |
195 |
|
196 |
# Install the SQL configuration scripts |
197 |
insinto "${SHAREDIR}/SQL/mysql" |
198 |
doins "${FILESDIR}/dbdrop-gentoo.sql" |
199 |
doins "${FILESDIR}/dbcreate-gentoo.sql" |
200 |
|
201 |
# Initialize run directory (where the PID file lives) |
202 |
dodir /var/run/squeezecenter |
203 |
fowners squeezecenter:squeezecenter /var/run/squeezecenter |
204 |
fperms 770 /var/run/squeezecenter |
205 |
|
206 |
# Initialize server cache directory |
207 |
dodir /var/lib/squeezecenter/cache |
208 |
fowners squeezecenter:squeezecenter /var/lib/squeezecenter/cache |
209 |
fperms 770 /var/lib/squeezecenter/cache |
210 |
|
211 |
# Initialize the log directory |
212 |
dodir /var/log/squeezecenter |
213 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter |
214 |
fperms 770 /var/log/squeezecenter |
215 |
touch "${D}/var/log/squeezecenter/server.log" |
216 |
touch "${D}/var/log/squeezecenter/scanner.log" |
217 |
touch "${D}/var/log/squeezecenter/perfmon.log" |
218 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/server.log |
219 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/scanner.log |
220 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/perfmon.log |
221 |
|
222 |
# Initialise the user-installed plugins directory |
223 |
dodir "${NEWPLUGINSDIR}" |
224 |
|
225 |
# Install logrotate support |
226 |
insinto /etc/logrotate.d |
227 |
newins "${FILESDIR}/squeezecenter.logrotate.d" squeezecenter |
228 |
|
229 |
# Install Avahi support (if USE flag is set) |
230 |
if use avahi; then |
231 |
insinto /etc/avahi/services |
232 |
newins "${FILESDIR}/avahi-squeezecenter.service" squeezecenter.service |
233 |
fi |
234 |
} |
235 |
|
236 |
sc_starting_instr() { |
237 |
elog "SqueezeCenter can be started with the following command:" |
238 |
elog "\t/etc/init.d/squeezecenter start" |
239 |
elog "" |
240 |
elog "SqueezeCenter can be automatically started on each boot with the" |
241 |
elog "following command:" |
242 |
elog "\trc-update add squeezecenter default" |
243 |
elog "" |
244 |
elog "You might want to examine and modify the following configuration" |
245 |
elog "file before starting SqueezeCenter:" |
246 |
elog "\t/etc/conf.d/squeezecenter" |
247 |
elog "" |
248 |
|
249 |
# Discover the port number from the preferences, but if it isn't there |
250 |
# then report the standard one. |
251 |
httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${LIVE_PREFS}" 2>/dev/null) |
252 |
elog "You may access and configure SqueezeCenter by browsing to:" |
253 |
elog "\thttp://localhost:${httpport:-9000}/" |
254 |
} |
255 |
|
256 |
pkg_postinst() { |
257 |
# FLAC and LAME are quite useful (but not essential) for SqueezeCenter - |
258 |
# if they're not enabled then make sure the user understands that. |
259 |
if ! use flac; then |
260 |
ewarn "'flac' USE flag is not set. Although not essential, FLAC is required" |
261 |
ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for" |
262 |
ewarn "playing other less common file types (if you have a Squeezebox 2, 3," |
263 |
ewarn "Receiver or Transporter)." |
264 |
ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag". |
265 |
ewarn "" |
266 |
fi |
267 |
if ! use lame; then |
268 |
ewarn "'lame' USE flag is not set. Although not essential, LAME is" |
269 |
ewarn "required if you want to limit the bandwidth your Squeezebox or" |
270 |
ewarn "Transporter uses when streaming audio." |
271 |
ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag". |
272 |
ewarn "" |
273 |
fi |
274 |
|
275 |
# Album art requires PNG and JPEG support from GD, so if it's not there |
276 |
# then warn the user. It's not mandatory as the user may not be using |
277 |
# album art. |
278 |
if ! built_with_use dev-perl/GD jpeg || \ |
279 |
! built_with_use dev-perl/GD png || \ |
280 |
! built_with_use media-libs/gd jpeg || \ |
281 |
! built_with_use media-libs/gd png; then |
282 |
ewarn "For correct operation of album art through SqueezeCenter's web" |
283 |
ewarn "interface the GD library and Perl module must be built with PNG" |
284 |
ewarn "and JPEG support. If necessary you can add the following lines" |
285 |
ewarn "to the file /etc/portage/package.use:" |
286 |
ewarn "\tdev-perl/GD jpeg png" |
287 |
ewarn "\tmedia-libs/gd jpeg png" |
288 |
ewarn "And then rebuild those packages with:" |
289 |
ewarn "\temerge --newuse dev-perl/GD media-libs/gd" |
290 |
ewarn "" |
291 |
fi |
292 |
|
293 |
# Point user to database configuration step |
294 |
elog "If this is a new installation of SqueezeCenter then the database" |
295 |
elog "must be configured prior to use. This can be done by running the" |
296 |
elog "following command:" |
297 |
elog "\temerge --config =${CATEGORY}/${PF}" |
298 |
|
299 |
# Remind user to configure Avahi if necessary |
300 |
if use avahi; then |
301 |
elog "" |
302 |
elog "Avahi support installed. Remember to edit the folowing file if" |
303 |
elog "you run SqueezeCenter's web interface on a port other than 9000:" |
304 |
elog "\t/etc/avahi/services/squeezecenter.service" |
305 |
fi |
306 |
|
307 |
elog "" |
308 |
sc_starting_instr |
309 |
} |
310 |
|
311 |
sc_remove_db_prefs() { |
312 |
MY_PREFS=$1 |
313 |
|
314 |
einfo "Configuring SqueezeCenter database preferences (${MY_PREFS}) ..." |
315 |
TMPPREFS="${T}"/squeezecenter-prefs-$$ |
316 |
touch "${ROOT}${MY_PREFS}" |
317 |
sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}" |
318 |
mv "${TMPPREFS}" "${ROOT}${MY_PREFS}" |
319 |
chown squeezecenter:squeezecenter "${ROOT}${MY_PREFS}" |
320 |
chmod 660 "${ROOT}${MY_PREFS}" |
321 |
} |
322 |
|
323 |
sc_update_prefs() { |
324 |
MY_PREFS=$1 |
325 |
MY_DBUSER=$2 |
326 |
MY_DBUSER_PASSWD=$3 |
327 |
|
328 |
echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}" |
329 |
echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}" |
330 |
echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}" |
331 |
} |
332 |
|
333 |
pkg_config() { |
334 |
einfo "Press ENTER to create the SqueezeCenter database and set proper" |
335 |
einfo "permissions on it. You will be prompted for the MySQL 'root' user's" |
336 |
einfo "password during this process (note that the MySQL 'root' user is" |
337 |
einfo "independent of the Linux 'root' user and so may have a different" |
338 |
einfo "password)." |
339 |
einfo "" |
340 |
einfo "If you already have a SqueezeCenter database set up then this" |
341 |
einfo "process will clear the existing database (your music files will not," |
342 |
einfo "however, be affected)." |
343 |
einfo "" |
344 |
einfo "Alternatively, press Control-C to abort now..." |
345 |
read |
346 |
|
347 |
# Get the MySQL root password from the user (not echoed to the terminal) |
348 |
einfo "The MySQL 'root' user password is required to create the" |
349 |
einfo "SqueezeCenter user and database." |
350 |
DONE=0 |
351 |
while [ $DONE -eq 0 ]; do |
352 |
trap "stty echo; echo" EXIT |
353 |
stty -echo |
354 |
read -p "MySQL root password: " ROOT_PASSWD; echo |
355 |
stty echo |
356 |
trap ":" EXIT |
357 |
echo quit | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 && DONE=1 |
358 |
if [ $DONE -eq 0 ]; then |
359 |
eerror "Incorrect MySQL root password, or MySQL is not running" |
360 |
fi |
361 |
done |
362 |
|
363 |
# Get the new password for the SqueezeCenter MySQL database user, and |
364 |
# have it re-entered to confirm it. We should trivially check it's not |
365 |
# the same as the MySQL root password. |
366 |
einfo "A new MySQL user will be added to own the SqueezeCenter database." |
367 |
einfo "Please enter the password for this new user (${DBUSER})." |
368 |
DONE=0 |
369 |
while [ $DONE -eq 0 ]; do |
370 |
trap "stty echo; echo" EXIT |
371 |
stty -echo |
372 |
read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo |
373 |
stty echo |
374 |
trap ":" EXIT |
375 |
if [ -z "$DBUSER_PASSWD" ]; then |
376 |
eerror "The password should not be blank; try again." |
377 |
elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then |
378 |
eerror "The ${DBUSER} password should be different to the root password" |
379 |
else |
380 |
DONE=1 |
381 |
fi |
382 |
done |
383 |
|
384 |
# Drop the existing database and user - note we don't care about errors |
385 |
# from this as it probably just indicates that the database wasn't |
386 |
# yet present. |
387 |
einfo "Dropping old SqueezeCenter database and user ..." |
388 |
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 |
389 |
|
390 |
# Drop and create the SqueezeCenter user and database. |
391 |
einfo "Creating SqueezeCenter MySQL user and database (${DBUSER}) ..." |
392 |
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" |
393 |
|
394 |
# Remove the existing MySQL preferences from SqueezeCenter (if any). |
395 |
sc_remove_db_prefs "${PREFS}" |
396 |
[ -f "${LIVE_PREFS}" ] && sc_remove_db_prefs ${LIVE_PREFS} |
397 |
|
398 |
# Insert the external MySQL configuration into the preferences. |
399 |
sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" |
400 |
[ -f "${LIVE_PREFS}" ] && sc_update_prefs "${LIVE_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" |
401 |
|
402 |
# Phew - all done. Give some tips on what to do now. |
403 |
einfo "Database configuration complete." |
404 |
einfo "" |
405 |
sc_starting_instr |
406 |
} |
407 |
|
408 |
pkg_preinst() { |
409 |
# Warn the user if there are old plugins that he may need to migrate |
410 |
if [ -d "${OLDPLUGINSDIR}" ]; then |
411 |
if [ ! -z "$(ls ${OLDPLUGINSDIR})" ]; then |
412 |
ewarn "Note: It appears that plugins are installed in the old location of:" |
413 |
ewarn "${OLDPLUGINSDIR}" |
414 |
ewarn "If these are to be used then they must be migrated to the new location:" |
415 |
ewarn "${NEWPLUGINSDIR}" |
416 |
ewarn "" |
417 |
fi |
418 |
fi |
419 |
} |
420 |
|
421 |
|
422 |
|
423 |
1.1 media-sound/squeezecenter/squeezecenter-7.2.0-r1.ebuild |
424 |
|
425 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.2.0-r1.ebuild?rev=1.1&view=markup |
426 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.2.0-r1.ebuild?rev=1.1&content-type=text/plain |
427 |
|
428 |
Index: squeezecenter-7.2.0-r1.ebuild |
429 |
=================================================================== |
430 |
# Copyright 1999-2008 Gentoo Foundation |
431 |
# Distributed under the terms of the GNU General Public License v2 |
432 |
# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.2.0-r1.ebuild,v 1.1 2008/09/13 22:47:01 lavajoe Exp $ |
433 |
|
434 |
inherit eutils |
435 |
|
436 |
MAJOR_VER="${PV:0:3}" |
437 |
MINOR_VER="${PV:4:1}" |
438 |
SRC_DIR="SqueezeCenter_v${MAJOR_VER}.${MINOR_VER}" |
439 |
MY_P="squeezecenter-${MAJOR_VER}-noCPAN" |
440 |
|
441 |
DESCRIPTION="Logitech SqueezeCenter music server" |
442 |
HOMEPAGE="http://www.slimdevices.com/pi_features.html" |
443 |
SRC_URI="http://www.slimdevices.com/downloads/${SRC_DIR}/${MY_P}.tgz" |
444 |
LICENSE="GPL-2" |
445 |
SLOT="0" |
446 |
KEYWORDS="~amd64 ~ppc ~x86" |
447 |
IUSE="lame wavpack musepack alac ogg bonjour flac avahi" |
448 |
|
449 |
# Note: dev-perl/module-build necessary because of SC bug#5882 |
450 |
# (http://bugs.slimdevices.com/show_bug.cgi?id=5882). |
451 |
DEPEND=" |
452 |
dev-perl/File-Which |
453 |
dev-perl/module-build |
454 |
virtual/logger |
455 |
virtual/mysql |
456 |
avahi? ( net-dns/avahi ) |
457 |
ogg? ( media-sound/sox ) |
458 |
" |
459 |
# Note: dev-perl/GD necessary because of SC bug#6143 |
460 |
# (http://bugs.slimdevices.com/show_bug.cgi?id=6143). |
461 |
RDEPEND="${DEPEND} |
462 |
>=dev-lang/perl-5.8.8 |
463 |
>=dev-perl/GD-2.35 |
464 |
>=app-admin/sudo-1.6.8 |
465 |
alac? ( media-sound/alac_decoder ) |
466 |
lame? ( media-sound/lame ) |
467 |
wavpack? ( media-sound/wavpack ) |
468 |
bonjour? ( net-misc/mDNSResponder ) |
469 |
flac? ( media-libs/flac ) |
470 |
musepack? ( media-sound/musepack-tools ) |
471 |
" |
472 |
|
473 |
S="${WORKDIR}/${MY_P}" |
474 |
|
475 |
PREFS="/var/lib/squeezecenter/prefs/squeezecenter.prefs" |
476 |
LIVE_PREFS="/var/lib/squeezecenter/prefs/server.prefs" |
477 |
DOCDIR="/usr/share/doc/squeezecenter-${MAJOR_VER}.${MINOR_VER}" |
478 |
SHAREDIR="/usr/share/squeezecenter" |
479 |
LIBDIR="/usr/lib/squeezecenter" |
480 |
DBUSER="squeezecenter" |
481 |
OLDPLUGINSDIR=/opt/squeezecenter/Plugins |
482 |
NEWPLUGINSDIR=/var/lib/squeezecenter/Plugins |
483 |
|
484 |
pkg_setup() { |
485 |
# Sox has optional OGG support, so make sure it has been built that way |
486 |
if use ogg; then |
487 |
if ! built_with_use media-sound/sox ogg; then |
488 |
eerror "media-sound/sox not built with USE=ogg" |
489 |
die "media-sound/sox not built with USE=ogg" |
490 |
fi |
491 |
fi |
492 |
|
493 |
# Create the user and group if not already present |
494 |
enewgroup squeezecenter |
495 |
enewuser squeezecenter -1 -1 "/dev/null" squeezecenter |
496 |
} |
497 |
|
498 |
src_unpack() { |
499 |
unpack ${A} |
500 |
cd "${S}" |
501 |
|
502 |
# Apply patches |
503 |
epatch "${FILESDIR}/mDNSResponder-gentoo.patch" |
504 |
epatch "${FILESDIR}/filepaths-gentoo.patch" |
505 |
|
506 |
# Prune GD from the SqueezeCenter local CPAN. This is due to |
507 |
# SC bug#5882 which means we need to bring in Portage's version of GD, |
508 |
# which will fail if it is different to the version in the local CPAN |
509 |
# tree. SqueezeCenter will then use the system-installed dev-perl/GD. |
510 |
# (This fixes Gentoo bug #237548) |
511 |
rm -r CPAN/GD.pm CPAN/GD || die "Unable to remove local CPAN GD" |
512 |
} |
513 |
|
514 |
src_compile() { |
515 |
einfo "Building required Perl modules (some warnings are normal here) ..." |
516 |
mkdir "${T}/sc_compile" |
517 |
echo -e "\n${S}\n${T}/sc_compile" | Bin/build-perl-modules.pl || die "Unable to build Perl modules" |
518 |
} |
519 |
|
520 |
src_install() { |
521 |
|
522 |
# The main Perl executables |
523 |
exeinto /usr/sbin |
524 |
newexe slimserver.pl squeezecenter-server |
525 |
newexe scanner.pl squeezecenter-scanner |
526 |
|
527 |
# Get the Perl package name and version |
528 |
eval `perl '-V:package'` |
529 |
eval `perl '-V:version'` |
530 |
|
531 |
# The server Perl modules |
532 |
dodir "/usr/lib/${package}/vendor_perl/${version}" |
533 |
cp -r Slim "${D}/usr/lib/${package}/vendor_perl/${version}" |
534 |
|
535 |
# Various directories of architecture-independent static files |
536 |
dodir "${SHAREDIR}" |
537 |
cp -r Firmware "${D}/${SHAREDIR}" |
538 |
cp -r Graphics "${D}/${SHAREDIR}" |
539 |
cp -r HTML "${D}/${SHAREDIR}" |
540 |
cp -r IR "${D}/${SHAREDIR}" |
541 |
cp -r SQL "${D}/${SHAREDIR}" |
542 |
cp -r CPAN "${D}/${SHAREDIR}" |
543 |
|
544 |
# Architecture-dependent static files |
545 |
dodir "${LIBDIR}" |
546 |
cp -r lib/* "${D}/${LIBDIR}" |
547 |
|
548 |
# Strings and version identification |
549 |
insinto "${SHAREDIR}" |
550 |
doins strings.txt |
551 |
doins revision.txt |
552 |
|
553 |
# Documentation |
554 |
dodoc Changelog*.html |
555 |
dodoc Installation.txt |
556 |
dodoc License*.txt |
557 |
newdoc "${FILESDIR}/Gentoo-plugins-README.txt" Gentoo-plugins-README.txt |
558 |
|
559 |
# Configuration files |
560 |
insinto /etc/squeezecenter |
561 |
doins convert.conf |
562 |
doins types.conf |
563 |
doins modules.conf |
564 |
|
565 |
# Install init scripts |
566 |
newconfd "${FILESDIR}/squeezecenter.conf.d" squeezecenter |
567 |
newinitd "${FILESDIR}/squeezecenter.init.d" squeezecenter |
568 |
|
569 |
# Install default preferences |
570 |
insinto /var/lib/squeezecenter/prefs |
571 |
newins "${FILESDIR}/squeezecenter.prefs" squeezecenter.prefs |
572 |
fowners squeezecenter:squeezecenter /var/lib/squeezecenter/prefs |
573 |
fperms 770 /var/lib/squeezecenter/prefs |
574 |
|
575 |
# Install the SQL configuration scripts |
576 |
insinto "${SHAREDIR}/SQL/mysql" |
577 |
doins "${FILESDIR}/dbdrop-gentoo.sql" |
578 |
doins "${FILESDIR}/dbcreate-gentoo.sql" |
579 |
|
580 |
# Initialize run directory (where the PID file lives) |
581 |
dodir /var/run/squeezecenter |
582 |
fowners squeezecenter:squeezecenter /var/run/squeezecenter |
583 |
fperms 770 /var/run/squeezecenter |
584 |
|
585 |
# Initialize server cache directory |
586 |
dodir /var/lib/squeezecenter/cache |
587 |
fowners squeezecenter:squeezecenter /var/lib/squeezecenter/cache |
588 |
fperms 770 /var/lib/squeezecenter/cache |
589 |
|
590 |
# Initialize the log directory |
591 |
dodir /var/log/squeezecenter |
592 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter |
593 |
fperms 770 /var/log/squeezecenter |
594 |
touch "${D}/var/log/squeezecenter/server.log" |
595 |
touch "${D}/var/log/squeezecenter/scanner.log" |
596 |
touch "${D}/var/log/squeezecenter/perfmon.log" |
597 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/server.log |
598 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/scanner.log |
599 |
fowners squeezecenter:squeezecenter /var/log/squeezecenter/perfmon.log |
600 |
|
601 |
# Initialise the user-installed plugins directory |
602 |
dodir "${NEWPLUGINSDIR}" |
603 |
|
604 |
# Install logrotate support |
605 |
insinto /etc/logrotate.d |
606 |
newins "${FILESDIR}/squeezecenter.logrotate.d" squeezecenter |
607 |
|
608 |
# Install Avahi support (if USE flag is set) |
609 |
if use avahi; then |
610 |
insinto /etc/avahi/services |
611 |
newins "${FILESDIR}/avahi-squeezecenter.service" squeezecenter.service |
612 |
fi |
613 |
} |
614 |
|
615 |
sc_starting_instr() { |
616 |
elog "SqueezeCenter can be started with the following command:" |
617 |
elog "\t/etc/init.d/squeezecenter start" |
618 |
elog "" |
619 |
elog "SqueezeCenter can be automatically started on each boot with the" |
620 |
elog "following command:" |
621 |
elog "\trc-update add squeezecenter default" |
622 |
elog "" |
623 |
elog "You might want to examine and modify the following configuration" |
624 |
elog "file before starting SqueezeCenter:" |
625 |
elog "\t/etc/conf.d/squeezecenter" |
626 |
elog "" |
627 |
|
628 |
# Discover the port number from the preferences, but if it isn't there |
629 |
# then report the standard one. |
630 |
httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${LIVE_PREFS}" 2>/dev/null) |
631 |
elog "You may access and configure SqueezeCenter by browsing to:" |
632 |
elog "\thttp://localhost:${httpport:-9000}/" |
633 |
} |
634 |
|
635 |
pkg_postinst() { |
636 |
# FLAC and LAME are quite useful (but not essential) for SqueezeCenter - |
637 |
# if they're not enabled then make sure the user understands that. |
638 |
if ! use flac; then |
639 |
ewarn "'flac' USE flag is not set. Although not essential, FLAC is required" |
640 |
ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for" |
641 |
ewarn "playing other less common file types (if you have a Squeezebox 2, 3," |
642 |
ewarn "Receiver or Transporter)." |
643 |
ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag". |
644 |
ewarn "" |
645 |
fi |
646 |
if ! use lame; then |
647 |
ewarn "'lame' USE flag is not set. Although not essential, LAME is" |
648 |
ewarn "required if you want to limit the bandwidth your Squeezebox or" |
649 |
ewarn "Transporter uses when streaming audio." |
650 |
ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag". |
651 |
ewarn "" |
652 |
fi |
653 |
|
654 |
# Album art requires PNG and JPEG support from GD, so if it's not there |
655 |
# then warn the user. It's not mandatory as the user may not be using |
656 |
# album art. |
657 |
if ! built_with_use dev-perl/GD jpeg || \ |
658 |
! built_with_use dev-perl/GD png || \ |
659 |
! built_with_use media-libs/gd jpeg || \ |
660 |
! built_with_use media-libs/gd png; then |
661 |
ewarn "For correct operation of album art through SqueezeCenter's web" |
662 |
ewarn "interface the GD library and Perl module must be built with PNG" |
663 |
ewarn "and JPEG support. If necessary you can add the following lines" |
664 |
ewarn "to the file /etc/portage/package.use:" |
665 |
ewarn "\tdev-perl/GD jpeg png" |
666 |
ewarn "\tmedia-libs/gd jpeg png" |
667 |
ewarn "And then rebuild those packages with:" |
668 |
ewarn "\temerge --newuse dev-perl/GD media-libs/gd" |
669 |
ewarn "" |
670 |
fi |
671 |
|
672 |
# Point user to database configuration step |
673 |
elog "If this is a new installation of SqueezeCenter then the database" |
674 |
elog "must be configured prior to use. This can be done by running the" |
675 |
elog "following command:" |
676 |
elog "\temerge --config =${CATEGORY}/${PF}" |
677 |
|
678 |
# Remind user to configure Avahi if necessary |
679 |
if use avahi; then |
680 |
elog "" |
681 |
elog "Avahi support installed. Remember to edit the folowing file if" |
682 |
elog "you run SqueezeCenter's web interface on a port other than 9000:" |
683 |
elog "\t/etc/avahi/services/squeezecenter.service" |
684 |
fi |
685 |
|
686 |
elog "" |
687 |
sc_starting_instr |
688 |
} |
689 |
|
690 |
sc_remove_db_prefs() { |
691 |
MY_PREFS=$1 |
692 |
|
693 |
einfo "Configuring SqueezeCenter database preferences (${MY_PREFS}) ..." |
694 |
TMPPREFS="${T}"/squeezecenter-prefs-$$ |
695 |
touch "${ROOT}${MY_PREFS}" |
696 |
sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}" |
697 |
mv "${TMPPREFS}" "${ROOT}${MY_PREFS}" |
698 |
chown squeezecenter:squeezecenter "${ROOT}${MY_PREFS}" |
699 |
chmod 660 "${ROOT}${MY_PREFS}" |
700 |
} |
701 |
|
702 |
sc_update_prefs() { |
703 |
MY_PREFS=$1 |
704 |
MY_DBUSER=$2 |
705 |
MY_DBUSER_PASSWD=$3 |
706 |
|
707 |
echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}" |
708 |
echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}" |
709 |
echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}" |
710 |
} |
711 |
|
712 |
pkg_config() { |
713 |
einfo "Press ENTER to create the SqueezeCenter database and set proper" |
714 |
einfo "permissions on it. You will be prompted for the MySQL 'root' user's" |
715 |
einfo "password during this process (note that the MySQL 'root' user is" |
716 |
einfo "independent of the Linux 'root' user and so may have a different" |
717 |
einfo "password)." |
718 |
einfo "" |
719 |
einfo "If you already have a SqueezeCenter database set up then this" |
720 |
einfo "process will clear the existing database (your music files will not," |
721 |
einfo "however, be affected)." |
722 |
einfo "" |
723 |
einfo "Alternatively, press Control-C to abort now..." |
724 |
read |
725 |
|
726 |
# Get the MySQL root password from the user (not echoed to the terminal) |
727 |
einfo "The MySQL 'root' user password is required to create the" |
728 |
einfo "SqueezeCenter user and database." |
729 |
DONE=0 |
730 |
while [ $DONE -eq 0 ]; do |
731 |
trap "stty echo; echo" EXIT |
732 |
stty -echo |
733 |
read -p "MySQL root password: " ROOT_PASSWD; echo |
734 |
stty echo |
735 |
trap ":" EXIT |
736 |
echo quit | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 && DONE=1 |
737 |
if [ $DONE -eq 0 ]; then |
738 |
eerror "Incorrect MySQL root password, or MySQL is not running" |
739 |
fi |
740 |
done |
741 |
|
742 |
# Get the new password for the SqueezeCenter MySQL database user, and |
743 |
# have it re-entered to confirm it. We should trivially check it's not |
744 |
# the same as the MySQL root password. |
745 |
einfo "A new MySQL user will be added to own the SqueezeCenter database." |
746 |
einfo "Please enter the password for this new user (${DBUSER})." |
747 |
DONE=0 |
748 |
while [ $DONE -eq 0 ]; do |
749 |
trap "stty echo; echo" EXIT |
750 |
stty -echo |
751 |
read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo |
752 |
stty echo |
753 |
trap ":" EXIT |
754 |
if [ -z "$DBUSER_PASSWD" ]; then |
755 |
eerror "The password should not be blank; try again." |
756 |
elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then |
757 |
eerror "The ${DBUSER} password should be different to the root password" |
758 |
else |
759 |
DONE=1 |
760 |
fi |
761 |
done |
762 |
|
763 |
# Drop the existing database and user - note we don't care about errors |
764 |
# from this as it probably just indicates that the database wasn't |
765 |
# yet present. |
766 |
einfo "Dropping old SqueezeCenter database and user ..." |
767 |
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 |
768 |
|
769 |
# Drop and create the SqueezeCenter user and database. |
770 |
einfo "Creating SqueezeCenter MySQL user and database (${DBUSER}) ..." |
771 |
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" |
772 |
|
773 |
# Remove the existing MySQL preferences from SqueezeCenter (if any). |
774 |
sc_remove_db_prefs "${PREFS}" |
775 |
[ -f "${LIVE_PREFS}" ] && sc_remove_db_prefs ${LIVE_PREFS} |
776 |
|
777 |
# Insert the external MySQL configuration into the preferences. |
778 |
sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" |
779 |
[ -f "${LIVE_PREFS}" ] && sc_update_prefs "${LIVE_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}" |
780 |
|
781 |
# Phew - all done. Give some tips on what to do now. |
782 |
einfo "Database configuration complete." |
783 |
einfo "" |
784 |
sc_starting_instr |
785 |
} |
786 |
|
787 |
pkg_preinst() { |
788 |
# Warn the user if there are old plugins that he may need to migrate |
789 |
if [ -d "${OLDPLUGINSDIR}" ]; then |
790 |
if [ ! -z "$(ls ${OLDPLUGINSDIR})" ]; then |
791 |
ewarn "Note: It appears that plugins are installed in the old location of:" |
792 |
ewarn "${OLDPLUGINSDIR}" |
793 |
ewarn "If these are to be used then they must be migrated to the new location:" |
794 |
ewarn "${NEWPLUGINSDIR}" |
795 |
ewarn "" |
796 |
fi |
797 |
fi |
798 |
} |