From 9a96cbb6a8af7a943492083f951b52709e3d1e1b Mon Sep 17 00:00:00 2001 From: Emile 'iMil' Heitor Date: Tue, 28 Jan 2025 06:38:41 +0000 Subject: [PATCH 1/4] feat: add NetBSD as a supported platform, use case for PLATFORM test --- configure | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 21264d1e..e08c0f14 100755 --- a/configure +++ b/configure @@ -420,10 +420,13 @@ fi [ -z "${STRIPOPTS+IS_SET}" ] && STRIPOPTS="-s" ## Verify PLATFORM value -if [ "$PLATFORM" != "Linux" ] && [ "$PLATFORM" != "FreeBSD" ] && \ -[ "$PLATFORM" != "OpenBSD" ] && [ "$PLATFORM" != "Darwin" ]; then - warning "$PLATFORM platform is unknown!" "Known Platforms are: Linux, FreeBSD, OpenBSD, Darwin" -fi +case "$PLATFORM" in +Linux|FreeBSD|NetBSD|OpenBSD|Darwin) + ;; +*) warning "$PLATFORM platform is unknown!" \ + "Known Platforms are: Linux, FreeBSD, NetBSD, OpenBSD, Darwin" + ;; +esac ## Create testfile.cc to test c++ compiler configtmpdir=`mktmpdir` From 6da99cfce05ef134f47b3b62485b2161b7494050 Mon Sep 17 00:00:00 2001 From: Emile 'iMil' Heitor Date: Tue, 28 Jan 2025 10:25:48 +0000 Subject: [PATCH 2/4] feat: add shutdown support for NetBSD --- src/shutdown.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/shutdown.cc b/src/shutdown.cc index 2e4ea915..6a6ab0ce 100644 --- a/src/shutdown.cc +++ b/src/shutdown.cc @@ -496,7 +496,11 @@ void do_system_shutdown(shutdown_type_t shutdown_type) sub_buf.append("Issuing shutdown via kernel...\n"); loop.poll(); // give message a chance to get to console +#ifdef __NetBSD__ + reboot(reboot_type, NULL); +#else reboot(reboot_type); +#endif } // Watcher for subprocess output. @@ -637,7 +641,11 @@ static loop_t::child_proc_watcher::proc_status_t run_process(const char * prog_a static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf) { try { +#ifdef __NetBSD__ + const char * unmount_args[] = { "/sbin/umount", "-a", nullptr }; +#else const char * unmount_args[] = { "/bin/umount", "-a", "-r", nullptr }; +#endif run_process(unmount_args, loop, sub_buf); } catch (std::exception &e) { @@ -650,7 +658,11 @@ static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf) static void swap_off(loop_t &loop, subproc_buffer &sub_buf) { try { +#ifdef __NetBSD__ + const char * swapoff_args[] = { "/sbin/swapctl", "-U", nullptr }; +#else const char * swapoff_args[] = { "/sbin/swapoff", "-a", nullptr }; +#endif run_process(swapoff_args, loop, sub_buf); } catch (std::exception &e) { From e4df11ca4a075b38171a14a607b226726c3dc9a2 Mon Sep 17 00:00:00 2001 From: iMil Date: Wed, 29 Jan 2025 16:44:24 +0100 Subject: [PATCH 3/4] Update configure Co-authored-by: Mobin --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index e08c0f14..d8fc5feb 100755 --- a/configure +++ b/configure @@ -421,7 +421,7 @@ fi ## Verify PLATFORM value case "$PLATFORM" in -Linux|FreeBSD|NetBSD|OpenBSD|Darwin) + Linux|FreeBSD|NetBSD|OpenBSD|Darwin) ;; *) warning "$PLATFORM platform is unknown!" \ "Known Platforms are: Linux, FreeBSD, NetBSD, OpenBSD, Darwin" From 65ce9c4d1896d83080791e7708d0134c16fd7d78 Mon Sep 17 00:00:00 2001 From: iMil Date: Wed, 29 Jan 2025 17:45:07 +0100 Subject: [PATCH 4/4] Update configure Co-authored-by: Mobin --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d8fc5feb..12b79168 100755 --- a/configure +++ b/configure @@ -423,8 +423,8 @@ fi case "$PLATFORM" in Linux|FreeBSD|NetBSD|OpenBSD|Darwin) ;; -*) warning "$PLATFORM platform is unknown!" \ - "Known Platforms are: Linux, FreeBSD, NetBSD, OpenBSD, Darwin" + *) warning "$PLATFORM platform is unknown!" \ + "Known Platforms are: Linux, FreeBSD, NetBSD, OpenBSD, Darwin" ;; esac