Skip to content

Commit

Permalink
switch to root_partition
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed May 15, 2023
1 parent cb6df8f commit 127ef82
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/bootloader/systemdboot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_menue_entries
if Yast::Stage.initial
# kernel-install script needs the "root=<device>" entry in kernel parameters.
File.open(cmdline_file, "w+") do |fw|
fw.puts("root=#{Yast::BootStorage.boot_partitions.first.name}")
fw.puts("root=#{Yast::BootStorage.root_partitions.first.name}")
end
end

Expand Down
23 changes: 19 additions & 4 deletions src/modules/BootStorage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def boot_filesystem
@boot_fs
end

# Moint point for /.
# @return [Y2Storage::Filesystem]
def root_filesystem
detect_disks

@root_fs
end

def main
textdomain "bootloader"

Expand Down Expand Up @@ -94,7 +102,7 @@ def bootloader_installable?
# resets disk configuration. Clears cache from #detect_disks
def reset_disks
@boot_fs = nil
@root_device = nil
@root_fs = nil
end

def prep_partitions
Expand Down Expand Up @@ -241,17 +249,24 @@ def boot_partitions
stage1_partitions_for(boot_filesystem)
end

# shortcut to get stage1 partitions for /
def root_partitions
stage1_partitions_for(root_filesystem)
end

private

def detect_disks
return if @boot_fs && !storage_changed? # quit if already detected
return if @boot_fs && @root_fs && !storage_changed? # quit if already detected

@root_fs = find_mountpoint("/")
@boot_fs = find_mountpoint("/boot")
@boot_fs ||= find_mountpoint("/")
@boot_fs ||= @root_fs

raise ::Bootloader::NoRoot, "Missing '/' mount point" unless @boot_fs
raise ::Bootloader::NoRoot, "Missing '/' mount point" unless (@boot_fs && @root_fs)

log.info "boot fs #{@boot_fs.inspect}"
log.info "root fs #{@oot_fs.inspect}"

@storage_revision = Y2Storage::StorageManager.instance.staging_revision
end
Expand Down

0 comments on commit 127ef82

Please sign in to comment.