Date: Tue, 01 Jun 2004 22:29:39 +0100 From: Tim Bishop <tim@bishnet.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: tim@bishnet.net Subject: ports/67463: [PATCH] misc/dnetc-i386: Support sparc64/alpha, soon Message-ID: <E1BVGpH-000EHP-9B@pendennis.ukc.ac.uk> Resent-Message-ID: <200406012130.i51LUOdI005274@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 67463 >Category: ports >Synopsis: [PATCH] misc/dnetc-i386: Support sparc64/alpha, soon >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Jun 01 14:30:24 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Tim Bishop >Release: FreeBSD 5.2.1-RELEASE-p5 i386 >Organization: >Environment: System: FreeBSD pendennis.ukc.ac.uk 5.2.1-RELEASE-p5 FreeBSD 5.2.1-RELEASE-p5 #0: Fri Apr 30 17:57:19 BST 2004 >Description: - Make into "master" port to allow for slaves for other architectures (see below) - Take maintainership - Make sure custom user/group are removed at deinstall time - Install rc script as a .sample - Display post-install message using pkg-message instead - Make the rc script's killall a bit more precise - Various other tweaks Added file(s): - pkg-deinstall - pkg-message I thought for quite a while about how to deal with sparc64 and alpha architectures. These are binaries we're pulling down, so the version and distname differ across architectures. My first solution was to have a rather nasty looking PORTVERSION: PORTVERSION=${ARCH:S/i386/2.9007.489/:S/alpha/2.9003.481/:S/sparc64/2.9003.481/} That worked, but felt a bit messy to me. I decided to go with the slave ports idea because the other architectures are really packages in their own right - they have different version numbers and names. This also made managing the distinfo files, and handling new releases easier (which happen at different times for different architectures). Two slave ports to follow. Generated with FreeBSD Port Tools 0.50 >How-To-Repeat: >Fix: --- dnetc-i386-2.9007.489,1.patch begins here --- Index: Makefile =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/Makefile,v retrieving revision 1.41 diff -u -r1.41 Makefile --- Makefile 30 May 2004 07:39:54 -0000 1.41 +++ Makefile 1 Jun 2004 18:26:52 -0000 @@ -6,33 +6,40 @@ # PORTNAME= dnetc -PORTVERSION= 2.9007.489 -PORTREVISION= 0 +# Slave ports may try to override this +PORTVERSION?= 2.9007.489 PORTEPOCH= 1 CATEGORIES= misc MASTER_SITES= ftp://ftp.distributed.net/pub/dcti/%SUBDIR%/ \ http://http.distributed.net/pub/dcti/%SUBDIR%/ MASTER_SITE_SUBDIR= ${PORTVERSION:S/^/v/:R} -DISTFILES= dnetc${PORTVERSION:E}-freebsd-x86-elf.tar.gz +PKGNAMESUFFIX= -${ARCH} +# This is architecture dependent +DISTNAME= dnetc${PORTVERSION:E}-freebsd-${ARCH:S/i386/x86/}-elf -MAINTAINER= ports@FreeBSD.org +MAINTAINER= tim@bishnet.net COMMENT= Distributed.net distributed computing project client -WRKSRC= ${WRKDIR}/dnetc${PORTVERSION:E}-freebsd-x86-elf +# This is architecture dependent +WRKSRC= ${WRKDIR}/dnetc${PORTVERSION:E}-freebsd-${ARCH:S/i386/x86/}-elf -ONLY_FOR_ARCHS= i386 +# Slave ports may have set this +ONLY_FOR_ARCHS?= i386 NO_BUILD= yes BINDIR= ${PREFIX}/distributed.net -LIBDIR= ${PREFIX}/etc/rc.d CLIENTUSER= dnetc CLIENTGROUP= ${CLIENTUSER} +CLIENTUID= 105 -SBINMODE= 700 BINMODE= 700 +PKGINSTALL= ${WRKDIR}/pkg-install +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall +PKGMESSAGE= ${WRKDIR}/pkg-message + MAN1= dnetc.1 .include <bsd.port.pre.mk> @@ -45,6 +52,15 @@ BROKEN= "rc5des/dnetc conflict: Please deinstall all rc5des ports/packages first." .endif +post-extract: + @${SED} -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' -e 's#%%CLIENTGROUP%%#${CLIENTGROUP}#' \ + -e 's#%%CLIENTUID%%#${CLIENTUID}#g' ${MASTERDIR}/pkg-install > ${PKGINSTALL} + @${SED} -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' -e 's#%%CLIENTGROUP%%#${CLIENTGROUP}#' \ + ${MASTERDIR}/pkg-deinstall > ${PKGDEINSTALL} + @${SED} -e 's#%%BINDIR%%#${BINDIR}#' ${MASTERDIR}/pkg-message > ${PKGMESSAGE} + @${SED} -e 's#%%BINDIR%%#${BINDIR}#' -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' \ + ${FILESDIR}/dnetc.sh > ${WRKDIR}/dnetc.sh + do-configure: @if [ ! -f ${PREFIX}/dnetc.ini ]; then \ ${INSTALL} -c -m 644 ${FILESDIR}/dnetc.ini ${WRKSRC}; \ @@ -52,45 +68,26 @@ pre-install: @${ECHO} "==> Creating custom user to run dnetc..." - ${PKGINSTALL} ${PKGNAME} PRE-INSTALL "${CLIENTUSER}" "${CLIENTGROUP}" + @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL do-install: - @if [ ! -d ${BINDIR} ]; then \ + if [ ! -d ${BINDIR} ]; then \ ${MKDIR} ${BINDIR}; \ fi - - ${INSTALL} -c -m ${SBINMODE} -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc ${BINDIR} - - ${SED} s#CHANGETHIS#${BINDIR}# < ${FILESDIR}/dnetc.sh > ${WRKSRC}/dnetc.sh.pathnames - ${INSTALL} -c -m ${SBINMODE} ${WRKSRC}/dnetc.sh.pathnames ${LIBDIR}/dnetc.sh - - ${INSTALL_DATA} ${FILESDIR}/INFO ${BINDIR} - ${CHOWN} ${CLIENTUSER}:${CLIENTGROUP} ${BINDIR} ${CHMOD} 775 ${BINDIR} - if [ ! -f ${BINDIR}/dnetc.sh ]; then \ - ${LN} -s ${LIBDIR}/dnetc.sh ${BINDIR}/dnetc.sh; \ - fi + ${INSTALL} -c -m ${BINMODE} -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc ${BINDIR} + ${INSTALL_DATA} ${FILESDIR}/INFO ${BINDIR} ${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1 - ${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR}/dnetc.ini.default + + ${INSTALL_SCRIPT} ${WRKDIR}/dnetc.sh ${PREFIX}/etc/rc.d/dnetc.sh.sample + + ${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR}/dnetc.ini.sample .if !exists(${BINDIR}/dnetc.ini) - @${ECHO} "" - @${ECHO} "" - @${ECHO} "" - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} "! REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER REMEMBER !" - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} " Don't forget to run '${BINDIR}/dnetc -config' " - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - @${ECHO} "" - @${ECHO} "" - @${ECHO} "" - ${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR} + ${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR}/dnetc.ini + @${CAT} ${PKGMESSAGE} .endif .include <bsd.port.post.mk> Index: pkg-deinstall =================================================================== RCS file: pkg-deinstall diff -N pkg-deinstall --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg-deinstall 1 Jun 2004 18:22:35 -0000 @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +CLIENTUSER=%%CLIENTUSER%% +CLIENTGROUP=%%CLIENTGROUP%% + +if /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then + if /usr/sbin/pw userdel -n $CLIENTUSER; then + echo "=> Removed user \"$CLIENTUSER\"." + else + echo "=> Removing user \"$CLIENTUSER\" failed..." + exit 1 + fi +fi + +if /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then + if /usr/sbin/pw groupdel -n $CLIENTGROUP; then + echo "=> Removed group \"$CLIENTGROUP\"." + else + echo "=> Removing group \"$CLIENTGROUP\" failed..." + exit 1 + fi +fi + +exit 0 Index: pkg-descr =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/pkg-descr,v retrieving revision 1.3 diff -u -r1.3 pkg-descr --- pkg-descr 4 Dec 2002 18:34:57 -0000 1.3 +++ pkg-descr 1 Jun 2004 18:22:35 -0000 @@ -16,7 +16,4 @@ For general help with the client or distributed.net, mail: help@distributed.net -For specific information regarding this port/package, mail: - dbaker@distributed.net or dbaker@cuckoo.com - WWW: http://www.distributed.net/ Index: pkg-install =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/pkg-install,v retrieving revision 1.3 diff -u -r1.3 pkg-install --- pkg-install 30 May 2004 07:39:54 -0000 1.3 +++ pkg-install 1 Jun 2004 18:22:35 -0000 @@ -4,13 +4,13 @@ exit 0 fi -CLIENTUSER=$3 -CLIENTGROUP=$4 -UID=105 +CLIENTUSER=%%CLIENTUSER%% +CLIENTGROUP=%%CLIENTGROUP%% +UID=%%CLIENTUID%% GID=$UID -if ! pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then - if pw groupadd $CLIENTGROUP -g $GID; then +if ! /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then + if /usr/sbin/pw groupadd $CLIENTGROUP -g $GID; then echo "=> Added group \"$CLIENTGROUP\"." else echo "=> Adding group \"$CLIENTGROUP\" failed..." @@ -18,10 +18,10 @@ fi fi -if ! pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then - if pw useradd $CLIENTUSER -u $UID -g $CLIENTGROUP -h - \ +if ! /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then + if /usr/sbin/pw useradd $CLIENTUSER -u $UID -g $CLIENTGROUP -h - \ -s "/sbin/nologin" -d "/nonexistent" \ - -c "distributed.net client and proxy pseudo-user"; \ + -c "distributed.net client pseudo-user"; \ then echo "=> Added user \"$CLIENTUSER\"." else Index: pkg-message =================================================================== RCS file: pkg-message diff -N pkg-message --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg-message 1 Jun 2004 18:22:35 -0000 @@ -0,0 +1,9 @@ +*************************************************************************** + +Note: dnetc has been installed with a sample configuration. + +To change this run: + + %%BINDIR%%/dnetc -config + +*************************************************************************** Index: pkg-plist =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/pkg-plist,v retrieving revision 1.5 diff -u -r1.5 pkg-plist --- pkg-plist 16 Jun 2001 05:07:07 -0000 1.5 +++ pkg-plist 1 Jun 2004 18:22:35 -0000 @@ -1,7 +1,7 @@ -@unexec if cmp -s %D/distributed.net/dnetc.ini %D/distributed.net/dnetc.ini.default; then rm -f %D/distributed.net/dnetc.ini; fi distributed.net/dnetc -distributed.net/dnetc.sh distributed.net/INFO -distributed.net/dnetc.ini.default -etc/rc.d/dnetc.sh -@unexec rmdir %D/distributed.net 2>/dev/null || true +@unexec if cmp -s %D/distributed.net/dnetc.ini %D/distributed.net/dnetc.ini.sample; then rm -f %D/distributed.net/dnetc.ini; fi +distributed.net/dnetc.ini.sample +@exec [ -f %B/dnetc.ini ] || cp %B/%f %B/dnetc.ini +etc/rc.d/dnetc.sh.sample +@dirrm distributed.net Index: files/INFO =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/files/INFO,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 INFO --- files/INFO 26 Dec 1999 22:52:33 -0000 1.1.1.1 +++ files/INFO 1 Jun 2004 18:22:35 -0000 @@ -15,8 +15,3 @@ For general help with the client or distributed.net, mail: help@distributed.net - -For specific information regarding this port/package, mail: - dbaker@distributed.net or dbaker@cuckoo.com - -http://www.distributed.net/cgi-bin/dnet-finger.cgi?user=dbaker Index: files/dnetc.sh =================================================================== RCS file: /u1/freebsd/cvs/ports/misc/dnetc/files/dnetc.sh,v retrieving revision 1.4 diff -u -r1.4 dnetc.sh --- files/dnetc.sh 4 Dec 2001 01:43:20 -0000 1.4 +++ files/dnetc.sh 1 Jun 2004 18:22:35 -0000 @@ -1,6 +1,7 @@ #!/bin/sh -dir="CHANGETHIS" +dir="%%BINDIR%%" +user="%%CLIENTUSER%%" case "$1" in start) @@ -26,10 +27,10 @@ fi echo -n " dnetc" - su -m dnetc -c "$dir/dnetc -quiet" 2>/dev/null >/dev/null & + su -m $user -c "$dir/dnetc -quiet" 2>/dev/null >/dev/null & ;; stop) - killall dnetc && echo -n " dnetc" + killall -u $user dnetc && echo -n " dnetc" ;; *) echo "Usage: `basename $0` {start|stop}" >&2 --- dnetc-i386-2.9007.489,1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1BVGpH-000EHP-9B>