Skip to content

Commit

Permalink
Merge pull request #442 from yast/review_180604_merged_with_sles15
Browse files Browse the repository at this point in the history
[Review] Request from 'schubi2' @ 'yast/yast-autoinstallation/review_180604_merged_with_sles15'
  • Loading branch information
schubi2 committed Jun 4, 2018
2 parents 326cfc2 + 6d861c2 commit 257c12c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
7 changes: 7 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue May 29 13:20:54 CEST 2018 - schubi@suse.de

- Using new libstorage-ng in order to handle "label" tag in URL.
E.G.: autoyast=label://my_home//autoinst.xml (bnc#1094533)
- 4.0.54

-------------------------------------------------------------------
Fri May 11 08:11:09 UTC 2018 - igonzalezsosa@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.0.53
Version: 4.0.54
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
41 changes: 15 additions & 26 deletions src/modules/ProfileLocation.rb
Expand Up @@ -7,9 +7,12 @@
#
# $Id$
require "yast"
require "y2storage"

module Yast
class ProfileLocationClass < Module
include Yast::Logger

def main
Yast.import "UI"
textdomain "autoinst"
Expand Down Expand Up @@ -125,36 +128,22 @@ def Process
)
SCR.Write(path(".etc.install_inf"), nil)
elsif AutoinstConfig.scheme == "label"
Builtins.y2milestone("searching label")
Builtins.foreach(Storage.GetTargetMap) do |device, v|
Builtins.y2milestone("looking on %1", device)
if Ops.get_string(v, "label", "") == AutoinstConfig.host
AutoinstConfig.scheme = "device"
AutoinstConfig.host = Builtins.substring(device, 5)
Builtins.y2milestone("found on %1", AutoinstConfig.host)
raise Break
end
Builtins.foreach(Ops.get_list(v, "partitions", [])) do |p|
if Ops.get_string(p, "label", "") == AutoinstConfig.host
AutoinstConfig.scheme = "device"
AutoinstConfig.host = Builtins.substring(
Ops.get_string(p, "device", device),
5
)
Builtins.y2milestone("found on %1", AutoinstConfig.host)
raise Break
end
Builtins.y2milestone(
"not found on %1",
Ops.get_string(p, "device", "hm?")
)
end
raise Break if AutoinstConfig.scheme == "device"
# autoyast=label://my_home//autoinst.xml in linuxrc:
# AY is searching for a partition with the label "my_home". This partition
# will be mounted and the autoinst.xml will be used for installation.
log.info("searching label #{AutoinstConfig.host}")
fs = Y2Storage::StorageManager.instance.probed.filesystems.find do |f|
f.label == AutoinstConfig.host
end
if AutoinstConfig.scheme == "label"
if fs && fs.blk_devices.first
AutoinstConfig.scheme = "device"
AutoinstConfig.host = fs.blk_devices.first.basename
log.info("found on #{AutoinstConfig.host}")
else
Report.Error(_("label not found while looking for autoyast profile"))
end
end

filename = basename(AutoinstConfig.filepath)


Expand Down

0 comments on commit 257c12c

Please sign in to comment.