Commit aa463ad2 authored by Chris Rees's avatar Chris Rees
Browse files

Add pkg-message with hints on replacing init

Patch to allow running from PREFIX without copying (caveat-- must be on root
filesystem!)

Various minor runtime fixes
parent ae0b5222
Loading
Loading
Loading
Loading
+9 −3
Changes for sysutils/runit/Makefile: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@

PORTNAME=	runit
PORTVERSION=	2.1.2
PORTREVISION=	1
PORTREVISION=	2
CATEGORIES=	sysutils
MASTER_SITES=	http://smarden.org/${PORTNAME}/ \
		http://www.bayofrum.net/dist/${PORTNAME}/
@@ -18,21 +18,27 @@ USE_RC_SUBR= runsvdir
WRKSRC=		${WRKDIR}/admin/${DISTNAME}

SERVICE_DIR?=	/var/service
SUB_FILES=	pkg-message
SUB_LIST=	SERVICE_DIR="${SERVICE_DIR}"
PORTDOCS=	*

DOCS=		package/CHANGES package/README \
		package/THANKS doc/*.html
CONFIG=		etc/freebsd/1 etc/2 etc/freebsd/3 etc/freebsd/ctrlaltdel \
		etc/freebsd/getty-ttyv4/run etc/freebsd/getty-ttyv4/finish
		etc/freebsd/getty-ttyv4/run etc/freebsd/getty-ttyv4/finish \
		etc/freebsd/getty-ttyv4/whichtty

post-patch:
	${REINPLACE_CMD} -i '' 's!/service/!${SERVICE_DIR}!' \
		${WRKSRC}/man/* ${WRKSRC}/src/sv.c
		${PATCH_WRKSRC}/man/* ${PATCH_WRKSRC}/src/sv.c
	${REINPLACE_CMD} -i '' '\|^PATH=|s|$$|:${PREFIX}/bin:${PREFIX}/sbin|' \
		${PATCH_WRKSRC}/etc/freebsd/3
	${FIND} ${PATCH_WRKSRC} -name '*.orig' -delete

do-configure:
	${ECHO_CMD} "${CC} ${CFLAGS}" > ${WRKSRC}/src/conf-cc
	${ECHO_CMD} "${CC}" > ${WRKSRC}/src/conf-ld
	${ECHO_CMD} '#define PREFIX "${PREFIX}"' >> ${WRKSRC}/src/runit.h

do-build:
	cd ${WRKSRC} && package/compile && package/check
+7
Changes for sysutils/runit/files/patch-etc_freebsd_finish: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
--- etc/freebsd/getty-ttyv4/finish	2016-07-28 16:39:47.000000000 +0100
+++ finish	2016-08-10 22:28:28.274811000 +0100
@@ -1,2 +1,3 @@
 #!/bin/sh
-exec utmpset -w ttyv4
+. whichtty
+exec utmpset -w $tty
+8
Changes for sysutils/runit/files/patch-etc_freebsd_run: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
--- etc/freebsd/getty-ttyv4/run	2016-07-28 16:39:47.000000000 +0100
+++ run	2016-08-10 22:28:33.566527000 +0100
@@ -1,2 +1,4 @@
 #!/bin/sh
-exec /usr/libexec/getty Pc ttyv4
+export TERM=xterm
+. whichtty
+exec /usr/libexec/getty Pc $tty
+8
Changes for sysutils/runit/files/patch-etc_freebsd_whichtty: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
--- etc/freebsd/getty-ttyv4/whichtty	1970-01-01 01:00:00.000000000 +0100
+++ etc/freebsd/getty-ttyv4/whichtty	2016-08-10 22:34:36.558752671 +0100
@@ -0,0 +1,5 @@
+realpath=`realpath $0`
+dirname=`dirname $realpath`
+dirname=`basename $dirname`
+tty=`expr $dirname : 'getty-\(ttyv[0-9]\)'`
+[ -z "${tty%0}" ] && echo "Name of directory must be getty-ttyvx, where x is 0-9" && exit 1
+20
Changes for sysutils/runit/files/patch-src_runit-init.c: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
$FreeBSD$

runit is designed to be placed in /sbin.  However, there is no reason that
PREFIX cannot be respected here, so should a user define in loader.conf this
in place, then it will still be found.

init_path=/usr/local/sbin/runit-init:/sbin/init

--- src/runit-init.c.orig	2016-08-10 20:53:15 UTC
+++ src/runit-init.c
@@ -53,6 +53,9 @@ int main (int argc, const char * const *
     /* kernel is starting init, runit does the job. */
     execve(RUNIT, (char *const *)prog, envp);
 
+    /* OK, running from PREFIX-- should be default */
+    execve(PREFIX RUNIT, (char *const *)prog, envp);
+
     /* serious error */
     strerr_die4sys(111, FATAL, "unable to start ", prog[0], ": ");
   }
Loading