diff --git a/sysutils/runit/Makefile b/sysutils/runit/Makefile index b98867ef8ba4..44cf1846c437 100644 --- a/sysutils/runit/Makefile +++ b/sysutils/runit/Makefile @@ -1,70 +1,71 @@ PORTNAME= runit PORTVERSION= 2.1.2 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= sysutils MASTER_SITES= http://smarden.org/${PORTNAME}/ \ http://www.bayofrum.net/dist/${PORTNAME}/ MAINTAINER= crees@FreeBSD.org COMMENT= Service supervision tools compatible with DJB daemontools WWW= http://smarden.org/runit/ LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/package/COPYING BROKEN_mips= fails to install: runit-init failed BROKEN_mips64= fails to install: runit-init failed USES= cpe 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/whichtty OPTIONS_DEFINE= DOCS post-patch: ${REINPLACE_CMD} -i '' 's!/service/!${SERVICE_DIR}!' \ ${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 + ${REINPLACE_CMD} 's,%%PREFIX%%,${PREFIX},g' \ + ${WRKSRC}/src/runit.h \ + ${WRKSRC}/etc/freebsd/1 \ + ${WRKSRC}/etc/freebsd/3 do-build: cd ${WRKSRC} && package/compile && package/check @${MKDIR} ${WRKDIR}/etc/getty-ttyv4 .for file in ${CONFIG} @${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/* ${STAGEDIR}${PREFIX}/sbin ${INSTALL_MAN} ${WRKSRC}/man/* ${STAGEDIR}${PREFIX}/man/man8/ @${MKDIR} ${STAGEDIR}${ETCDIR}/getty-ttyv4 ${INSTALL_SCRIPT} ${WRKDIR}/etc/[123c]* ${STAGEDIR}${ETCDIR} ${INSTALL_SCRIPT} ${WRKDIR}/etc/getty-ttyv4/* \ ${STAGEDIR}${ETCDIR}/getty-ttyv4 do-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR} .include diff --git a/sysutils/runit/files/patch-etc_freebsd_1 b/sysutils/runit/files/patch-etc_freebsd_1 new file mode 100644 index 000000000000..867c2e3aae90 --- /dev/null +++ b/sysutils/runit/files/patch-etc_freebsd_1 @@ -0,0 +1,19 @@ +--- etc/freebsd/1.orig 2023-06-06 12:43:28 UTC ++++ etc/freebsd/1 +@@ -1,7 +1,7 @@ + #!/bin/sh + # system one time tasks + +-PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin ++PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin + trap : 2 + trap : 3 + +@@ -13,5 +13,5 @@ if test $? -ne 0; then + sh -p + exec reboot + fi +-touch /etc/runit/stopit +-chmod 0 /etc/runit/stopit ++touch /etc/runit/stopit /etc/runit/reboot ++chmod 0 /etc/runit/stopit /etc/runit/reboot diff --git a/sysutils/runit/files/patch-etc_freebsd_3 b/sysutils/runit/files/patch-etc_freebsd_3 new file mode 100644 index 000000000000..0a4b61724d01 --- /dev/null +++ b/sysutils/runit/files/patch-etc_freebsd_3 @@ -0,0 +1,18 @@ +--- etc/freebsd/3.orig 2023-06-06 12:50:59 UTC ++++ etc/freebsd/3 +@@ -1,7 +1,7 @@ + #!/bin/sh + exec 2>&1 + +-PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin ++PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/sbin:%%PREFIX%%/bin + + echo 'Waiting for services to stop...' + sv -w196 force-stop /service/* +@@ -11,5 +11,5 @@ echo 'Shutdown...' + if test -x /etc/runit/reboot; then + exec reboot + else +- exec halt ++ exec halt -p + fi diff --git a/sysutils/runit/files/patch-src_runit.h b/sysutils/runit/files/patch-src_runit.h new file mode 100644 index 000000000000..6a2ab2c91f94 --- /dev/null +++ b/sysutils/runit/files/patch-src_runit.h @@ -0,0 +1,12 @@ +--- src/runit.h.orig 2023-06-06 12:35:21 UTC ++++ src/runit.h +@@ -1,4 +1,5 @@ +-#define RUNIT "/sbin/runit" +-#define STOPIT "/etc/runit/stopit" +-#define REBOOT "/etc/runit/reboot" +-#define CTRLALTDEL "/etc/runit/ctrlaltdel" ++#define PREFIX "%%PREFIX%%" ++#define RUNIT PREFIX "/sbin/runit" ++#define STOPIT PREFIX "/etc/runit/stopit" ++#define REBOOT PREFIX "/etc/runit/reboot" ++#define CTRLALTDEL PREFIX "/etc/runit/ctrlaltdel" diff --git a/sysutils/runit/files/runsvdir.in b/sysutils/runit/files/runsvdir.in index 64cf7610f820..0bddc293b01e 100644 --- a/sysutils/runit/files/runsvdir.in +++ b/sysutils/runit/files/runsvdir.in @@ -1,36 +1,36 @@ #!/bin/sh - -# PROVIDE: /service +# +# PROVIDE: runsvdir # BEFORE: SERVERS # KEYWORD: shutdown - -# Add the following lines to /etc/rc.conf to enable `runsvdir': # -#runsvdir_enable="YES" (default: NO) -#runsvdir_path="/service" (default: %%SERVICE_DIR%%) +# Add the following lines to /etc/rc.conf to enable `runsvdir': # +# runsvdir_enable="YES" (default: NO) +# runsvdir_path="/var/service" (default: %%SERVICE_DIR%%) . /etc/rc.subr name=runsvdir rcvar=runsvdir_enable +desc="Runit service supervision" -load_rc_config runsvdir +load_rc_config $name : ${runsvdir_enable:=NO} : ${runsvdir_path=%%SERVICE_DIR%%} command="%%PREFIX%%/sbin/runsvdir" start_cmd=runsvdir_start stop_postcmd="%%PREFIX%%/sbin/sv exit ${runsvdir_path}/*" runsvdir_start() { /bin/test -d ${runsvdir_path} || /bin/mkdir -p ${runsvdir_path} /usr/bin/env -i \ PATH=/command:%%PREFIX%%/sbin:%%PREFIX%%/bin:/sbin:/bin:/usr/sbin:/usr/bin \ /usr/sbin/daemon -c -f \ ${command} ${runsvdir_path} } run_rc_command $1