git: a3a0138c361a - main - sysutils/runit: Fix shutdown and reboot
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 Sep 2023 06:51:15 UTC
The branch main has been updated by crees:
URL: https://cgit.FreeBSD.org/ports/commit/?id=a3a0138c361a100177bca61ddd1d545d5402a674
commit a3a0138c361a100177bca61ddd1d545d5402a674
Author: Chris Rees <crees@FreeBSD.org>
AuthorDate: 2023-09-06 19:30:58 +0000
Commit: Chris Rees <crees@FreeBSD.org>
CommitDate: 2023-09-17 06:50:43 +0000
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!
---
sysutils/runit/Makefile | 9 +++++----
sysutils/runit/files/patch-etc_freebsd_1 | 19 +++++++++++++++++++
sysutils/runit/files/patch-etc_freebsd_3 | 18 ++++++++++++++++++
sysutils/runit/files/patch-src_runit.h | 12 ++++++++++++
sysutils/runit/files/runsvdir.in | 14 +++++++-------
5 files changed, 61 insertions(+), 11 deletions(-)
diff --git a/sysutils/runit/Makefile b/sysutils/runit/Makefile
index b98867ef8ba4..44cf1846c437 100644
--- a/sysutils/runit/Makefile
+++ b/sysutils/runit/Makefile
@@ -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
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,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%%)
+# 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%%}