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/squeezecenter: ChangeLog squeezecenter-7.0_beta20080102.ebuild squeezecenter-7.0_p20080102.ebuild
Date: Mon, 07 Jan 2008 19:27:05
Message-Id: E1JBxci-0001Hg-4x@stork.gentoo.org
1 lavajoe 08/01/07 19:27:00
2
3 Modified: ChangeLog
4 Added: squeezecenter-7.0_beta20080102.ebuild
5 Removed: squeezecenter-7.0_p20080102.ebuild
6 Log:
7 Move it to beta to properly reflect the 7.0 release status
8 (Portage version: 2.1.3.19)
9
10 Revision Changes Path
11 1.2 media-sound/squeezecenter/ChangeLog
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?rev=1.2&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?rev=1.2&content-type=text/plain
15 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/ChangeLog?r1=1.1&r2=1.2
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v
20 retrieving revision 1.1
21 retrieving revision 1.2
22 diff -u -r1.1 -r1.2
23 --- ChangeLog 7 Jan 2008 01:33:34 -0000 1.1
24 +++ ChangeLog 7 Jan 2008 19:26:59 -0000 1.2
25 @@ -1,6 +1,13 @@
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.1 2008/01/07 01:33:34 lavajoe Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/ChangeLog,v 1.2 2008/01/07 19:26:59 lavajoe Exp $
30 +
31 +*squeezecenter-7.0_beta20080102 (07 Jan 2008)
32 +
33 + 07 Jan 2008; Joe Peterson <lavajoe@g.o>
34 + +squeezecenter-7.0_beta20080102.ebuild,
35 + -squeezecenter-7.0_p20080102.ebuild:
36 + Move it to beta to properly reflect 7.0 release status
37
38 *squeezecenter-7.0_p20080102 (07 Jan 2008)
39
40
41
42
43 1.1 media-sound/squeezecenter/squeezecenter-7.0_beta20080102.ebuild
44
45 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0_beta20080102.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0_beta20080102.ebuild?rev=1.1&content-type=text/plain
47
48 Index: squeezecenter-7.0_beta20080102.ebuild
49 ===================================================================
50 # Copyright 1999-2008 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0_beta20080102.ebuild,v 1.1 2008/01/07 19:26:59 lavajoe Exp $
53
54 inherit eutils
55
56 MY_PV="${PV:8:4}-${PV:12:2}-${PV:14:2}"
57 MY_P="SqueezeCenter_trunk_v${MY_PV}"
58
59 DESCRIPTION="Logitech SqueezeCenter music server"
60 HOMEPAGE="http://www.slimdevices.com/pi_features.html"
61 SRC_URI="http://www.slimdevices.com/downloads/nightly/SqueezeCenter_v${MY_PV}/${MY_P}.no-cpan-arch.tar.gz"
62 LICENSE="GPL-2"
63 SLOT="0"
64 KEYWORDS="~x86"
65 IUSE="lame wavpack musepack alac ogg bonjour flac avahi"
66
67 # Note: dev-perl/module-build necessary because of SC bug#5882
68 # (http://bugs.slimdevices.com/show_bug.cgi?id=5882).
69 DEPEND="
70 dev-perl/File-Which
71 dev-perl/module-build
72 virtual/logger
73 virtual/mysql
74 avahi? ( net-dns/avahi )
75 ogg? ( media-sound/sox )
76 "
77 # Note: dev-perl/GD necessary because of SC bug#6143
78 # (http://bugs.slimdevices.com/show_bug.cgi?id=6143).
79 RDEPEND="${DEPEND}
80 >=dev-lang/perl-5.8.8
81 >=dev-perl/GD-2.35
82 >=app-admin/sudo-1.6.8
83 alac? ( media-sound/alac_decoder )
84 lame? ( media-sound/lame )
85 wavpack? ( media-sound/wavpack )
86 bonjour? ( net-misc/mDNSResponder )
87 flac? ( media-libs/flac )
88 musepack? ( media-sound/musepack-tools )
89 "
90
91 S="${WORKDIR}/${MY_P}"
92
93 INSTROOT="/opt"
94 PREFS="/etc/squeezecenter.prefs"
95 CACHED_PREFS="/var/cache/squeezecenter/prefs/server.prefs"
96 DBUSER="squeezecenter"
97
98 pkg_setup() {
99 # Sox has optional OGG support, so make sure it has been built that way
100 if use ogg; then
101 if ! built_with_use media-sound/sox ogg; then
102 eerror "media-sound/sox not built with USE=ogg"
103 die "media-sound/sox not built with USE=ogg"
104 fi
105 fi
106
107 # Create the user and group if not already present
108 enewgroup squeezecenter || die
109 enewuser squeezecenter -1 -1 "${INSTROOT}/squeezecenter" squeezecenter || die
110 }
111
112 src_unpack() {
113 unpack ${A}
114 cd "${S}"
115
116 # Apply patches
117 epatch "${FILESDIR}/mDNSResponder-7.0-gentoo.patch"
118
119 # Remove bundled binaries that are supplied by other ebuilds
120 einfo "Removing binaries provided by other ebuilds ..."
121 rm "${S}"/Bin/*/mDNSResponderPosix || die # net-misc/mDNSResponder
122 rm "${S}"/Bin/*/alac || die # media-sound/alac_decoder
123 rm "${S}"/Bin/*/flac || die # media-libs/flac
124 rm "${S}"/Bin/*/sox || die # media-sound/sox
125 rm "${S}"/Bin/*/wvunpack || die # media-sound/wavpack
126 rm "${S}"/Bin/*/mppdec || die # media-sound/musepack-tools
127
128 # Remove bundled MySQL as we depend on an external instance
129 einfo "Removing bundled MySQL ..."
130 rm -r "${S}"/MySQL || die
131 rm "${S}"/Bin/*/mysqld || die # virtual/mysql
132 }
133
134 src_compile() {
135 einfo "Building required Perl modules (some warnings are normal here) ..."
136 mkdir "${T}/sc_compile"
137 echo -e "\n${S}\n${T}/sc_compile" | Bin/build-perl-modules.pl || die "Unable to build Perl modules"
138 }
139
140 src_install() {
141 # Copy all files.
142 dodir "${INSTROOT}/squeezecenter"
143 cp -r * "${D}/${INSTROOT}/squeezecenter"
144
145 # Install init scripts.
146 newconfd "${FILESDIR}/squeezecenter-7.0.conf.d" squeezecenter
147 newinitd "${FILESDIR}/squeezecenter-7.0.init.d" squeezecenter
148
149 # Install default preferences.
150 insinto /etc
151 newins "${FILESDIR}/squeezecenter-7.0.prefs" squeezecenter.prefs
152
153 # Install the SQL configuration scripts.
154 insinto "${INSTROOT}/squeezecenter/SQL/mysql"
155 doins "${FILESDIR}/dbdrop-7.0-gentoo.sql"
156 doins "${FILESDIR}/dbcreate-7.0-gentoo.sql"
157
158 # Initialize /var/{cache,run}.
159 keepdir /var/{cache,run}/squeezecenter
160 fowners squeezecenter:squeezecenter /var/{cache,run}/squeezecenter
161 fperms 770 /var/{cache,run}/squeezecenter
162
163 # Initialize /var/log.
164 dodir /var/log/squeezecenter
165 fowners squeezecenter:squeezecenter /var/log/squeezecenter
166 fperms 770 /var/log/squeezecenter
167 touch "${D}/var/log/squeezecenter/server.log"
168 touch "${D}/var/log/squeezecenter/scanner.log"
169 touch "${D}/var/log/squeezecenter/perfmon.log"
170 fowners squeezecenter:squeezecenter /var/log/squeezecenter/server.log
171 fowners squeezecenter:squeezecenter /var/log/squeezecenter/scanner.log
172 fowners squeezecenter:squeezecenter /var/log/squeezecenter/perfmon.log
173
174 # Install logrotate support.
175 insinto /etc/logrotate.d
176 newins "${FILESDIR}/squeezecenter-7.0.logrotate.d" squeezecenter
177
178 # Install Avahi support (if USE flag is set).
179 if use avahi; then
180 insinto /etc/avahi/services
181 newins "${FILESDIR}/avahi-7.0-squeezecenter.service" squeezecenter.service
182 fi
183 }
184
185 sc_starting_instr() {
186 elog "SqueezeCenter can be started with the following command:"
187 elog "\t/etc/init.d/squeezecenter start"
188 elog ""
189 elog "SqueezeCenter can be automatically started on each boot with the"
190 elog "following command:"
191 elog "\trc-update add squeezecenter default"
192 elog ""
193 elog "You might want to examine and modify the following configuration"
194 elog "file before starting SqueezeCenter:"
195 elog "\t/etc/conf.d/squeezecenter"
196 elog ""
197
198 # Discover the port number from the preferences, but if it isn't there
199 # then report the standard one.
200 httpport=$(gawk '$1 == "httpport:" { print $2 }' "${ROOT}${CACHED_PREFS}" 2>/dev/null)
201 elog "You may access and configure SqueezeCenter by browsing to:"
202 elog "\thttp://localhost:${httpport:-9000}/"
203 }
204
205 pkg_postinst() {
206 # FLAC and LAME are quite useful (but not essential) for SqueezeCenter -
207 # if they're not enabled then make sure the user understands that.
208 if ! use flac; then
209 ewarn "'flac' USE flag is not set. Although not essential, FLAC is required"
210 ewarn "for playing lossless WAV and FLAC (for Squeezebox 1), and for"
211 ewarn "playing other less common file types (if you have a Squeezebox 2, 3"
212 ewarn "or Transporter)."
213 ewarn "For maximum flexibility you are recommended to set the 'flac' USE flag".
214 ewarn ""
215 fi
216 if ! use lame; then
217 ewarn "'lame' USE flag is not set. Although not essential, LAME is"
218 ewarn "required if you want to limit the bandwidth your Squeezebox or"
219 ewarn "Transporter uses when streaming audio."
220 ewarn "For maximum flexibility you are recommended to set the 'lame' USE flag".
221 ewarn ""
222 fi
223
224 # Album art requires PNG and JPEG support from GD, so if it's not there
225 # then warn the user. It's not mandatory as the user may not be using
226 # album art.
227 if ! built_with_use dev-perl/GD jpeg || \
228 ! built_with_use dev-perl/GD png || \
229 ! built_with_use media-libs/gd jpeg || \
230 ! built_with_use media-libs/gd png; then
231 ewarn "For correct operation of album art through SqueezeCenter's web"
232 ewarn "interface the GD library and Perl module must be built with PNG"
233 ewarn "and JPEG support. If necessary you can add the following lines"
234 ewarn "to the file /etc/portage/package.use:"
235 ewarn "\tdev-perl/GD jpeg png"
236 ewarn "\tmedia-libs/gd jpeg png"
237 ewarn ""
238 fi
239
240 # Point user to database configuration step
241 elog "If this is a new installation of SqueezeCenter then the database"
242 elog "must be configured prior to use. This can be done by running the"
243 elog "following command:"
244 elog "\temerge --config =${CATEGORY}/${PF}"
245
246 # Remind user to configure Avahi if necessary
247 if use avahi; then
248 elog ""
249 elog "Avahi support installed. Remember to edit the folowing file if"
250 elog "you run SqueezeCenter's web interface on a port other than 9000:"
251 elog "\t/etc/avahi/services/squeezecenter.service"
252 fi
253
254 elog ""
255 sc_starting_instr
256 }
257
258 sc_remove_db_prefs() {
259 MY_PREFS=$1
260
261 einfo "Configuring SqueezeCenter database preferences (${MY_PREFS}) ..."
262 TMPPREFS="${T}"/squeezecenter-prefs-$$
263 touch "${ROOT}${MY_PREFS}"
264 sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}"
265 mv "${TMPPREFS}" "${ROOT}${MY_PREFS}"
266 chown squeezecenter:squeezecenter "${ROOT}${MY_PREFS}"
267 chmod 660 "${ROOT}${MY_PREFS}"
268 }
269
270 sc_update_prefs() {
271 MY_PREFS=$1
272 MY_DBUSER=$2
273 MY_DBUSER_PASSWD=$3
274
275 echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}"
276 echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}"
277 echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}"
278 }
279
280 pkg_config() {
281 einfo "Press ENTER to create the SqueezeCenter database and set proper"
282 einfo "permissions on it. You will be prompted for the MySQL 'root' user's"
283 einfo "password during this process (note that the MySQL 'root' user is"
284 einfo "independent of the Linux 'root' user and so may have a different"
285 einfo "password)."
286 einfo ""
287 einfo "If you already have a SqueezeCenter database set up then this"
288 einfo "process will clear the existing database (your music files will not,"
289 einfo "however, be affected)."
290 einfo ""
291 einfo "Alternatively, press Control-C to abort now..."
292 read
293
294 # Get the MySQL root password from the user (not echoed to the terminal)
295 einfo "The MySQL 'root' user password is required to create the"
296 einfo "SqueezeCenter user and database."
297 DONE=0
298 while [ $DONE -eq 0 ]; do
299 trap "stty echo; echo" EXIT
300 stty -echo
301 read -p "MySQL root password: " ROOT_PASSWD; echo
302 stty echo
303 trap ":" EXIT
304 mysql --user=root --password="${ROOT_PASSWD}" </dev/null >/dev/null 2>&1 && DONE=1
305 if [ $DONE -eq 0 ]; then
306 eerror "Incorrect MySQL root password, or MySQL is not running"
307 fi
308 done
309
310 # Get the new password for the SqueezeCenter MySQL database user, and
311 # have it re-entered to confirm it. We should trivially check it's not
312 # the same as the MySQL root password.
313 einfo "A new MySQL user will be added to own the SqueezeCenter database."
314 einfo "Please enter the password for this new user (${DBUSER})."
315 DONE=0
316 while [ $DONE -eq 0 ]; do
317 trap "stty echo; echo" EXIT
318 stty -echo
319 read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo
320 stty echo
321 trap ":" EXIT
322 if [ -z "$DBUSER_PASSWD" ]; then
323 eerror "The password should not be blank; try again."
324 elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then
325 eerror "The ${DBUSER} password should be different to the root password"
326 else
327 DONE=1
328 fi
329 done
330
331 # Drop the existing database and user - note we don't care about errors
332 # from this as it probably just indicates that the database wasn't
333 # yet present.
334 einfo "Dropping old SqueezeCenter database and user ..."
335 sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" < "${INSTROOT}/squeezecenter/SQL/mysql/dbdrop-7.0-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1
336
337 # Drop and create the SqueezeCenter user and database.
338 einfo "Creating SqueezeCenter MySQL user and database (${DBUSER}) ..."
339 sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" -e "s/__DBPASSWORD__/${DBUSER_PASSWD}/" < "${INSTROOT}/squeezecenter/SQL/mysql/dbcreate-7.0-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" || die "Unable to create MySQL database and user"
340
341 # Remove the existing MySQL preferences from SqueezeCenter (if any).
342 sc_remove_db_prefs "${PREFS}"
343 [ -f "${CACHED_PREFS}" ] && sc_remove_db_prefs ${CACHED_PREFS}
344
345 # Insert the external MySQL configuration into the preferences.
346 sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}"
347 [ -f "${CACHED_PREFS}" ] && sc_update_prefs "${CACHED_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}"
348
349 # Phew - all done.
350 # Give some tips on what to do now.
351 einfo "Database configuration complete."
352 einfo ""
353 sc_starting_instr
354 }
355
356
357
358 --
359 gentoo-commits@l.g.o mailing list