3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #60237 from mayflower/kexec-no-clobber

nixos/kexec: don't clobber existing kexec-loaded kernel
This commit is contained in:
Linus Heckemann 2019-05-06 21:53:47 +02:00 committed by GitHub
commit 864f4f084a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,8 +13,18 @@
path = [ pkgs.kexectools ];
script =
''
# Don't load the current system profile if we already have a kernel loaded
if [[ 1 = "$(</sys/kernel/kexec_loaded)" ]] ; then
echo "kexec kernel has already been loaded, prepare-kexec skipped"
exit 0
fi
p=$(readlink -f /nix/var/nix/profiles/system)
if ! [ -d $p ]; then exit 1; fi
if ! [[ -d $p ]]; then
echo "Could not find system profile for prepare-kexec"
exit 1
fi
echo "Loading NixOS system via kexec."
exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
'';
};