Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2014 10:10:56 +0000 (UTC)
From:      Michael Gmelin <grembo@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r355296 - in head/audio/xmcd: . files
Message-ID:  <201405261010.s4QAAuqH021890@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: grembo
Date: Mon May 26 10:10:55 2014
New Revision: 355296
URL: http://svnweb.freebsd.org/changeset/ports/355296
QAT: https://qat.redports.org/buildarchive/r355296/

Log:
  Staging support for audio/xmcd, as part of this the setuid
  bit has been removed and instructions on how to configure
  devfs.conf to allow access by non-root added to pkg-message.
  This way the package can be built without root access, plus
  avoiding setuid root executables are a good thing in general.
  
  Reviewed by:	bapt (mentor)
  Approved by:	bapt (mentor)

Modified:
  head/audio/xmcd/Makefile
  head/audio/xmcd/files/pkg-message.in
  head/audio/xmcd/pkg-plist

Modified: head/audio/xmcd/Makefile
==============================================================================
--- head/audio/xmcd/Makefile	Mon May 26 10:03:36 2014	(r355295)
+++ head/audio/xmcd/Makefile	Mon May 26 10:10:55 2014	(r355296)
@@ -15,15 +15,12 @@ LIB_DEPENDS+=	libvorbis.so:${PORTSDIR}/a
 RUN_DEPENDS+=	lame:${PORTSDIR}/audio/lame
 
 USES=		imake motif
-NO_STAGE=	yes
 USE_XORG=	x11 xext xaw xmu xp xpm xt sm ice
-MAN1=		cda.1 xmcd.1
-MANCOMPRESSED=	no
 PLIST_SUB+=	RELEASE=${OSREL:R:R} ARCH=${ARCH}
 SUB_FILES=	pkg-message
 PKGMESSAGE=	${WRKDIR}/pkg-message
 
-LIBBINDIR=	${PREFIX}/lib/X11/xmcd/bin-FreeBSD_${OSREL:R:R}-${ARCH}
+LIBBINDIR=	${STAGEDIR}${PREFIX}/lib/X11/xmcd/bin-FreeBSD_${OSREL:R:R}-${ARCH}
 
 post-extract:
 	@${CHMOD} -R u+w ${WRKSRC}
@@ -32,19 +29,48 @@ pre-patch:
 	@${CP} ${WRKSRC}/xmcd_d/XMcd.ad ${WRKSRC}/xmcd_d/XMcd.ad.in
 
 post-patch:
-	@${SED} -e "s;@PREFIX@;${PREFIX};g" ${WRKSRC}/xmcd_d/XMcd.ad.in \
+	@${SED} -e "s;@PREFIX@;${STAGDIR}${PREFIX};g" ${WRKSRC}/xmcd_d/XMcd.ad.in \
 		> ${WRKSRC}/xmcd_d/XMcd.ad
 	@${FIND} ${WRKSRC} -name Makefile -o -name Imakefile | \
 		${XARGS} ${REINPLACE_CMD} \
 		-e 's|_CFLAGS= -pthread|_CFLAGS= ${PTHREAD_CFLAGS}|g; \
 		s|_LDFLAGS= -pthread|_LDFLAGS= ${PTHREAD_LIBS}|g'
 
+post-configure:
+	@${REINPLACE_CMD} \
+		-e 's: BINDIR .*:BINDIR=${STAGEDIR}${PREFIX}/bin:' \
+		-e 's: LIBDIR .*:LIBDIR=${STAGEDIR}${PREFIX}/lib/X11:' \
+		-e 's: MANDIR .*:MANDIR=${STAGEDIR}${PREFIX}/man/man1:' \
+		-e 's: MANSUFFIX .*:MANSUFFIX=1:' \
+		-e 's/^Makefile::/^Makefile:/' \
+		${WRKSRC}/Makefile
+	@${REINPLACE_CMD} \
+		-e 's/^XBINPERM=4711/XBINPERM=711/' \
+		-e "s/^(id \| fgrep 'uid=0(root)')/true/" >/dev/null 2>&1 \
+		${WRKSRC}/install.sh
+
 post-install:
 	@${STRIP_CMD} ${LIBBINDIR}/cda
 	@${STRIP_CMD} ${LIBBINDIR}/gobrowser
 	@${STRIP_CMD} ${LIBBINDIR}/has_alsa
 	@${STRIP_CMD} ${LIBBINDIR}/xmcd
