Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Mar 2010 22:21:13 GMT
From:      Christopher Key <cjk32@cam.ac.uk>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/144706: New port: audio/linux-musicipserver
Message-ID:  <201003122221.o2CMLDAC008598@chacal.wzl33>
Resent-Message-ID: <201003122230.o2CMU3SS096842@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         144706
>Category:       ports
>Synopsis:       New port: audio/linux-musicipserver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 12 22:30:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Christopher Key
>Release:        FreeBSD 7.2-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD chacal.wzl33 7.2-RELEASE FreeBSD 7.2-RELEASE #7: Thu May 7 20:03:07 BST 2009 root@chacal.wzl33:/usr/obj/usr/src/sys/CHACAL amd64


	
>Description:
MusicIP mixer is an application for generating playlists based upon musical content.  This port attempts to install the server portion of the distributed binaries in a FreeBSD centric manner.

It still requires work, but has been submitted in the hope that this will allow the remaining issues more quickly to be addressed more quickly.

Most importantly are the licensing issues.  MusicIP server was a freely available download from MusicIP, sitting alongside a paid for version.  Following restructuring, MusicIP had become AmpliFIND Music Services, and MusicIP mixer is now offered as an unsupported legacy download.  I've been unable to get any statement from AmpliFIND with regards the creation of this port, and have therefore gone for the the most stringent restrictions.  As this makes the port little more that an install script, I don't think that there are any licensing problems but it is important to be sure.

There are also a few technical issues that should probably be addressed:

1) An entry is added in newsyslog.conf for the logfile.  There is no means of forcing the server to reopen its logfile, and the consequences of this need to be understood.

2) sudo is used in the startup script, which should be rewritten to remove this dependency is possible.

3) The server refuses to start if there are any previously open sockets still in existence.  The server currently waits for sockets whose state is TIME_WAIT, although it is not clear if there are other states that should be checked for.


	
>How-To-Repeat:
	
>Fix:

	

