1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-19 00:13:33 +00:00

sysutils/runit: Fix shutdown and reboot

The FreeBSD PREFIX insistence plays havoc with runit, but this
should fix the issues on rebooting and shutting down when using
runit-init.

The problem was because of the inconsistency of where stopit and
reboot are stored.

While here, pet rclint and identify bug in rclint at the same time!
This commit is contained in:
Chris Rees 2023-09-06 20:30:58 +01:00
parent 2a9eb8df39
commit a3a0138c36
5 changed files with 61 additions and 11 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= runit
PORTVERSION= 2.1.2
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= http://smarden.org/${PORTNAME}/ \
http://www.bayofrum.net/dist/${PORTNAME}/
@ -36,14 +36,15 @@ 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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -1,21 +1,21 @@
#!/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%%)
#
# 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%%}