git: fc96e77b56c6 - main - sysutils/busybox: fix reboot/halt/poweroff commands

From: Oleksii Samorukov <samm_at_FreeBSD.org>
Date: Sun, 16 Jul 2023 22:32:25 UTC
The branch main has been updated by samm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fc96e77b56c65223193406b3dedb0d0642f123c8

commit fc96e77b56c65223193406b3dedb0d0642f123c8
Author:     Oleksii Samorukov <samm@FreeBSD.org>
AuthorDate: 2023-07-16 22:31:13 +0000
Commit:     Oleksii Samorukov <samm@FreeBSD.org>
CommitDate: 2023-07-16 22:31:13 +0000

    sysutils/busybox: fix reboot/halt/poweroff commands
---
 sysutils/busybox/Makefile                  |  1 +
 sysutils/busybox/files/patch-init_halt.c   | 15 +++++++++++++++
 sysutils/busybox/files/patch-init_reboot.h | 12 ++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/sysutils/busybox/Makefile b/sysutils/busybox/Makefile
index dcfc467e9127..bf66348b2dab 100644
--- a/sysutils/busybox/Makefile
+++ b/sysutils/busybox/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	busybox
 PORTVERSION=	1.36.1
+PORTREVISION=	1
 CATEGORIES=	sysutils misc shells
 MASTER_SITES=	https://busybox.net/downloads/
 
diff --git a/sysutils/busybox/files/patch-init_halt.c b/sysutils/busybox/files/patch-init_halt.c
new file mode 100644
index 000000000000..351f4a9dde57
--- /dev/null
+++ b/sysutils/busybox/files/patch-init_halt.c
@@ -0,0 +1,15 @@
+--- init/halt.c.orig	2021-01-01 10:52:27 UTC
++++ init/halt.c
+@@ -169,8 +169,11 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
+ 		RB_POWER_OFF,
+ 		RB_AUTOBOOT
+ 	};
++#if defined(__FreeBSD__)
++	static const smallint signals[] = { SIGUSR1, SIGUSR2, SIGINT };
++#else
+ 	static const smallint signals[] = { SIGUSR1, SIGUSR2, SIGTERM };
+-
++#endif
+ 	int delay = 0;
+ 	int which, flags, rc;
+ 
diff --git a/sysutils/busybox/files/patch-init_reboot.h b/sysutils/busybox/files/patch-init_reboot.h
new file mode 100644
index 000000000000..5ba00d98b155
--- /dev/null
+++ b/sysutils/busybox/files/patch-init_reboot.h
@@ -0,0 +1,12 @@
+--- init/reboot.h.orig	2023-07-16 21:31:29 UTC
++++ init/reboot.h
+@@ -12,6 +12,9 @@
+ #  define RB_DISABLE_CAD  0
+ #  define RB_POWER_OFF    0x4321fedc
+ #  define RB_AUTOBOOT     0x01234567
++# elif defined(__FreeBSD__)
++#  define RB_HALT_SYSTEM RB_HALT
++#  define RB_POWER_OFF RB_POWEROFF
+ # elif defined(RB_HALT)
+ #  define RB_HALT_SYSTEM  RB_HALT
+ # endif