sdImage: use findmnt to get root device when resizing (#58059)

sdImage: use findmnt to get root device when resizing
This commit is contained in:
Silvan Mosberger 2019-09-20 23:28:01 +02:00 committed by GitHub
commit f47ef8fcf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,8 +174,10 @@ in
boot.postBootCommands = ''
# On the first boot do some maintenance tasks
if [ -f /nix-path-registration ]; then
set -euo pipefail
set -x
# Figure out device names for the boot device and root filesystem.
rootPart=$(readlink -f /dev/disk/by-label/NIXOS_SD)
rootPart=$(${pkgs.utillinux}/bin/findmnt -n -o SOURCE /)
bootDevice=$(lsblk -npo PKNAME $rootPart)
# Resize the root partition and the filesystem to fit the disk