Configure shutdown instructions in runit stage 3 #35

Merged
sb10q merged 1 commits from fsagbuya/nix-servo:recovery into master 2024-02-22 09:59:48 +08:00
2 changed files with 29 additions and 0 deletions
Showing only changes of commit e4dcc0e84a - Show all commits

View File

@ -19,6 +19,7 @@
./pr-28.patch ./pr-28.patch
./pr-29.patch ./pr-29.patch
./pr-30.patch ./pr-30.patch
./pr-31.patch
]; ];
}; };

28
pr-31.patch Normal file
View File

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