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: squeezecenter-7.0-r1.ebuild squeezecenter-7.0.1_beta20080501.ebuild
Date: Thu, 01 May 2008 13:05:33
Message-Id: E1JrYTa-0001og-Cl@stork.gentoo.org
1 lavajoe 08/05/01 13:05:30
2
3 Modified: squeezecenter-7.0-r1.ebuild
4 Added: squeezecenter-7.0.1_beta20080501.ebuild
5 Log:
6 Add nightly beta 2008-05-01; remove comment about svn ver from 7.0
7 (Portage version: 2.1.4.4)
8
9 Revision Changes Path
10 1.2 media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild?rev=1.2&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild?rev=1.2&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild?r1=1.1&r2=1.2
15
16 Index: squeezecenter-7.0-r1.ebuild
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild,v
19 retrieving revision 1.1
20 retrieving revision 1.2
21 diff -u -r1.1 -r1.2
22 --- squeezecenter-7.0-r1.ebuild 20 Apr 2008 17:27:12 -0000 1.1
23 +++ squeezecenter-7.0-r1.ebuild 1 May 2008 13:05:29 -0000 1.2
24 @@ -1,11 +1,9 @@
25 # Copyright 1999-2008 Gentoo Foundation
26 # Distributed under the terms of the GNU General Public License v2
27 -# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild,v 1.1 2008/04/20 17:27:12 lavajoe Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0-r1.ebuild,v 1.2 2008/05/01 13:05:29 lavajoe Exp $
29
30 inherit eutils
31
32 -# Although the svn version isn't in the filename, it is in the directory tree
33 -# of the expanded tarball.
34 SVN_VER="17793"
35 MAJOR_VER="${PV:0:3}"
36 SRC_DIR="SqueezeCenter_v${MAJOR_VER}.0"
37
38
39
40 1.1 media-sound/squeezecenter/squeezecenter-7.0.1_beta20080501.ebuild
41
42 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0.1_beta20080501.ebuild?rev=1.1&view=markup
43 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0.1_beta20080501.ebuild?rev=1.1&content-type=text/plain
44
45 Index: squeezecenter-7.0.1_beta20080501.ebuild
46 ===================================================================
47 # Copyright 1999-2008 Gentoo Foundation
48 # Distributed under the terms of the GNU General Public License v2
49 # $Header: /var/cvsroot/gentoo-x86/media-sound/squeezecenter/squeezecenter-7.0.1_beta20080501.ebuild,v 1.1 2008/05/01 13:05:29 lavajoe Exp $
50
51 inherit eutils
52
53 SVN_VER="19294"
54 MAJOR_VER="${PV:0:3}"
55 MINOR_VER="${PV:4:1}"
56 SRC_DIR="SqueezeCenter_trunk_v${PV:10:4}-${PV:14:2}-${PV:16:2}"
57 MY_P="squeezecenter-${MAJOR_VER}.${MINOR_VER}-${SVN_VER}-noCPAN"
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/${SRC_DIR}/${MY_P}.tgz"
62 LICENSE="GPL-2"
63 SLOT="0"
64 KEYWORDS="~amd64 ~ppc ~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-${MAJOR_VER}-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-${MAJOR_VER}.conf.d" squeezecenter
147 newinitd "${FILESDIR}/squeezecenter-${MAJOR_VER}.init.d" squeezecenter
148
149 # Install default preferences.
150 insinto /etc
151 newins "${FILESDIR}/squeezecenter-${MAJOR_VER}.prefs" squeezecenter.prefs
152
153 # Install the SQL configuration scripts.
154 insinto "${INSTROOT}/squeezecenter/SQL/mysql"
155 doins "${FILESDIR}/dbdrop-${MAJOR_VER}-gentoo.sql"
156 doins "${FILESDIR}/dbcreate-${MAJOR_VER}-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-${MAJOR_VER}.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-${MAJOR_VER}-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 "Receiver 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 "And then rebuild those packages with:"
238 ewarn "\temerge --newuse dev-perl/GD media-libs/gd"
239 ewarn ""
240 fi
241
242 # Point user to database configuration step
243 elog "If this is a new installation of SqueezeCenter then the database"
244 elog "must be configured prior to use. This can be done by running the"
245 elog "following command:"
246 elog "\temerge --config =${CATEGORY}/${PF}"
247
248 # Remind user to configure Avahi if necessary
249 if use avahi; then
250 elog ""
251 elog "Avahi support installed. Remember to edit the folowing file if"
252 elog "you run SqueezeCenter's web interface on a port other than 9000:"
253 elog "\t/etc/avahi/services/squeezecenter.service"
254 fi
255
256 elog ""
257 sc_starting_instr
258 }
259
260 sc_remove_db_prefs() {
261 MY_PREFS=$1
262
263 einfo "Configuring SqueezeCenter database preferences (${MY_PREFS}) ..."
264 TMPPREFS="${T}"/squeezecenter-prefs-$$
265 touch "${ROOT}${MY_PREFS}"
266 sed -e '/^dbusername:/d' -e '/^dbpassword:/d' -e '/^dbsource:/d' < "${ROOT}${MY_PREFS}" > "${TMPPREFS}"
267 mv "${TMPPREFS}" "${ROOT}${MY_PREFS}"
268 chown squeezecenter:squeezecenter "${ROOT}${MY_PREFS}"
269 chmod 660 "${ROOT}${MY_PREFS}"
270 }
271
272 sc_update_prefs() {
273 MY_PREFS=$1
274 MY_DBUSER=$2
275 MY_DBUSER_PASSWD=$3
276
277 echo "dbusername: ${MY_DBUSER}" >> "${ROOT}${MY_PREFS}"
278 echo "dbpassword: ${MY_DBUSER_PASSWD}" >> "${ROOT}${MY_PREFS}"
279 echo "dbsource: dbi:mysql:database=${MY_DBUSER};mysql_socket=/var/run/mysqld/mysqld.sock" >> "${ROOT}${MY_PREFS}"
280 }
281
282 pkg_config() {
283 einfo "Press ENTER to create the SqueezeCenter database and set proper"
284 einfo "permissions on it. You will be prompted for the MySQL 'root' user's"
285 einfo "password during this process (note that the MySQL 'root' user is"
286 einfo "independent of the Linux 'root' user and so may have a different"
287 einfo "password)."
288 einfo ""
289 einfo "If you already have a SqueezeCenter database set up then this"
290 einfo "process will clear the existing database (your music files will not,"
291 einfo "however, be affected)."
292 einfo ""
293 einfo "Alternatively, press Control-C to abort now..."
294 read
295
296 # Get the MySQL root password from the user (not echoed to the terminal)
297 einfo "The MySQL 'root' user password is required to create the"
298 einfo "SqueezeCenter user and database."
299 DONE=0
300 while [ $DONE -eq 0 ]; do
301 trap "stty echo; echo" EXIT
302 stty -echo
303 read -p "MySQL root password: " ROOT_PASSWD; echo
304 stty echo
305 trap ":" EXIT
306 echo quit | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1 && DONE=1
307 if [ $DONE -eq 0 ]; then
308 eerror "Incorrect MySQL root password, or MySQL is not running"
309 fi
310 done
311
312 # Get the new password for the SqueezeCenter MySQL database user, and
313 # have it re-entered to confirm it. We should trivially check it's not
314 # the same as the MySQL root password.
315 einfo "A new MySQL user will be added to own the SqueezeCenter database."
316 einfo "Please enter the password for this new user (${DBUSER})."
317 DONE=0
318 while [ $DONE -eq 0 ]; do
319 trap "stty echo; echo" EXIT
320 stty -echo
321 read -p "MySQL ${DBUSER} password: " DBUSER_PASSWD; echo
322 stty echo
323 trap ":" EXIT
324 if [ -z "$DBUSER_PASSWD" ]; then
325 eerror "The password should not be blank; try again."
326 elif [ "$DBUSER_PASSWD" == "$ROOT_PASSWD" ]; then
327 eerror "The ${DBUSER} password should be different to the root password"
328 else
329 DONE=1
330 fi
331 done
332
333 # Drop the existing database and user - note we don't care about errors
334 # from this as it probably just indicates that the database wasn't
335 # yet present.
336 einfo "Dropping old SqueezeCenter database and user ..."
337 sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" < "${INSTROOT}/squeezecenter/SQL/mysql/dbdrop-${MAJOR_VER}-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" >/dev/null 2>&1
338
339 # Drop and create the SqueezeCenter user and database.
340 einfo "Creating SqueezeCenter MySQL user and database (${DBUSER}) ..."
341 sed -e "s/__DATABASE__/${DBUSER}/" -e "s/__DBUSER__/${DBUSER}/" -e "s/__DBPASSWORD__/${DBUSER_PASSWD}/" < "${INSTROOT}/squeezecenter/SQL/mysql/dbcreate-${MAJOR_VER}-gentoo.sql" | mysql --user=root --password="${ROOT_PASSWD}" || die "Unable to create MySQL database and user"
342
343 # Remove the existing MySQL preferences from SqueezeCenter (if any).
344 sc_remove_db_prefs "${PREFS}"
345 [ -f "${CACHED_PREFS}" ] && sc_remove_db_prefs ${CACHED_PREFS}
346
347 # Insert the external MySQL configuration into the preferences.
348 sc_update_prefs "${PREFS}" "${DBUSER}" "${DBUSER_PASSWD}"
349 [ -f "${CACHED_PREFS}" ] && sc_update_prefs "${CACHED_PREFS}" "${DBUSER}" "${DBUSER_PASSWD}"
350
351 # Phew - all done.
352 # Give some tips on what to do now.
353 einfo "Database configuration complete."
354 einfo ""
355 sc_starting_instr
356 }
357
358
359
360 --
361 gentoo-commits@l.g.o mailing list