nixos/kexec: don't clobber existing kexec-loaded kernel
This commit is contained in:
parent
2024421f04
commit
4d667685c2
@ -13,6 +13,9 @@
|
|||||||
path = [ pkgs.kexectools ];
|
path = [ pkgs.kexectools ];
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
|
# Don't load the current system profile if we already have a kernel loaded
|
||||||
|
[[ 1 = "$(</sys/kernel/kexec_loaded)" ]] && exit
|
||||||
|
|
||||||
p=$(readlink -f /nix/var/nix/profiles/system)
|
p=$(readlink -f /nix/var/nix/profiles/system)
|
||||||
if ! [ -d $p ]; then exit 1; fi
|
if ! [ -d $p ]; then exit 1; fi
|
||||||
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
|
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
|
||||||
|
Loading…
Reference in New Issue
Block a user