-	@${CAT} ${PKGMESSAGE}
-	@${CP} ${WRKSRC}/xmcd_d/XMcd.ad ${PREFIX}/lib/X11/app-defaults/XMcd
+	@${CP} ${WRKSRC}/xmcd_d/XMcd.ad ${STAGEDIR}${PREFIX}/lib/X11/app-defaults/XMcd
+	@${RM} ${STAGEDIR}${PREFIX}/bin/xmcd
+	@${RM} ${STAGEDIR}${PREFIX}/bin/cda
+	@${LN} -sf .xmcd_start ${STAGEDIR}${PREFIX}/bin/xmcd
+	@${LN} -sf .xmcd_start ${STAGEDIR}${PREFIX}/bin/cda
+	@${REINPLACE_CMD} \
+		-e 's:^BINDIR=.*:XMCDLIB=${PREFIX}/bin:' \
+		-e 's:^XMCDLIB=.*:XMCDLIB=${PREFIX}/lib/X11/xmcd:' \
+		-e 's:^DISCOGDIR=.*:DISCOGDIR=${PREFIX}/lib/X11/xmcd/discog:' \
+		-e 's:XMCD_LIBDIR=.*:XMCD_LIBDIR=${PREFIX}/lib/X11/xmcd:' \
+		${STAGEDIR}${PREFIX}/lib/X11/xmcd/scripts/genidx \
+		${STAGEDIR}${PREFIX}/bin/.xmcd_start
+	@${REINPLACE_CMD} \
+		-e 's:${STAGEDIR}::' \
+		${STAGEDIR}${PREFIX}/lib/X11/xmcd/discog/discog.html \
+		${STAGEDIR}${PREFIX}/lib/X11/xmcd/config/config.sh \
+		${STAGEDIR}${PREFIX}/lib/X11/xmcd/bin-FreeBSD_9-amd64/README
+	@${FIND} ${STAGEDIR} -name \*.bak -delete
 
 .include <bsd.port.mk>

Modified: head/audio/xmcd/files/pkg-message.in
==============================================================================
--- head/audio/xmcd/files/pkg-message.in	Mon May 26 10:03:36 2014	(r355295)
+++ head/audio/xmcd/files/pkg-message.in	Mon May 26 10:10:55 2014	(r355296)
@@ -7,4 +7,12 @@ If you would like to submit data to CDDB
 to install mail/mailx or add something similar to
 the following line in your Xdefaults:
 XMcd.cddbMailCmd:  mail -s '%S' %A <%F >/dev/null 2>&1
+
+xmcd and cda are not suid anymore, so if you want
+to allow non-root users to use xmcd or cda, either
+set the suid bit yourself, or even better, allow
+access to /dev/cd0 in /etc/devfs.conf, e.g.
+
+perm      /dev/cd0	   0664
+
 *******************************************************

Modified: head/audio/xmcd/pkg-plist
==============================================================================
--- head/audio/xmcd/pkg-plist	Mon May 26 10:03:36 2014	(r355295)
+++ head/audio/xmcd/pkg-plist	Mon May 26 10:10:55 2014	(r355296)
@@ -287,9 +287,11 @@ lib/X11/xmcd/pixmaps/xmcd_a.px
 lib/X11/xmcd/pixmaps/xmcd_b.px
 lib/X11/xmcd/pixmaps/xmcd.xpm
 lib/X11/xmcd/scripts/genidx
+man/man1/cda.1.gz
+man/man1/xmcd.1.gz
 @dirrm lib/X11/xmcd/app-defaults
 @dirrm lib/X11/xmcd/bin-FreeBSD_%%RELEASE%%-%%ARCH%%
-@unexec rm -rf %D/lib/X11/xmcd/lib-FreeBSD_%%RELEASE%%-%%ARCH%% 2>&1 >/dev/null || true
+@dirrmtry lib/X11/xmcd/lib-FreeBSD_%%RELEASE%%-%%ARCH%%
 @dirrm lib/X11/xmcd/config/.tbl
 @dirrm lib/X11/xmcd/config
 @dirrm lib/X11/xmcd/discog/Blues/General_Blues



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