From e4dcc0e84a20c61478b4f130b2cd31dfc32285f3 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Thu, 22 Feb 2024 09:58:13 +0800 Subject: [PATCH] configure shutdown instructions in runit stage 3 --- flake.nix | 1 + pr-31.patch | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 pr-31.patch diff --git a/flake.nix b/flake.nix index 16c2d66..8880993 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,7 @@ ./pr-28.patch ./pr-29.patch ./pr-30.patch + ./pr-31.patch ]; }; diff --git a/pr-31.patch b/pr-31.patch new file mode 100644 index 0000000..df54f2b --- /dev/null +++ b/pr-31.patch @@ -0,0 +1,28 @@ +diff --git a/runit.nix b/runit.nix +index d7b0bf3..64f99f2 100644 +--- a/runit.nix ++++ b/runit.nix +@@ -57,6 +57,23 @@ in + ''; + "runit/3".source = pkgs.writeScript "3" '' + #!${pkgs.runtimeShell} ++ echo Waiting for services to stop... ++ sv force-stop /etc/service/* ++ sv exit /etc/service/* ++ ++ echo Sending TERM signal to processes... ++ pkill --inverse -s0,1 -TERM ++ sleep 1 ++ echo Sending KILL signal to processes... ++ pkill --inverse -s0,1 -KILL ++ ++ echo Unmounting filesystems, disabling swap... ++ swapoff -a ++ umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs ++ echo Remounting rootfs read-only... ++ mount -o remount,ro / ++ ++ sync + echo and down we go + ''; + "service/sshd/run".source = pkgs.writeScript "sshd_run" '' -- 2.47.0