mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
Merge pull request #209964 from Majiir/fix-initrd-systemd-closure
nixos/systemd/initrd: follow init param symlinks
This commit is contained in:
commit
99587a3411
@ -518,7 +518,7 @@ in {
|
||||
case $o in
|
||||
init=*)
|
||||
IFS== read -r -a initParam <<< "$o"
|
||||
closure="$(dirname "''${initParam[1]}")"
|
||||
closure="''${initParam[1]}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@ -529,6 +529,13 @@ in {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolve symlinks in the init parameter. We need this for some boot loaders
|
||||
# (e.g. boot.loader.generationsDir).
|
||||
closure="$(chroot /sysroot ${pkgs.coreutils}/bin/realpath "$closure")"
|
||||
|
||||
# Assume the directory containing the init script is the closure.
|
||||
closure="$(dirname "$closure")"
|
||||
|
||||
# If we are not booting a NixOS closure (e.g. init=/bin/sh),
|
||||
# we don't know what root to prepare so we don't do anything
|
||||
if ! [ -x "/sysroot$(readlink "/sysroot$closure/prepare-root" || echo "$closure/prepare-root")" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user