Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Oct 31, 2018
1 parent 2bf3bfa commit 652e126
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/modules/RootPart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,8 @@ def MountFSTab(fstab, message)

mount_err = ""
while mount_err != nil
mount_err = FsckAndMount(fspath, spec, mount_type, mntops)
# TODO
mount_err = FsckAndMount(fspath, safest_device_name(spec), mount_type, mntops)
if mount_err != nil
Builtins.y2error(
"mounting %1 (type %2) on %3 failed",
Expand Down Expand Up @@ -1531,9 +1532,21 @@ def MountPartitions(root_device_current)
fstab = fstab_ref.value
crtab = crtab_ref.value

# Update encryption devices with the names indicated in the crypttab file (bsc#1094963)
# Save encryption device names according to values in crypttab file (bsc#1094963).
# Those names are then used to find a device specified in the fstab file.
#
# For example, when fstab has:
#
# /dev/disk/by-id/dm-name-cr_home / auto
#
# And the fstab device is searched:
#
# devicegraph.find_by_any_name("/dev/disk/by-id/dm-name-cr_home")
#
# as fallback, it will try to find a device with name "/dev/disk/by-id/dm-name-cr-auto-1" if
# threre is a LUKS "cr-auto-1" with crypttab name "cr_home".
crypttab_path = File.join(Installation.destdir, "/etc/crypttab")
Y2Storage::Encryption.use_crypttab_names(probed, crypttab_path)
Y2Storage::Encryption.save_crypttab_names(probed, crypttab_path)

Update.GetProductName

Expand Down Expand Up @@ -2246,6 +2259,20 @@ def fs_by_udev_lookup(devicegraph, name)
dev.filesystem
end

def safest_device_name(device_spec)
return device_spec if device_spec.start_with?("UUID=")

udev_uuid(device_spec) || device_spec
end

def udev_uuid(device_spec)
filesystem = fs_by_devicename(probed, device_spec)
return nil if filesystem.nil?

device = filesystem.blk_devices.first
device.udev_full_uuid
end

# Whether the given fstab spec corresponds to a device mounted by its kernel
# device name.
#
Expand Down

0 comments on commit 652e126

Please sign in to comment.