Index: Makefile
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/sysutils/runit/Makefile,v
retrieving revision 1.24
diff -u -r1.24 Makefile
--- Makefile	20 Mar 2010 13:36:22 -0000	1.24
+++ Makefile	24 May 2011 19:36:42 -0000
@@ -7,18 +7,19 @@
 
 PORTNAME=	runit
 PORTVERSION=	2.0.0
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://smarden.org/${PORTNAME}/
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	utisoft@gmail.com
 COMMENT=	Service supervision tools compatible with DJB daemontools
 
 USE_RC_SUBR=	runsvdir.sh
 WRKSRC=		${WRKDIR}/admin/${DISTNAME}
-ALL_TARGET=	default
 
 SERVICE_DIR?=	/var/service
 SUB_LIST=	SERVICE_DIR="${SERVICE_DIR}"
+PORTDOCS=	*
 
 MAN8=		chpst.8 runit-init.8 runit.8 runsv.8 runsvchdir.8 \
 		runsvdir.8 sv.8 svlogd.8 utmpset.8
@@ -27,12 +28,6 @@
 CONFIG=		etc/freebsd/1 etc/2 etc/freebsd/3 etc/freebsd/ctrlaltdel \
 	 	etc/freebsd/getty-ttyv4/run etc/freebsd/getty-ttyv4/finish
 
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} > 900007
-BROKEN=		fails to build with new utmpx
-.endif
-
 do-configure:
 	${ECHO_CMD} "${CC} ${CFLAGS}" > ${WRKSRC}/src/conf-cc
 
@@ -40,22 +35,32 @@
 	cd ${WRKSRC} && package/compile && package/check
 	@${MKDIR} ${WRKDIR}/etc/getty-ttyv4
 .for file in ${CONFIG}
