Hello community,

here is the log from the commit of package yast2-bootloader for 
openSUSE:Factory checked in at 2016-05-23 16:36:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-bootloader.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-bootloader"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes        
2016-05-13 09:22:26.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes   
2016-05-23 16:36:05.000000000 +0200
@@ -1,0 +2,28 @@
+Tue May 17 07:42:46 UTC 2016 - [email protected]
+
+- do not skip grub2 install during installation on s390
+  (bnc#980250)
+- 3.1.187
+
+-------------------------------------------------------------------
+Mon May 16 12:21:09 UTC 2016 - [email protected]
+
+- Fix storing default boot section (bnc#978366)
+- Fix showing default boot section name with spaces inside
+  (found during testing fix for bnc#978366)
+- 3.1.186
+
+-------------------------------------------------------------------
+Mon May 16 11:41:05 UTC 2016 - [email protected]
+
+- do not install grub2 with --no-nvram on non-EFI systems
+  (bnc#980108)
+- 3.1.185
+
+-------------------------------------------------------------------
+Mon May 16 09:36:28 UTC 2016 - [email protected]
+
+- Reintroduce Trusted Boot (FATE#316553).
+- 3.1.184
+
+-------------------------------------------------------------------

Old:
----
  yast2-bootloader-3.1.183.tar.bz2

New:
----
  yast2-bootloader-3.1.187.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.dDjHSs/_old  2016-05-23 16:36:06.000000000 +0200
+++ /var/tmp/diff_new_pack.dDjHSs/_new  2016-05-23 16:36:06.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        3.1.183
+Version:        3.1.187
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-bootloader-3.1.183.tar.bz2 -> yast2-bootloader-3.1.187.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/.rubocop.yml 
new/yast2-bootloader-3.1.187/.rubocop.yml
--- old/yast2-bootloader-3.1.183/.rubocop.yml   2016-05-12 17:22:00.000000000 
+0200
+++ new/yast2-bootloader-3.1.187/.rubocop.yml   2016-05-17 10:29:14.000000000 
+0200
@@ -31,7 +31,7 @@
 
 # Configuration parameters: CountComments.
 Metrics/ClassLength:
-  Max: 250 # TODO this should be lower for new code
+  Max: 256 # TODO this should be lower for new code
   Include:
     - 'src/lib/**/*.rb' # be more strict for new code in lib
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/package/yast2-bootloader.changes 
new/yast2-bootloader-3.1.187/package/yast2-bootloader.changes
--- old/yast2-bootloader-3.1.183/package/yast2-bootloader.changes       
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/package/yast2-bootloader.changes       
2016-05-17 10:29:14.000000000 +0200
@@ -1,7 +1,35 @@
 -------------------------------------------------------------------
+Tue May 17 07:42:46 UTC 2016 - [email protected]
+
+- do not skip grub2 install during installation on s390
+  (bnc#980250)
+- 3.1.187
+
+-------------------------------------------------------------------
+Mon May 16 12:21:09 UTC 2016 - [email protected]
+
+- Fix storing default boot section (bnc#978366)
+- Fix showing default boot section name with spaces inside
+  (found during testing fix for bnc#978366)
+- 3.1.186
+
+-------------------------------------------------------------------
+Mon May 16 11:41:05 UTC 2016 - [email protected]
+
+- do not install grub2 with --no-nvram on non-EFI systems
+  (bnc#980108)
+- 3.1.185
+
+-------------------------------------------------------------------
+Mon May 16 09:36:28 UTC 2016 - [email protected]
+
+- Reintroduce Trusted Boot (FATE#316553).
+- 3.1.184
+
+-------------------------------------------------------------------
 Thu May 12 15:46:49 CEST 2016 - [email protected]
 
-- fix grub2 settings for lvm encrypted boot partition (bsc #976315)
+- fix grub2 settings for lvm encrypted boot partition (bsc#976315)
 - 3.1.183
 
 -------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/package/yast2-bootloader.spec 
new/yast2-bootloader-3.1.187/package/yast2-bootloader.spec
--- old/yast2-bootloader-3.1.183/package/yast2-bootloader.spec  2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/package/yast2-bootloader.spec  2016-05-17 
10:29:14.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        3.1.183
+Version:        3.1.187
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/autoyast_converter.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/autoyast_converter.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/autoyast_converter.rb       
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/autoyast_converter.rb       
2016-05-17 10:29:14.000000000 +0200
@@ -29,6 +29,7 @@
         # let it be empty if not defined to keep code simplier as effect is 
same
         data["global"] ||= {}
 
+        import_grub2(data, bootloader)
         import_stage1(data, bootloader)
         import_default(data, bootloader.grub_default)
         # TODO: import Initrd
@@ -48,6 +49,7 @@
 
         res["global"] = {}
         global = res["global"]
+        export_grub2(global, config) if config.name == "grub2"
         export_stage1(global, config.stage1) if config.respond_to?(:stage1)
         export_default(global, config.grub_default)
 
@@ -56,6 +58,17 @@
 
     private
 
+      def import_grub2(data, bootloader)
+        return unless bootloader.name == "grub2"
+
+        GRUB2_BOOLEAN_MAPPING.each do |key, method|
+          val = data["global"][key]
+          next unless val
+
+          bootloader.public_send(:"#{method}=", val == "true")
+        end
+      end
+
       def import_default(data, default)
         DEFAULT_BOOLEAN_MAPPING.each do |key, method|
           val = data["global"][key]
@@ -180,6 +193,17 @@
         res["boot_custom"] = stage1.custom_devices.join(",") unless 
stage1.custom_devices.empty?
       end
 
+      # only for grub2, not for others
+      GRUB2_BOOLEAN_MAPPING = {
+        "trusted_grub" => :trusted_boot
+      }
+      def export_grub2(res, bootloader)
+        GRUB2_BOOLEAN_MAPPING.each do |key, method|
+          val = bootloader.public_send(method)
+          res[key] = val ? "true" : "false" unless val.nil?
+        end
+      end
+
       DEFAULT_BOOLEAN_MAPPING = {
         "os_prober" => :os_prober
       }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2.rb    2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2.rb    2016-05-17 
10:29:14.000000000 +0200
@@ -17,6 +17,8 @@
   class Grub2 < Grub2Base
     attr_reader :stage1
     attr_reader :device_map
+    # @return [Boolean]
+    attr_accessor :trusted_boot
 
     def initialize
       super
@@ -25,11 +27,11 @@
       @stage1 = Stage1.new
       @grub_install = GrubInstall.new(efi: false)
       @device_map = DeviceMap.new
+      @trusted_boot = false
     end
 
-    # Read settings from disk
-    # @param [Boolean] reread boolean true to force reread settings from system
-    def read(reread: false)
+    # Read settings from disk, overwritting already set values
+    def read
       super
 
       begin
@@ -50,6 +52,8 @@
         log.info "grub2/device.map does not exist. Using empty one."
         @device_map = DeviceMap.new
       end
+
+      @trusted_boot = Sysconfig.from_system.trusted_boot
     end
 
     # Write bootloader settings to disk
@@ -65,7 +69,9 @@
       pmbr_setup(*gpt_disks_devices)
 
       # powernv must not call grub2-install (bnc#970582)
-      @grub_install.execute(devices: stage1.devices) unless 
Yast::Arch.board_powernv
+      unless Yast::Arch.board_powernv
+        @grub_install.execute(devices: stage1.devices, trusted_boot: 
trusted_boot)
+      end
       # Do some mbr activations ( s390 do not have mbr nor boot flag on its 
disks )
       # powernv do not have prep partition, so we do not have any partition to 
activate (bnc#970582)
       MBRUpdate.new.run(stage1) if !Yast::Arch.s390 && 
!Yast::Arch.board_powernv
@@ -79,31 +85,16 @@
       # boot, safer option for legacy booting (bnc#872054)
       self.pmbr_action = :add if Yast::BootStorage.gpt_boot_disk?
       device_map.propose if Yast::Arch.x86_64 || Yast::Arch.i386
+      @trusted_boot = false
     end
 
     def merge(other)
       super
 
       @device_map = other.device_map if !other.device_map.empty?
+      @trusted_boot = other.trusted_boot unless other.trusted_boot.nil?
 
-      # merge here is a bit tricky, as for stage1 does not exist `defined?`
-      # because grub_installdevice contain value or not, so it is not
-      # possible to recognize if chosen or just not set
-      # so logic is following
-      # 1) if any flag is set to true, then use it because e.g. autoyast 
defined flags,
-      #    but devices usually not
-      # 2) if there is devices specified, then set also flags to value in other
-      #    as it mean, that there is enough info to decide
-      log.info "stage1 to merge #{other.stage1.inspect}"
-
-      # so first part of logic
-      stage1.activate = stage1.activate? || other.stage1.activate?
-      stage1.generic_mbr = stage1.generic_mbr? || other.stage1.generic_mbr?
-
-      # use second part described above if there is some device
-      replace_with(other) unless other.stage1.devices.empty?
-
-      log.info "stage1 after merge #{stage1.inspect}"
+      stage1.merge(other.stage1)
     end
 
     # Display bootloader summary
@@ -113,6 +104,10 @@
         Yast::Builtins.sformat(
           _("Boot Loader Type: %1"),
           "GRUB2"
+        ),
+        Yast::Builtins.sformat(
+          _("Enable Trusted Boot: %1"),
+          @trusted_boot ? _("yes") : _("no")
         )
       ]
       locations_val = locations
@@ -149,19 +144,22 @@
         res << "syslinux"
       end
 
+      if Yast::Arch.x86_64 || Yast::Arch.i386
+        res << "trustedgrub2" << "trustedgrub2-i386-pc" if @trusted_boot
+      end
+
       res
     end
 
-  private
-
-    def replace_with(other)
-      stage1.clear_devices
-      other.stage1.devices.each { |d| stage1.add_udev_device(d) }
-
-      stage1.activate = other.stage1.activate?
-      stage1.generic_mbr = other.stage1.generic_mbr?
+    # FIXME: refactor with injection like super(prewrite: prewrite, sysconfig 
= ...)
+    # overwrite BootloaderBase version to save trusted boot
+    def write_sysconfig(prewrite: false)
+      sysconfig = Bootloader::Sysconfig.new(bootloader: name, trusted_boot: 
@trusted_boot)
+      prewrite ? sysconfig.pre_write : sysconfig.write
     end
 
+  private
+
     def gpt_disks_devices
       boot_devices = stage1.devices
       boot_discs = boot_devices.map { |d| 
Yast::Storage.GetDisk(Yast::Storage.GetTargetMap, d) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2_widgets.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2_widgets.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2_widgets.rb    
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2_widgets.rb    
2016-05-17 10:29:14.000000000 +0200
@@ -282,6 +282,32 @@
     end
   end
 
+  # Represents switcher for Trusted Boot
+  class TrustedBootWidget < CWM::CheckBox
+    include Grub2Widget
+
+    def initialize
+      textdomain "bootloader"
+    end
+
+    def label
+      _("Enable &Trusted Boot Support")
+    end
+
+    def help
+      # TRANSLATORS: TrustedGRUB2 is a name, don't translate it
+      _("<b>Trusted Boot</b> will install TrustedGRUB2 instead of regular 
GRUB2.\n")
+    end
+
+    def init
+      self.value = grub2.trusted_boot
+    end
+
+    def store
+      grub2.trusted_boot = value
+    end
+  end
+
   # Represents grub password protection widget
   class GrubPasswordWidget < CWM::CustomWidget
     include Grub2Widget
@@ -749,19 +775,22 @@
     def contents
       widgets = []
 
-      widgets << indented_widget(LoaderLocationWidget.new) if 
loader_location_widget?
+      widgets << LoaderLocationWidget.new if loader_location_widget?
 
       if generic_mbr_widget?
-        widgets << indented_widget(ActivateWidget.new)
-        widgets << indented_widget(GenericMBRWidget.new)
+        widgets << ActivateWidget.new
+        widgets << GenericMBRWidget.new
       end
 
-      widgets << indented_widget(SecureBootWidget.new) if secure_boot_widget?
+      widgets << SecureBootWidget.new if secure_boot_widget?
+
+      widgets << TrustedBootWidget.new if trusted_boot_widget?
 
-      widgets << indented_widget(PMBRWidget.new) if pmbr_widget?
+      widgets << PMBRWidget.new if pmbr_widget?
 
-      widgets << indented_widget(DeviceMapWidget.new) if device_map_button?
+      widgets << DeviceMapWidget.new if device_map_button?
 
+      widgets = widgets.map { |w| indented_widget(w) }
       VBox(
         LoaderTypeWidget.new,
         *widgets,
@@ -787,6 +816,10 @@
       (Yast::Arch.x86_64 || Yast::Arch.i386) && grub2.name == "grub2-efi"
     end
 
+    def trusted_boot_widget?
+      (Yast::Arch.x86_64 || Yast::Arch.i386) && grub2.name == "grub2"
+    end
+
     def pmbr_widget?
       (Yast::Arch.x86_64 || Yast::Arch.i386) &&
         (Yast::BootStorage.gpt_boot_disk? || grub2.name == "grub2-efi")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2base.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2base.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2base.rb        
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2base.rb        
2016-05-17 10:29:14.000000000 +0200
@@ -70,8 +70,10 @@
       end
     end
 
-    def read(reread: false)
-      grub_default.load if !grub_default.loaded? || reread
+    def read
+      super
+
+      grub_default.load
       grub_cfg = CFA::Grub2::GrubCfg.new
       begin
         grub_cfg.load
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2efi.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2efi.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/grub2efi.rb 2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/grub2efi.rb 2016-05-17 
10:29:14.000000000 +0200
@@ -21,12 +21,9 @@
       @grub_install = GrubInstall.new(efi: true)
     end
 
-    # Read settings from disk
-    # @param [Boolean] reread boolean true to force reread settings from system
-    # internal data
-    # @return [Boolean] true on success
-    def read(reread: false)
-      @secure_boot = Sysconfig.from_system.secure_boot if reread || 
@secure_boot.nil?
+    # Read settings from disk overwritting already set values
+    def read
+      @secure_boot = Sysconfig.from_system.secure_boot
 
       super
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/grub_install.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/grub_install.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/grub_install.rb     
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/grub_install.rb     
2016-05-17 10:29:14.000000000 +0200
@@ -10,8 +10,9 @@
       @efi = efi
     end
 
-    def execute(devices: nil, secure_boot: false)
+    def execute(devices: [], secure_boot: false, trusted_boot: false)
       raise "cannot have secure boot without efi" if secure_boot && !@efi
+      raise "cannot have trusted boot with efi" if trusted_boot && @efi
 
       cmd = []
       if secure_boot
@@ -21,8 +22,21 @@
         # Do skip-fs-probe to avoid error when embedding stage1
         # to extended partition
         cmd << "--force" << "--skip-fs-probe"
+        cmd << "--directory=/usr/lib/trustedgrub2/#{target}" if trusted_boot
       end
 
+      cmd << "--no-nvram" << "--removable" if removable_efi?
+
+      if no_device_install?
+        Yast::Execute.on_target(cmd)
+      else
+        devices.each { |d| Yast::Execute.on_target(cmd + [d]) }
+      end
+    end
+
+  private
+
+    def removable_efi?
       # EFI has 2 boot paths. The default is that there is a target file listed
       # in the boot list. The boot list is stored in NVRAM and exposed as
       # efivars.
@@ -41,20 +55,12 @@
       # working NVRAM, we either see no efivars at all (booted via non-EFI 
entry
       # point) or there is no efi variable exposed. Install grub in the
       # removable location there.
-      if Dir.glob("/sys/firmware/efi/efivars/*").empty?
-        cmd << "--no-nvram" << "--removable"
-      end
-
-      if devices
-        devices.each do |dev|
-          Yast::Execute.on_target(cmd + [dev])
-        end
-      else
-        Yast::Execute.on_target(cmd)
-      end
+      @efi && Dir.glob("/sys/firmware/efi/efivars/*").empty?
     end
 
-  private
+    def no_device_install?
+      Yast::Arch.s390 || @efi
+    end
 
     def target
       @target ||= case Yast::Arch.architecture
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/sections.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/sections.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/sections.rb 2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/sections.rb 2016-05-17 
10:29:14.000000000 +0200
@@ -27,7 +27,7 @@
       saved = Yast::Execute.on_target("/usr/bin/grub2-editenv", "list", 
stdout: :capture) || ""
       saved_line = saved.lines.grep(/saved_entry=/).first
 
-      @default = saved_line ? saved_line[/saved_entry=(\S*)/, 1] : all.first
+      @default = saved_line ? saved_line[/saved_entry=(.*)$/, 1] : all.first
     end
 
     # Sets default section internally
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/stage1.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/stage1.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/stage1.rb   2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/stage1.rb   2016-05-17 
10:29:14.000000000 +0200
@@ -159,6 +159,31 @@
       true
     end
 
+    def merge(other)
+      # merge here is a bit tricky, as for stage1 does not exist `defined?`
+      # because grub_installdevice contain value or not, so it is not
+      # possible to recognize if chosen or just not set
+      # so logic is following
+      # 1) if any flag is set to true, then use it because e.g. autoyast 
defined flags,
+      #    but devices usually not
+      # 2) if there is devices specified, then set also flags to value in other
+      #    as it mean, that there is enough info to decide
+      log.info "stage1 to merge #{other.inspect}"
+
+      if other.devices.empty?
+        self.activate    = activate? || other.activate?
+        self.generic_mbr = generic_mbr? || other.generic_mbr?
+      else
+        clear_devices
+        other.devices.each { |d| add_udev_device(d) }
+
+        self.activate    = other.activate?
+        self.generic_mbr = other.generic_mbr?
+      end
+
+      log.info "stage1 after merge #{inspect}"
+    end
+
   private
 
     def available_partitions(res)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/src/lib/bootloader/sysconfig.rb 
new/yast2-bootloader-3.1.187/src/lib/bootloader/sysconfig.rb
--- old/yast2-bootloader-3.1.183/src/lib/bootloader/sysconfig.rb        
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/lib/bootloader/sysconfig.rb        
2016-05-17 10:29:14.000000000 +0200
@@ -6,27 +6,32 @@
     include Yast::Logger
     AGENT_PATH = Yast::Path.new(".sysconfig.bootloader")
     ATTR_VALUE_MAPPING = {
-      bootloader:  "LOADER_TYPE",
-      secure_boot: "SECURE_BOOT"
+      bootloader:   "LOADER_TYPE",
+      secure_boot:  "SECURE_BOOT",
+      trusted_boot: "TRUSTED_BOOT"
     }
 
     # specifies bootloader in sysconfig
     attr_accessor :bootloader
-    # boolean attribute if secure boot should be used
+    # @return [Boolean] if secure boot should be used
     attr_accessor :secure_boot
+    # @return [Boolean] if trusted boot should be used
+    attr_accessor :trusted_boot
 
-    def initialize(bootloader: nil, secure_boot: false)
+    def initialize(bootloader: nil, secure_boot: false, trusted_boot: false)
       @sys_agent = AGENT_PATH
       @bootloader = bootloader
       @secure_boot = secure_boot
+      @trusted_boot = trusted_boot
     end
 
     def self.from_system
       bootloader = Yast::SCR.Read(AGENT_PATH + "LOADER_TYPE")
       # propose secure boot always to true (bnc#872054), otherwise respect 
user choice
       secure_boot = Yast::SCR.Read(AGENT_PATH + "SECURE_BOOT") != "no"
+      trusted_boot = Yast::SCR.Read(AGENT_PATH + "TRUSTED_BOOT") == "yes"
 
-      new(bootloader: bootloader, secure_boot: secure_boot)
+      new(bootloader: bootloader, secure_boot: secure_boot, trusted_boot: 
trusted_boot)
     end
 
     # Specialized write before rpm install, that do not have switched SCR
@@ -39,7 +44,7 @@
     end
 
     PROPOSED_COMMENTS = {
-      bootloader:  "\n" \
+      bootloader:   "\n" \
         "## Path:\tSystem/Bootloader\n" \
         "## Description:\tBootloader configuration\n" \
         "## Type:\tlist(grub,grub2,grub2-efi,none)\n" \
@@ -51,7 +56,7 @@
         "#\n" \
         "#\n",
 
-      secure_boot: "\n" \
+      secure_boot:  "\n" \
         "## Path:\tSystem/Bootloader\n" \
         "## Description:\tBootloader configuration\n" \
         "## Type:\tyesno\n" \
@@ -61,6 +66,16 @@
         "# This setting is only relevant to UEFI which supports UEFI. It 
won't\n" \
         "# take effect on any other firmware type.\n" \
         "#\n" \
+        "#\n",
+
+      trusted_boot: "\n" \
+        "## Path:\tSystem/Bootloader\n" \
+        "## Description:\tBootloader configuration\n" \
+        "## Type:\tyesno\n" \
+        "## Default:\t\"no\"\n" \
+        "#\n" \
+        "# Enable Trusted Boot support\n" \
+        "# Only available for legacy (non-UEFI) boot.\n" \
         "#\n"
     }
 
@@ -72,6 +87,9 @@
       sb = secure_boot ? "yes" : "no"
       write_option(:secure_boot, sb)
 
+      tb = trusted_boot ? "yes" : "no"
+      write_option(:trusted_boot, tb)
+
       # flush write
       Yast::SCR.Write(sys_agent, nil)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/src/modules/Bootloader.rb 
new/yast2-bootloader-3.1.187/src/modules/Bootloader.rb
--- old/yast2-bootloader-3.1.183/src/modules/Bootloader.rb      2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/src/modules/Bootloader.rb      2016-05-17 
10:29:14.000000000 +0200
@@ -98,7 +98,7 @@
 
       proposed_configuration = ::Bootloader::BootloaderFactory
         .bootloader_by_name(imported_configuration.name)
-      unless Mode.config  # no AutoYaST configuration mode
+      unless Mode.config # no AutoYaST configuration mode
         proposed_configuration.propose
         proposed_configuration.merge(imported_configuration)
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/test/autoyast_converter_test.rb 
new/yast2-bootloader-3.1.187/test/autoyast_converter_test.rb
--- old/yast2-bootloader-3.1.183/test/autoyast_converter_test.rb        
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/autoyast_converter_test.rb        
2016-05-17 10:29:14.000000000 +0200
@@ -43,13 +43,14 @@
 
     it "import configuration to returned bootloader" do
       data = {
-        "append"      => "verbose nomodeset",
-        "terminal"    => "gfxterm",
-        "os_prober"   => "true",
-        "hiddenmenu"  => "true",
-        "timeout"     => 10,
-        "activate"    => "true",
-        "generic_mbr" => "false"
+        "append"       => "verbose nomodeset",
+        "terminal"     => "gfxterm",
+        "os_prober"    => "true",
+        "hiddenmenu"   => "true",
+        "timeout"      => 10,
+        "activate"     => "true",
+        "generic_mbr"  => "false",
+        "trusted_grub" => "true"
       }
 
       bootloader = subject.import("global" => data)
@@ -59,6 +60,7 @@
       expect(bootloader.grub_default.os_prober).to be_enabled
       expect(bootloader.grub_default.hidden_timeout).to eq "10"
       expect(bootloader.stage1).to be_activate
+      expect(bootloader.trusted_boot).to eq true
     end
 
     it "supports SLE9 format" do
@@ -86,6 +88,7 @@
       bootloader.grub_default.os_prober.enable
       bootloader.grub_default.hidden_timeout = "10"
       bootloader.stage1.activate = true
+      bootloader.trusted_boot = true
 
       expected_export = {
         "append"        => "verbose nomodeset",
@@ -98,7 +101,8 @@
         "boot_extended" => "false",
         "boot_root"     => "false",
         "activate"      => "true",
-        "generic_mbr"   => "false"
+        "generic_mbr"   => "false",
+        "trusted_grub"  => "true"
       }
 
       expect(subject.export(bootloader)["global"]).to eq expected_export
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/boot_storage_test.rb 
new/yast2-bootloader-3.1.187/test/boot_storage_test.rb
--- old/yast2-bootloader-3.1.183/test/boot_storage_test.rb      2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/boot_storage_test.rb      2016-05-17 
10:29:14.000000000 +0200
@@ -108,6 +108,8 @@
         "/boot" => ["/dev/vda2"]
       )
       allow(Yast::Storage).to receive(:GetContVolInfo).and_return(false)
+      # disable general mock for disk detection
+      allow(subject).to receive(:detect_disks).and_call_original
     end
 
     it "fills RootPartitionDevice variable" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/test/bootloader_base_test.rb 
new/yast2-bootloader-3.1.187/test/bootloader_base_test.rb
--- old/yast2-bootloader-3.1.183/test/bootloader_base_test.rb   2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/bootloader_base_test.rb   2016-05-17 
10:29:14.000000000 +0200
@@ -30,10 +30,6 @@
   end
 
   describe "#read" do
-    before do
-      allow(Yast::BootStorage).to receive(:detect_disks)
-    end
-
     it "detects disks in system" do
       expect(Yast::BootStorage).to receive(:detect_disks)
 
@@ -50,10 +46,6 @@
   end
 
   describe "#propose" do
-    before do
-      allow(Yast::BootStorage).to receive(:detect_disks)
-    end
-
     it "detects disk configuration" do
       expect(Yast::BootStorage).to receive(:detect_disks)
 
@@ -125,7 +117,6 @@
       other = described_class.new
       other.define_singleton_method(:name) { "funny_bootloader" }
 
-      allow(Yast::BootStorage).to receive(:detect_disks)
       other.read
 
       subject.merge(other)
@@ -137,8 +128,6 @@
       other = described_class.new
       other.define_singleton_method(:name) { "funny_bootloader" }
 
-      allow(Yast::BootStorage).to receive(:detect_disks)
-
       other.propose
 
       subject.merge(other)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-3.1.183/test/bootloader_proposal_client_test.rb 
new/yast2-bootloader-3.1.187/test/bootloader_proposal_client_test.rb
--- old/yast2-bootloader-3.1.183/test/bootloader_proposal_client_test.rb        
2016-05-12 17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/bootloader_proposal_client_test.rb        
2016-05-17 10:29:14.000000000 +0200
@@ -9,7 +9,6 @@
   before do
     # needed for udev conversion
     mock_disk_partition
-    allow(Yast::BootStorage).to receive(:detect_disks)
     allow(Yast::BootStorage).to receive(:mbr_disk).and_return("/dev/sda")
     allow(Yast::BootStorage).to 
receive(:BootPartitionDevice).and_return("/dev/sda1")
     allow(Yast::Storage).to receive(:GetTargetMap).and_return({})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/bootloader_test.rb 
new/yast2-bootloader-3.1.187/test/bootloader_test.rb
--- old/yast2-bootloader-3.1.183/test/bootloader_test.rb        2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/bootloader_test.rb        2016-05-17 
10:29:14.000000000 +0200
@@ -19,7 +19,6 @@
     # clean cache
     
::Bootloader::BootloaderFactory.instance_variable_set(:@cached_bootloaders, {})
     ::Bootloader::BootloaderFactory.current_name = "grub2"
-    allow(Yast::BootStorage).to receive(:detect_disks)
     allow(::Bootloader::BootloaderFactory.current).to receive(:read)
   end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/grub2_efi_test.rb 
new/yast2-bootloader-3.1.187/test/grub2_efi_test.rb
--- old/yast2-bootloader-3.1.183/test/grub2_efi_test.rb 2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/grub2_efi_test.rb 2016-05-17 
10:29:14.000000000 +0200
@@ -59,10 +59,6 @@
   end
 
   context "#propose" do
-    before do
-      allow(Yast::BootStorage).to receive(:detect_disks)
-    end
-
     it "proposes to remove pmbr flag for disk" do
       subject.propose
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/grub2_test.rb 
new/yast2-bootloader-3.1.187/test/grub2_test.rb
--- old/yast2-bootloader-3.1.183/test/grub2_test.rb     2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/grub2_test.rb     2016-05-17 
10:29:14.000000000 +0200
@@ -75,7 +75,8 @@
       allow(Bootloader::Stage1).to receive(:new).and_return(stage1)
 
       grub2_install = double(Bootloader::GrubInstall)
-      expect(grub2_install).to receive(:execute).with(devices: ["/dev/sda", 
"/dev/sdb1"])
+      expect(grub2_install).to receive(:execute)
+        .with(devices: ["/dev/sda", "/dev/sdb1"], trusted_boot: false)
       expect(Bootloader::GrubInstall).to receive(:new).with(efi: 
false).and_return(grub2_install)
 
       subject.write
@@ -113,8 +114,6 @@
       stage1 = double.as_null_object
       allow(Bootloader::Stage1).to receive(:new).and_return(stage1)
       allow(Bootloader::DeviceMap).to 
receive(:new).and_return(double.as_null_object)
-
-      allow(Yast::BootStorage).to receive(:detect_disks)
     end
 
     it "proposes stage1" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/grub2base_test.rb 
new/yast2-bootloader-3.1.187/test/grub2base_test.rb
--- old/yast2-bootloader-3.1.183/test/grub2base_test.rb 2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/grub2base_test.rb 2016-05-17 
10:29:14.000000000 +0200
@@ -61,7 +61,6 @@
   describe "#propose" do
     before do
       allow(Yast::BootStorage).to 
receive(:available_swap_partitions).and_return({})
-      allow(Yast::BootStorage).to receive(:detect_disks)
     end
 
     describe "os_prober proposal" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/grub_install_test.rb 
new/yast2-bootloader-3.1.187/test/grub_install_test.rb
--- old/yast2-bootloader-3.1.183/test/grub_install_test.rb      2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/grub_install_test.rb      2016-05-17 
10:29:14.000000000 +0200
@@ -77,7 +77,7 @@
         stub_efivars
         expect_grub2_install("arm64-efi")
 
-        subject.execute
+        subject.execute(devices: [])
       end
 
       it "raise exception for other architectures" do
@@ -96,6 +96,11 @@
     end
 
     context "initialized with efi:false" do
+      before do
+        # no efi vars without efi
+        stub_efivars(removable: true)
+      end
+
       subject { Bootloader::GrubInstall.new(efi: false) }
 
       it "raise exception if secure_boot: true passed" do
@@ -140,9 +145,9 @@
         stub_arch("s390_64")
         stub_efivars
 
-        expect_grub2_install("s390x-emu", device: "/dev/dasda1")
+        expect_grub2_install("s390x-emu")
 
-        subject.execute(devices: ["/dev/dasda1"])
+        subject.execute(devices: [])
       end
 
       it "raise exception on aarch64" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/mbr_update_test.rb 
new/yast2-bootloader-3.1.187/test/mbr_update_test.rb
--- old/yast2-bootloader-3.1.183/test/mbr_update_test.rb        2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/mbr_update_test.rb        2016-05-17 
10:29:14.000000000 +0200
@@ -74,6 +74,11 @@
     end
 
     context "activate and generic mbr is disabled" do
+      before do
+        allow(::Bootloader::BootRecordBackup)
+          .to receive(:new).and_return(double(:write => true))
+      end
+
       it "do not write generic mbr anywhere" do
         expect(Yast::Execute).to_not receive(:locally)
         expect(Yast::Execute).to_not receive(:on_target)
@@ -91,6 +96,8 @@
       before do
         allow(Yast::Stage).to receive(:initial).and_return(false)
         allow(Yast::PackageSystem).to receive(:Install)
+        allow(::Bootloader::BootRecordBackup)
+          .to receive(:new).and_return(double(:write => true))
       end
 
       it "do nothing if mbr_disk is in Bootloader devices, so we install there 
bootloader stage1" do
@@ -142,6 +149,8 @@
         allow(Yast::Stage).to receive(:initial).and_return(false)
         allow(Yast::PackageSystem).to receive(:Install)
         allow(Yast::Execute).to receive(:locally).and_return("")
+        allow(::Bootloader::BootRecordBackup)
+          .to receive(:new).and_return(double(:write => true))
       end
 
       context "disk label is DOS mbr" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-3.1.183/test/test_helper.rb 
new/yast2-bootloader-3.1.187/test/test_helper.rb
--- old/yast2-bootloader-3.1.183/test/test_helper.rb    2016-05-12 
17:22:00.000000000 +0200
+++ new/yast2-bootloader-3.1.187/test/test_helper.rb    2016-05-17 
10:29:14.000000000 +0200
@@ -79,5 +79,6 @@
     allow(::Yast::Storage).to receive(:GetTargetMap).and_return({}) # empty 
target map by default
     allow(::Yast::BootStorage).to receive(:underlaying_devices) { |d| [d] }
     allow(::Yast::Bootloader).to receive(:checkUsedStorage).and_return(true)
+    allow(Yast::BootStorage).to receive(:detect_disks) # do not do real disk 
detection
   end
 end


Reply via email to