-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
install-grub.pl: support bindmounts #374398
base: master
Are you sure you want to change the base?
Conversation
c955ca5
to
548802c
Compare
It looks like the code in See: |
ca00777
to
277371b
Compare
277371b
to
437f40c
Compare
The current implementation of GetFS uses heuristics to find the best filesystem for the given boot path. Using findmnt is more robust.
437f40c
to
1dcd74f
Compare
|
||
# BTRFS is a special case in that we need to fix the referenced path based on subvolumes | ||
if ($fs->type eq 'btrfs') { | ||
my ($status, @id_info) = runCommand("@btrfsprogs@/bin/btrfs", "subvol", "show", @{[$fs->mount]}); | ||
if ($status != 0) { | ||
die "Failed to retrieve subvolume info for @{[$fs->mount]}\n"; | ||
} | ||
my @ids = join("\n", @id_info) =~ m/^(?!\/\n).*Subvolume ID:[ \t\n]*([0-9]+)/s; | ||
if ($#ids > 0) { | ||
die "Btrfs subvol name for @{[$fs->device]} listed multiple times in mount\n" | ||
} elsif ($#ids == 0) { | ||
my ($status, @path_info) = runCommand("@btrfsprogs@/bin/btrfs", "subvol", "list", @{[$fs->mount]}); | ||
if ($status != 0) { | ||
die "Failed to find @{[$fs->mount]} subvolume id from btrfs\n"; | ||
} | ||
my @paths = join("", @path_info) =~ m/ID $ids[0] [^\n]* path ([^\n]*)/; | ||
if ($#paths > 0) { | ||
die "Btrfs returned multiple paths for a single subvolume id, mountpoint @{[$fs->mount]}\n"; | ||
} elsif ($#paths != 0) { | ||
die "Btrfs did not return a path for the subvolume at @{[$fs->mount]}\n"; | ||
} | ||
$path = "/$paths[0]$path"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btrfs no longer needs to be treated specially here since $fs->root
will contain the subvolume path and will be resolved the same way bind mounts are resolved.
1dcd74f
to
ce234a4
Compare
Specifically this allows bind-mounting your `/boot` directory with NixOS impermanence.
ce234a4
to
986445f
Compare
Specifically, this fixes grub generation when bind-mounting your
/nix
&/boot
directory with NixOS impermanence.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.