--- linux-musicipserver.sh begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	.
#	./files
#	./files/pkg-install.in
#	./files/musicipserver.in
#	./distinfo
#	./pkg-descr
#	./pkg-plist
#	./Makefile
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo c - ./files
mkdir -p ./files > /dev/null 2>&1
echo x - ./files/pkg-install.in
sed 's/^X//' >./files/pkg-install.in << '54ebdf45d5c878152b906d4f588a7e61'
X#!/bin/sh
X# $FreeBSD: ports/audio/squeezeboxserver/files/pkg-install.in,v 1.10 2009/10/14 22:33:31 brooks Exp $
X
Xname=%%PORTNAME%%
Xmusicipdir=%%MUSICIPDIR%%
Xlogdir=%%MUSICIPSERVERLOGDIR%%
Xstatedir=%%MUSICIPSERVERDBDIR%%
Xmusicipdirabs=${PKG_PREFIX}/${musicipdir}
X
Xu=%%MUSICIPSERVERUSER%%
Xg=%%MUSICIPSERVERGROUP%%
Xugid=10002
Xhomedir=${statedir}
Xshell=/sbin/nologin
Xcomment="MusicIP pseudo-user"
X
Xnewsyslogfile=/etc/newsyslog.conf
Xlogcomment="# added by audio/${name} port"
Xserverlogfile=${logdir}/server.log
X# TODO: Need to understand what happens when no signal gets sent to the server process
Xserverlogline="${serverlogfile}	${u}:${g} 644 3	   100	*     JN"
X
Xcase $2 in
XPRE-INSTALL)
X	if pw group show "${g}" >/dev/null 2>&1; then
X		echo "Using existing group \"${g}\"."
X	else
X		echo "Creating group \"${g}\", (gid: ${ugid})."
X		pw groupadd ${g} -g ${ugid}
X		if [ $? != 0 ]; then
X			echo "Failed to add group \"${g}\"."
X			exit 1
X		fi
X	fi
X	if pw user show "${u}" >/dev/null 2>&1; then
X		echo "Using existing user \"${u}\"."
X	else
X		echo "Creating user \"${u}\", (uid: ${ugid})."
X		pw useradd ${u} -u ${ugid} -g ${ugid} -h - \
X		    -d ${homedir} -s ${shell} -c "${comment}"
X		if [ $? != 0 ]; then
X			echo "Failed to add user \"${u}\"."
X			exit 1
X		fi
X	fi
X	;;
XPOST-INSTALL)
X	if egrep -q "^${serverlogfile}\>" ${newsyslogfile}; then
X		echo "Using existing ${newsyslogfile} entry."
X	else
X		echo "Adding ${name} log entry to ${newsyslogfile}."
X		echo "$logcomment" >> ${newsyslogfile}
X		echo "$serverlogline" >> ${newsyslogfile}
X	fi
X
X	if [ ! -d ${logdir} ]; then
X	    mkdir ${logdir}
X	    chown -H ${u}:${g} ${logdir}
X	    chmod 755 ${logdir}	
X	fi
X	if [ ! -d ${statedir} ]; then
X	    mkdir ${statedir}
X	    chown -H ${u}:${g} ${statedir}
X	    chmod 755 ${statedir}	
X	fi
X
X	if [ ! -f ${serverlogfile} ]; then
X		touch ${serverlogfile}
X		chown -H ${u}:${g} ${serverlogfile}
X	fi
X
X	if [ ! -d ${statedir}/.MusicMagic ]; then
X	    mkdir ${statedir}/.MusicMagic
X	    chown -H ${u}:${g} ${statedir}/.MusicMagic
X	    chmod 755 ${statedir}/.MusicMagic
X	fi
X
X	if [ ! -e ${statedir}/.MusicMagic/mmm.ini ]; then
X	    cp ${musicipdirabs}/mmm.ini.sample ${statedir}/.MusicMagic/mmm.ini
X	    chown -H ${u}:${g} ${statedir}/.MusicMagic/mmm.ini
X	    chmod 644 ${statedir}/.MusicMagic/mmm.ini
X	fi
X	
X	;;
Xesac
54ebdf45d5c878152b906d4f588a7e61
echo x - ./files/musicipserver.in
sed 's/^X//' >./files/musicipserver.in << 'dceac98cc851b936e685e84976b3aec6'
X#!/bin/sh
X#
X# $Id: musicipserver.in 1403 2010-03-12 21:34:49Z chris $
X#
X
X# PROVIDE: musicipserver
X# BEFORE:  squeezecenter
X# REQUIRE: LOGIN
X# KEYWORD: shutdown
X
X#
X# Add the following lines to /etc/rc.conf to enable musicipserver:
X#
X#musicipserver_enable="YES"
X#
X
X. %%RC_SUBR%%
X
Xname="%%PORTNAME%%"
Xprocname="%%PREFIX%%/%%MUSICIPDIR%%/MusicMagicServer"
Xstart_cmd="${name}_start_cmd"
Xstop_cmd="${name}_stop_cmd"
Xrestart_cmd="${name}_restart_cmd"
X
Xload_rc_config $name
Xmusicip_enable=${musicip_enable:-"NO"}
Xmusicip_user="%%MUSICIPSERVERUSER%%"
Xmusicip_group="%%MUSICIPSERVERGROUP%%"
Xlogdir="%%MUSICIPSERVERLOGDIR%%"
Xserverlogfile="${logdir}/server.log"
Xmusicip_port="10002" # Should probably pull this in from mmm.ini
X
X# TODO: Should we be using commands in /usr/local for startup scripts?
XSUDO="%%LOCALBASE%%/bin/sudo"
X
Xmusicipserver_start_cmd()
X{
X    # Check whether we're already running
X    pid=$(pgrep -o MusicMagicServer) && echo "${name} already running? (pid=$pid)." && return 1
X
X    # MusicMagicServer start is designed not to return unless there 
X    # an error, so it's invoked with sudo -b and we sleep for 5s after 
X    # launching to allow time for it to start up before any of its 
X    # dependents.  Unfortunately, this makes it difficult to determine if 
X    # it failed to start.  To overcome this, we wait 5s, then check for the 
X    # process name.  We should possibly automatically retry if it failed
X    # to start.?
X
X    echo "Starting ${name}."
X    ${SUDO} -u ${musicip_user} -H -b sh -c "${procname} -verbose start >> ${serverlogfile}"
X    sleep 5
X
X    pid=$(pgrep MusicMagicServer -o) || echo "${name} failed to start." && return 1
X
X}
X
Xmusicipserver_stop_cmd()
X{
X    echo "Stopping ${name}."
X    ${SUDO} -u ${musicip_user} -H ${procname} stop
X}
X
Xmusicipserver_restart_cmd()
X{
X
X    musicipserver_stop_cmd
X
X    # MusicIP server will fail to start if there are any sockets still active on port 10002.
X    # TODO: Are there states other than TIME_WAIT that we should wait on?
X    echo -n "Waiting on sockets"
X    while netstat -n | egrep "^tcp4 +[[:digit:]]+ +[[:digit:]]+ +([[:digit:]]+\.){4}$musicip_port +([[:digit:]]+\.){4}[[:digit:]]+ +TIME_WAIT\$" > /dev/null; do
X	sleep 1
X    done
X    echo "."
X
X    musicipserver_start_cmd
X    
X}
X
X
Xrun_rc_command "$1"
dceac98cc851b936e685e84976b3aec6
echo x - ./distinfo
sed 's/^X//' >./distinfo << 'aec8793adfd5b7c3f00e62ae41a09ac2'
XMD5 (MusicMixer_x86_1.8.tgz) = cc8d9945251b94c16fcb7b9443743008
XSHA256 (MusicMixer_x86_1.8.tgz) = 05394616166356b9f919a645cd6cd363388349be5790b8775c584a005db258b9
XSIZE (MusicMixer_x86_1.8.tgz) = 4610204
aec8793adfd5b7c3f00e62ae41a09ac2
echo x - ./pkg-descr
sed 's/^X//' >./pkg-descr << '0e313719ff012ceaf97a028d51caa8f5'
XThis is an application for generating playlists based upon musical content.
X
XWWW:	http://www.amplifiedmusicservices.com/
0e313719ff012ceaf97a028d51caa8f5
echo x - ./pkg-plist
sed 's/^X//' >./pkg-plist << 'ef3e7f63841ae908ba397c2bef1fbad6'
X@comment $FreeBSD$
X@unexec if cmp -s %%MUSICIPSERVERDBDIR%%/.MusicMagic/mmm.ini %%PREFIX%%/%%MUSICIPDIR%%/mmm.ini.sample; then rm -f %%MUSICIPSERVERDBDIR%%/.MusicMagic/mmm.ini; fi
X%%MUSICIPDIR%%/MusicMagicServer
X%%MUSICIPDIR%%/mipcore
X%%MUSICIPDIR%%/mmm.ini.sample
X%%MUSICIPDIR%%/server/index.html
X@dirrm %%MUSICIPDIR%%/server
X@dirrm %%MUSICIPDIR%%
X@comment Don't use @dirrmtry, as %%MUSICIPSERVERDBDIR%% is an absolute path, and shouldn't be prefixed with %%PREFIX%%
X@unexec rmdir %%MUSICIPSERVERDBDIR%%/.MusicMagic 2>/dev/null || true
X@unexec rmdir %%MUSICIPSERVERDBDIR%% 2>/dev/null || true
X@unexec (test -d %%MUSICIPSERVERDBDIR%% && (echo "Configuration information and track database saved.  If you will *NOT* use this" && echo "package anymore, please remove %%MUSICIPSERVERDBDIR%% and its contents manually.")) || true
ef3e7f63841ae908ba397c2bef1fbad6
echo x - ./Makefile
sed 's/^X//' >./Makefile << '464ef7c6571951809b23e262cbe26e19'
X# New ports collection makefile for:	genpuid
X# Date created:		2009-03-24
X# Whom:			Christopher Key <cjk32@cam.ac.uk>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	musicipserver
XPORTVERSION=	1.8
XCATEGORIES=	audio linux
XMASTER_SITES=	http://www.amplifindmusicservices.com/downloads/
XPKGNAMEPREFIX=	linux-
XDISTNAME=	MusicMixer_x86_${PORTVERSION}
XEXTRACT_SUFX=	.tgz
X
XMAINTAINER=	cjk32@cam.ac.uk
XCOMMENT=	Application for generating playlists based upon musical content
X
X# TODO: Is this sufficient to deal with any licensing issues?
XNO_CDROM=	Not for resale
XRESTRICTED=	Solely for non-commercial personal use
X
XWRKSRC=		${WRKDIR}/MusicIP/MusicMagicMixer/
X
XRUN_DEPENDS+=	${LOCALBASE}/bin/sudo:${PORTSDIR}/security/sudo
X
XPKGINSTALL=	${WRKDIR}/pkg-install
X
XUSE_LINUX=	yes
X
XNO_BUILD=	yes
X
XUSE_RC_SUBR=	musicipserver
X
X.include <bsd.port.pre.mk>
X
XSUB_FILES=	pkg-install
XSUB_LIST=	PORTNAME=${PORTNAME} \
X		MUSICIPDIR=${MUSICIPDIR} \
X		MUSICIPSERVERDBDIR=${MUSICIPSERVERDBDIR} \
X		MUSICIPSERVERLOGDIR=${MUSICIPSERVERLOGDIR} \
X		MUSICIPSERVERUSER=${MUSICIPSERVERUSER} \
X		MUSICIPSERVERGROUP=${MUSICIPSERVERGROUP}
XPLIST_SUB=	MUSICIPDIR=${MUSICIPDIR} \
X		MUSICIPSERVERDBDIR=${MUSICIPSERVERDBDIR}
X
Xpre-fetch:
X.if !defined(MUSICIPDIR)
X	@${ECHO_MSG} ""
X	@${ECHO_MSG} "Define MUSICIPDIR to override default of 'musicipmixer'."
X	@${ECHO_MSG} ""
X.endif
X
XMUSICIPDIR?=	musicipmixer
XMUSICIPSERVERDBDIR?=	/var/db/${PORTNAME}
XMUSICIPSERVERLOGDIR?=	/var/log/${PORTNAME}
XMUSICIPSERVERUSER?=	mipserv
XMUSICIPSERVERGROUP?=	${MUSICIPSERVERUSER}
X
Xpre-install:
X	@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
X
Xdo-install:
X	@${MKDIR} -m 0755 ${PREFIX}/${MUSICIPDIR}
X	@${INSTALL_PROGRAM} ${WRKSRC}/MusicMagicServer ${PREFIX}/${MUSICIPDIR}
X	@${INSTALL_PROGRAM} ${WRKSRC}/mipcore ${PREFIX}/${MUSICIPDIR}
X	@${INSTALL_DATA} ${WRKSRC}/mmm.ini ${PREFIX}/${MUSICIPDIR}/mmm.ini.sample
X	@cd ${WRKSRC} && ${COPYTREE_SHARE} server ${PREFIX}/${MUSICIPDIR}
X
Xpost-install:
X	@PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
X
X.include <bsd.port.post.mk>
464ef7c6571951809b23e262cbe26e19
exit
--- linux-musicipserver.sh ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003122221.o2CMLDAC008598>