nixos/kexec-boot: use dirname of script to resolve bzImage and initrd.gz

This will allow invoking the `kexec-boot` script without `cd`-ing into
its folder first.
This commit is contained in:
Florian Klink
2022-04-13 13:26:04 +02:00
committed by lassulus
parent f0178e45eb
commit 8ea2f75b72
+3 -2
View File
@@ -27,8 +27,9 @@
echo "kexec not found: please install kexec-tools" 2>&1
exit 1
fi
kexec --load ./bzImage \
--initrd=./initrd.gz \
SCRIPT_DIR=$( cd -- "$( dirname -- "''${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
kexec --load ''${SCRIPT_DIR}/bzImage \
--initrd=''${SCRIPT_DIR}/initrd.gz \
--command-line "init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}"
kexec -e
''; in