-	@${SED} -e 's!/etc/runit!${PREFIX}/etc/runit!g' \
+	@${SED} -e 's!/etc/runit!${ETCDIR}!g' \
 		-e 's!/service!${SERVICE_DIR}!g' \
 		-e 's!/usr/local!${PREFIX}!g' \
 		${WRKSRC}/${file} > ${WRKDIR}/${file:S!freebsd/!!}.sample
 .endfor
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/command/* ${PREFIX}/sbin
-	${INSTALL_MAN} ${WRKSRC}/man/*.8 ${MANPREFIX}/man/man8
-	@${MKDIR} ${PREFIX}/etc/runit/getty-ttyv4
-	${INSTALL_SCRIPT} ${WRKDIR}/etc/[123c]* ${PREFIX}/etc/runit
-	${INSTALL_SCRIPT} ${WRKDIR}/etc/getty-ttyv4/* \
-		${PREFIX}/etc/runit/getty-ttyv4
+	@${INSTALL_PROGRAM} ${WRKSRC}/command/* ${PREFIX}/sbin
+.for man in ${MAN8}
+	@${INSTALL_MAN} ${WRKSRC}/man/${man} ${MAN8PREFIX}/man/man8
+.endfor
+	@${MKDIR} ${ETCDIR}/getty-ttyv4
+	@${INSTALL_SCRIPT} ${WRKDIR}/etc/[123c]* ${ETCDIR}
+	@${INSTALL_SCRIPT} ${WRKDIR}/etc/getty-ttyv4/* \
+		${ETCDIR}/getty-ttyv4
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
-	cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
+.   for doc in ${DOCS}
+	@${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}
+.   endfor
 .endif
 
-.include <bsd.port.post.mk>
+post-install:
+	@for file in ${ETCDIR}/*.sample ${ETCDIR}/getty-ttyv4/*.sample ; \
+	    do [ ! -f ${ETCDIR}/$${file%.sample} ] \
+		&& ${CP} -p $${file} $${file%.sample} ; \
+	    done
+
+.include <bsd.port.mk>
Index: pkg-plist
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/sysutils/runit/pkg-plist,v
retrieving revision 1.8
diff -u -r1.8 pkg-plist
--- pkg-plist	9 Aug 2006 11:47:39 -0000	1.8
+++ pkg-plist	24 May 2011 19:36:42 -0000
@@ -1,10 +1,22 @@
 @comment $FreeBSD: ports/sysutils/runit/pkg-plist,v 1.8 2006/08/09 11:47:39 sergei Exp $
-etc/runit/1.sample
-etc/runit/2.sample
-etc/runit/3.sample
-etc/runit/ctrlaltdel.sample
-etc/runit/getty-ttyv4/run.sample
-etc/runit/getty-ttyv4/finish.sample
+@unexec cmp -s %D/%%ETCDIR%%/1 %D/%%ETCDIR%%/1.sample && rm -f %D/%%ETCDIR%%/1
+%%ETCDIR%%/1.sample
+@exec [ ! -f %D/%%ETCDIR%%/1 ] && cp -p %D/%F %B/1
+@unexec cmp -s %D/%%ETCDIR%%/2 %D/%%ETCDIR%%/2.sample && rm -f %D/%%ETCDIR%%/2
+%%ETCDIR%%/2.sample
+@exec [ ! -f %D/%%ETCDIR%%/2 ] && cp -p %D/%F %B/2
+@unexec cmp -s %D/%%ETCDIR%%/3 %D/%%ETCDIR%%/3.sample && rm -f %D/%%ETCDIR%%/3
+%%ETCDIR%%/3.sample
+@exec [ ! -f %D/%%ETCDIR%%/3 ] && cp -p %D/%F %B/3
+@unexec cmp -s %D/%%ETCDIR%%/ctrlaltdel %D/%%ETCDIR%%/ctrlaltdel.sample && rm -f %D/%%ETCDIR%%/ctrlaltdel
+%%ETCDIR%%/ctrlaltdel.sample
+@exec [ ! -f %D/%%ETCDIR%%/ctrlaltdel ] && cp -p %D/%F %B/ctrlaltdel
+@unexec cmp -s %D/%%ETCDIR%%/getty-ttyv4/run %D/%%ETCDIR%%/getty-ttyv4/run.sample && rm -f %D/%%ETCDIR%%/getty-ttyv4/run
+%%ETCDIR%%/getty-ttyv4/run.sample
+@exec [ ! -f %D/%%ETCDIR%%/getty-ttyv4/run ] && cp -p %D/%F %B/getty-ttyv4/run
+@unexec cmp -s %D/%%ETCDIR%%/getty-ttyv4/finish %D/%%ETCDIR%%/getty-ttyv4/finish.sample && rm -f %D/%%ETCDIR%%/getty-ttyv4/finish
+%%ETCDIR%%/getty-ttyv4/finish.sample
+@exec [ ! -f %D/%%ETCDIR%%/getty-ttyv4/finish ] && cp -p %D/%F %B/getty-ttyv4/finish
 sbin/chpst
 sbin/runit
 sbin/runit-init
@@ -14,30 +26,5 @@
 sbin/sv
 sbin/svlogd
 sbin/utmpset
-%%PORTDOCS%%%%DOCSDIR%%/CHANGES
-%%PORTDOCS%%%%DOCSDIR%%/COPYING
-%%PORTDOCS%%%%DOCSDIR%%/README
-%%PORTDOCS%%%%DOCSDIR%%/THANKS
-%%PORTDOCS%%%%DOCSDIR%%/benefits.html
-%%PORTDOCS%%%%DOCSDIR%%/chpst.8.html
-%%PORTDOCS%%%%DOCSDIR%%/dependencies.html
-%%PORTDOCS%%%%DOCSDIR%%/faq.html
-%%PORTDOCS%%%%DOCSDIR%%/index.html
-%%PORTDOCS%%%%DOCSDIR%%/install.html
-%%PORTDOCS%%%%DOCSDIR%%/replaceinit.html
-%%PORTDOCS%%%%DOCSDIR%%/runit-init.8.html
-%%PORTDOCS%%%%DOCSDIR%%/runit.8.html
-%%PORTDOCS%%%%DOCSDIR%%/runlevels.html
-%%PORTDOCS%%%%DOCSDIR%%/runscripts.html
-%%PORTDOCS%%%%DOCSDIR%%/runsv.8.html
-%%PORTDOCS%%%%DOCSDIR%%/runsvchdir.8.html
-%%PORTDOCS%%%%DOCSDIR%%/runsvdir.8.html
-%%PORTDOCS%%%%DOCSDIR%%/sv.8.html
-%%PORTDOCS%%%%DOCSDIR%%/svlogd.8.html
-%%PORTDOCS%%%%DOCSDIR%%/upgrade.html
-%%PORTDOCS%%%%DOCSDIR%%/usedietlibc.html
-%%PORTDOCS%%%%DOCSDIR%%/useinit.html
-%%PORTDOCS%%%%DOCSDIR%%/utmpset.8.html
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
 @dirrm etc/runit/getty-ttyv4
 @dirrm etc/runit
Index: files/patch-utmpx
===================================================================
RCS file: files/patch-utmpx
diff -N files/patch-utmpx
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-utmpx	24 May 2011 19:36:42 -0000
@@ -0,0 +1,96 @@
+$FreeBSD$
+
+Since init lacks this code in FreeBSD (utx-logout is performed in pam_lastlog)
+we will simply make utmpset.c a noop if utmpx is present.
+
+http://lists.freebsd.org/pipermail/freebsd-ports/2011-May/067872.html
+
+diff -ruN ../runit-2.0.0.orig/src/tryuwtmpx.c ./src/tryuwtmpx.c
+--- ../runit-2.0.0.orig/src/tryuwtmpx.c	2008-06-15 21:53:26.000000000 +0100
++++ ./src/tryuwtmpx.c	2011-05-21 21:47:36.834727936 +0100
+@@ -1,9 +1,9 @@
+ #include <sys/types.h>
+ #include <utmpx.h>
+ 
+-struct futmpx ut;
++struct utmpx ut;
+ 
+ int main(void) {
+-  char *s =ut.ut_name;
++  char *s =ut.ut_user;
+   return(0);
+ }
+diff -ruN ../runit-2.0.0.orig/src/utmpset.c ./src/utmpset.c
+--- ../runit-2.0.0.orig/src/utmpset.c	2008-06-15 21:53:26.000000000 +0100
++++ ./src/utmpset.c	2011-05-24 19:11:50.186633061 +0100
+@@ -22,6 +22,11 @@
+ void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
+ 
+ int utmp_logout(const char *line) {
++
++#ifdef _UW_TMP_UTMPX
++  int ok = 1; /* do_nada(); */
++#else /* _UW_TMP_UTMP */
++
+   int fd;
+   uw_tmp ut;
+   int ok =-1;
+@@ -45,9 +50,13 @@
+     break;
+   }
+   close(fd);
++#endif /* _UW_TMP_UTMPX */
+   return(ok);
+ }
+ int wtmp_logout(const char *line) {
++#ifdef _UW_TMP_UTMPX
++  return 1; /* do_nada(); */
++#else /* _UW_TMP_UTMP */
+   int fd;
+   int len;
+   struct stat st;
+@@ -79,6 +88,7 @@
+   }
+   close(fd);
+   return(1);
++#endif /* _UW_TMP_UTMPX */
+ }
+ 
+ int main (int argc, const char * const *argv, const char * const *envp) {
+diff -ruN ../runit-2.0.0.orig/src/uw_tmp.h1 ./src/uw_tmp.h1
+--- ../runit-2.0.0.orig/src/uw_tmp.h1	2008-06-15 21:53:26.000000000 +0100
++++ ./src/uw_tmp.h1	2011-05-24 19:12:55.575957224 +0100
+@@ -3,6 +3,8 @@
+ 
+ /* sysdep: -utmpx */
+ 
++#ifndef _UW_TMP_UTMP
++#define _UW_TMP_UTMP
+ #ifdef _PATH_UTMP
+ #define UW_TMP_UFILE _PATH_UTMP
+ #define UW_TMP_WFILE _PATH_WTMP
+@@ -17,3 +19,4 @@
+ #endif
+ 
+ typedef struct utmp uw_tmp;
++#endif /* _UW_TMP_UTMP */
+diff -ruN ../runit-2.0.0.orig/src/uw_tmp.h2 ./src/uw_tmp.h2
+--- ../runit-2.0.0.orig/src/uw_tmp.h2	2008-06-15 21:53:26.000000000 +0100
++++ ./src/uw_tmp.h2	2011-05-24 19:13:16.542222974 +0100
+@@ -3,11 +3,12 @@
+ 
+ /* sysdep: +utmpx */
+ 
+-#define UW_TMP_UFILE _UTMPX_FILE
+-#define UW_TMP_WFILE _WTMPX_FILE
+-
++#ifndef _UW_TMP_UTMPX
++#define _UW_TMP_UTMPX
+ #ifndef ut_time
+ #define ut_time ut_tv.tv_sec
+ #endif
+ 
+-typedef struct futmpx uw_tmp;
++typedef struct utmpx uw_tmp;
++
++#endif /* _UW_TMP_UTMPX */
Index: files/runsvdir.sh.in
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/sysutils/runit/files/runsvdir.sh.in,v
retrieving revision 1.6
diff -u -r1.6 runsvdir.sh.in
--- files/runsvdir.sh.in	27 Mar 2010 04:30:05 -0000	1.6
+++ files/runsvdir.sh.in	24 May 2011 19:36:42 -0000
@@ -2,9 +2,7 @@
 #
 # $FreeBSD: ports/sysutils/runit/files/runsvdir.sh.in,v 1.6 2010/03/27 04:30:05 dougb Exp $
 #
-
 # PROVIDE: /service
-# REQUIRE: 
 # BEFORE:  SERVERS
 # KEYWORD: shutdown
 
