Skip to content
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

Add commit callbacks to inst_prepdisk #1336

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 5 10:50:07 UTC 2023 - José Iván López González <jlopez@suse.com>

- Allow to pass commit callbacks to inst_prepdisk client.
- Needed for Agama (gh#openSUSE/agama/558).
- 4.6.8

-------------------------------------------------------------------
Wed May 3 11:51:09 UTC 2023 - Ancor Gonzalez Sosa <ancor@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.6.7
Version: 4.6.8
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
15 changes: 12 additions & 3 deletions src/lib/y2storage/clients/inst_prepdisk.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) [2015-2016] SUSE LLC
# Copyright (c) [2015-2023] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -38,8 +38,12 @@ class InstPrepdisk

EFIVARS_PATH = "/sys/firmware/efi/efivars".freeze

def initialize
# Constructor
#
# @param commit_callbacks [Storage::CommitCallbacks, nil]
def initialize(commit_callbacks: nil)
textdomain "storage"
@commit_callbacks = commit_callbacks
end

def run
Expand All @@ -58,13 +62,18 @@ def run

protected

# Callbacks to use for commit
#
# @return [Storage::CommitCallbacks, nil]
attr_reader :commit_callbacks

# Commits the actions to disk
#
# @return [Boolean] true if everything went fine, false if the user
# decided to abort
def commit
manager.rootprefix = Yast::Installation.destdir
return false unless manager.commit(force_rw: true)
return false unless manager.commit(force_rw: true, callbacks: commit_callbacks)

mount_in_target("/dev", "devtmpfs", "-t devtmpfs")
mount_in_target("/proc", "proc", "-t proc")
Expand Down
2 changes: 1 addition & 1 deletion src/lib/y2storage/storage_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def committed?
# The user is asked whether to continue on each error reported by libstorage-ng.
#
# @param force_rw [Boolean] if mount points should be forced to have read/write permissions.
# @param callbacks [Y2Storage::Callbacks::Commit]
# @param callbacks [Storage::CommitCallbacks]
#
# @return [Boolean] whether commit was successful, false if libstorage-ng found a problem and it was
# decided to abort.
Expand Down