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