Skip to content

Commit

Permalink
label tag in URL - using libstorage-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed May 29, 2018
1 parent 2145219 commit 1ca968f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 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.52

-------------------------------------------------------------------
Fri Apr 28 16:24:37 CEST 2018 - schubi@suse.de

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

Name: autoyast2
Version: 4.0.51
Version: 4.0.52
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
44 changes: 17 additions & 27 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,23 @@ 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"
Report.Error(_("label not found while looking for autoyast profile"))
if fs
AutoinstConfig.scheme = "device"
AutoinstConfig.host = fs.blk_devices.first.name
AutoinstConfig.host.slice!("/dev/")
log.info("found on #{AutoinstConfig.host}")
else
log.error(_("label not found while looking for autoyast profile"))
end
end

filename = basename(AutoinstConfig.filepath)


Expand Down

0 comments on commit 1ca968f

Please sign in to comment.