about summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2022-02-26 23:24:38 +0100
committerlassulus <lassulus@lassul.us>2022-04-13 13:26:04 +0200
commit8ea2f75b72e11beb34121022e4d3243bd2fb6c89 (patch)
tree8cfe48afbdddcc9073f9e1dc77332f42536eaff5 /nixos/modules/installer
parentf0178e45eb6f218acef4e8ae46aaea052a2171c7 (diff)
downloadnixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar.gz
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar.bz2
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar.lz
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar.xz
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.tar.zst
nixlib-8ea2f75b72e11beb34121022e4d3243bd2fb6c89.zip
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.
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/kexec/kexec-boot.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/installer/kexec/kexec-boot.nix b/nixos/modules/installer/kexec/kexec-boot.nix
index c2f1a64a36a0..95ab774468c1 100644
--- a/nixos/modules/installer/kexec/kexec-boot.nix
+++ b/nixos/modules/installer/kexec/kexec-boot.nix
@@ -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