Hello community,
here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at 2014-03-01 14:38:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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 2014-02-16 09:10:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes 2014-03-01 14:38:22.000000000 +0100
@@ -1,0 +2,8 @@
+Thu Feb 27 08:32:24 UTC 2014 - jreidinger@suse.com
+
+- Add support for password in GRUB2 (FATE#315404)
+- restructure details dialog in GRUB2 to have better UX
+- fix crash of GRUB2 module
+- 3.1.6
+
+-------------------------------------------------------------------
Old:
----
yast2-bootloader-3.1.5.tar.bz2
New:
----
yast2-bootloader-3.1.6.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.THekCg/_old 2014-03-01 14:38:23.000000000 +0100
+++ /var/tmp/diff_new_pack.THekCg/_new 2014-03-01 14:38:23.000000000 +0100
@@ -17,13 +17,15 @@
Name: yast2-bootloader
-Version: 3.1.5
+Version: 3.1.6
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2
+BuildRequires: rubygem-rspec
BuildRequires: update-desktop-files
+BuildRequires: yast2 >= 3.1.0
BuildRequires: yast2-devtools >= 3.1.10
PreReq: /bin/sed %fillup_prereq
# Installation::*version variables
@@ -31,7 +33,7 @@
Requires: parted
Requires: perl-Bootloader-YAML
Requires: perl-Compress-Zlib
-Requires: yast2 >= 2.21.22
+Requires: yast2 >= 3.1.0
Requires: yast2-core >= 2.18.7
Requires: yast2-packager >= 2.17.24
Requires: yast2-pkg-bindings >= 2.17.25
@@ -90,6 +92,9 @@
%build
%yast_build
+%check
+make check VERBOSE=1
+
%install
%yast_install
@@ -125,6 +130,7 @@
%dir %{yast_schemadir}/autoyast
%dir %{yast_schemadir}/autoyast/rnc
%{yast_schemadir}/autoyast/rnc/bootloader.rnc
+%{yast_libdir}/bootloader
%dir %{yast_docdir}
%doc %{yast_docdir}/COPYING
++++++ yast2-bootloader-3.1.5.tar.bz2 -> yast2-bootloader-3.1.6.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/SUBDIRS new/yast2-bootloader-3.1.6/SUBDIRS
--- old/yast2-bootloader-3.1.5/SUBDIRS 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/SUBDIRS 2014-02-27 16:13:28.000000000 +0100
@@ -1 +1 @@
-SUBDIRS = src scripts doc
+SUBDIRS = src scripts doc test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/package/yast2-bootloader.changes new/yast2-bootloader-3.1.6/package/yast2-bootloader.changes
--- old/yast2-bootloader-3.1.5/package/yast2-bootloader.changes 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/package/yast2-bootloader.changes 2014-02-27 16:13:28.000000000 +0100
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Feb 27 08:32:24 UTC 2014 - jreidinger@suse.com
+
+- Add support for password in GRUB2 (FATE#315404)
+- restructure details dialog in GRUB2 to have better UX
+- fix crash of GRUB2 module
+- 3.1.6
+
+-------------------------------------------------------------------
Wed Feb 12 10:18:39 UTC 2014 - jreidinger@suse.com
- rephrase bootloader proposal on summary screen (BNC#853058)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/package/yast2-bootloader.spec new/yast2-bootloader-3.1.6/package/yast2-bootloader.spec
--- old/yast2-bootloader-3.1.5/package/yast2-bootloader.spec 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/package/yast2-bootloader.spec 2014-02-27 16:13:28.000000000 +0100
@@ -17,7 +17,7 @@
Name: yast2-bootloader
-Version: 3.1.5
+Version: 3.1.6
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -26,11 +26,13 @@
Group: System/YaST
License: GPL-2.0+
BuildRequires: yast2-devtools >= 3.1.10
+BuildRequires: yast2 >= 3.1.0
BuildRequires: update-desktop-files
+BuildRequires: rubygem-rspec
PreReq: /bin/sed %fillup_prereq
# Installation::*version variables
# Wizard::SetDialogTitleAndIcon
-Requires: yast2 >= 2.21.22
+Requires: yast2 >= 3.1.0
Requires: yast2-packager >= 2.17.24
Requires: yast2-pkg-bindings >= 2.17.25
Requires: perl-Bootloader-YAML
@@ -74,6 +76,9 @@
%build
%yast_build
+%check
+make check VERBOSE=1
+
%install
%yast_install
@@ -110,6 +115,7 @@
%dir %{yast_schemadir}/autoyast
%dir %{yast_schemadir}/autoyast/rnc
%{yast_schemadir}/autoyast/rnc/bootloader.rnc
+%{yast_libdir}/bootloader
%dir %{yast_docdir}
%doc %{yast_docdir}/COPYING
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/Makefile.am new/yast2-bootloader-3.1.6/src/Makefile.am
--- old/yast2-bootloader-3.1.5/src/Makefile.am 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/Makefile.am 2014-02-27 16:13:28.000000000 +0100
@@ -74,6 +74,11 @@
include/bootloader/ppc/dialogs.rb \
include/bootloader/ppc/helps.rb
+ylibdir = "${yast2dir}/lib/bootloader"
+ylib_DATA = \
+ lib/bootloader/grub2base.rb \
+ lib/bootloader/grub2pwd.rb
+
scrconf_DATA = \
scrconf/cfg_bootloader.scr \
scrconf/cfg_bootsplash.scr \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/include/bootloader/grub/options.rb new/yast2-bootloader-3.1.6/src/include/bootloader/grub/options.rb
--- old/yast2-bootloader-3.1.5/src/include/bootloader/grub/options.rb 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/include/bootloader/grub/options.rb 2014-02-27 16:13:28.000000000 +0100
@@ -247,6 +247,24 @@
false
end
+ def passwd_content
+ HBox(
+ CheckBoxFrame(
+ Id(:use_pas),
+ _("Prot&ect Boot Loader with Password"),
+ true,
+ HBox(
+ HSpacing(2),
+ # text entry
+ Password(Id(:pw1), Opt(:hstretch), _("&Password")),
+ # text entry
+ HSpacing(2),
+ Password(Id(:pw2), Opt(:hstretch), _("Re&type Password")),
+ HStretch()
+ )
+ )
+ )
+ end
# Build a map describing a widget
@@ -255,22 +273,7 @@
{
"widget" => :custom,
# frame
- "custom_widget" => HBox(
- CheckBoxFrame(
- Id(:use_pas),
- _("Prot&ect Boot Loader with Password"),
- true,
- HBox(
- HSpacing(2),
- # text entry
- Password(Id(:pw1), Opt(:hstretch), _("&Password")),
- # text entry
- HSpacing(2),
- Password(Id(:pw2), Opt(:hstretch), _("Re&type Password")),
- HStretch()
- )
- )
- ),
+ "custom_widget" => passwd_content,
"init" => fun_ref(
method(:InitPasswdWidget),
"void (string)"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/include/bootloader/grub2/dialogs.rb new/yast2-bootloader-3.1.6/src/include/bootloader/grub2/dialogs.rb
--- old/yast2-bootloader-3.1.5/src/include/bootloader/grub2/dialogs.rb 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/include/bootloader/grub2/dialogs.rb 2014-02-27 16:13:28.000000000 +0100
@@ -25,6 +25,7 @@
Yast.import "Label"
Yast.import "Wizard"
Yast.import "CWM"
+ Yast.import "CWMTab"
Yast.import "BootCommon"
Yast.import "Stage"
@@ -37,60 +38,84 @@
@_grub2_efi_widgets = nil
end
+ def boot_code_tab
+ lt = BootCommon.getLoaderType(false)
+
+ {
+ "id" => "boot_code_tab",
+ "header" => _("Boot Code Options"),
+ # if name is not included, that it is not displayed
+ "widget_names" => lt == "grub2-efi" ? ["distributor"] :
+ ["distributor", "activate", "generic_mbr"],
+ "contents" => VBox(
+ VSpacing(1),
+ MarginBox(1, 0.5, "distributor"),
+ MarginBox(1, 0.5, Left("activate")),
+ MarginBox(1, 0.5, Left("generic_mbr")),
+ VStretch()
+ )
+ }
+ end
+
+ def kernel_tab
+ {
+ "id" => "kernel_tab",
+ "header" => _("Kernel Parameters"),
+ "widget_names" => ["vgamode", "append", "append_failsafe", "console"],
+ "contents" => VBox(
+ VSpacing(1),
+ MarginBox(1, 0.5, "vgamode"),
+ MarginBox(1, 0.5, "append"),
+ MarginBox(1, 0.5, "append_failsafe"),
+ MarginBox(1, 0.5, "console"),
+ VStretch()
+ )
+ }
+ end
+
+ def bootloader_tab
+ {
+ "id" => "bootloader_tab",
+ "header" => _("Bootloader Options"),
+ "widget_names" => ["default", "timeout", "password", "os_prober", "hiddenmenu"],
+ "contents" => VBox(
+ VSpacing(2),
+ HBox(
+ HSpacing(1),
+ "timeout",
+ HSpacing(1),
+ Left(VBox( "os_prober", "hiddenmenu")),
+ HSpacing(1)
+ ),
+ MarginBox(1, 1, "default"),
+ MarginBox(1, 1, "password"),
+ VStretch()
+ )
+ }
+ end
+
# Run dialog for loader installation details for Grub2
# @return [Symbol] for wizard sequencer
def Grub2LoaderDetailsDialog
Builtins.y2milestone("Running Grub2 loader details dialog")
- contents = HBox(
- HSpacing(2),
- VBox(
- VStretch(),
- HBox(HSquash("distributor"), "hiddenmenu", "os_prober", HStretch()),
- HBox("activate", "generic_mbr", HStretch()),
- HBox(HSquash("timeout"), "vgamode", HStretch()),
- Left("append"),
- Left("append_failsafe"),
- Left("default"),
- Left("console"),
- Left("gfxterm"),
- VStretch()
- ),
- HSpacing(2)
- )
+ widgets = Grub2Options()
- lt = BootCommon.getLoaderType(false)
- widget_names = lt == "grub2-efi" ?
- [
- "distributor",
- "hiddenmenu",
- "os_prober",
- "timeout",
- "append",
- "append_failsafe",
- "console",
- "default",
- "vgamode"
- ] :
- [
- "distributor",
- "activate",
- "generic_mbr",
- "hiddenmenu",
- "os_prober",
- "timeout",
- "append",
- "append_failsafe",
- "console",
- "default",
- "vgamode"
- ]
+ tabs = [ bootloader_tab, kernel_tab, boot_code_tab]
+
+ tab_widget = CWMTab.CreateWidget({
+ "tab_order" => tabs.map{ |t| t["id"] },
+ "tabs" => Hash[tabs.map{|tab| [tab["id"], tab]}],
+ "initial_tab" => tabs.first["id"],
+ "widget_descr" => widgets
+ })
+ widgets["tab"] = tab_widget
caption = _("Boot Loader Options")
CWM.ShowAndRun(
{
- "widget_descr" => Grub2Options(),
- "widget_names" => widget_names,
- "contents" => contents,
+ "widget_descr" => widgets,
+ "widget_names" => ["tab"],
+ "contents" => VBox("tab"),
"caption" => caption,
"back_button" => Label.BackButton,
"abort_button" => Label.CancelButton,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/include/bootloader/grub2/options.rb new/yast2-bootloader-3.1.6/src/include/bootloader/grub2/options.rb
--- old/yast2-bootloader-3.1.5/src/include/bootloader/grub2/options.rb 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/include/bootloader/grub2/options.rb 2014-02-27 16:13:28.000000000 +0100
@@ -18,6 +18,9 @@
#
# $Id: BootGRUB.ycp 63508 2011-03-04 12:53:27Z jreidinger $
#
+
+require "bootloader/grub2pwd"
+
module Yast
module BootloaderGrub2OptionsInclude
def initialize_bootloader_grub2_options(include_target)
@@ -225,6 +228,95 @@
nil
end
+ def ConsoleContent
+ VBox(
+ CheckBoxFrame(
+ Id(:gfxterm_frame),
+ _("Use &graphical console"),
+ true,
+ HBox(
+ HSpacing(2),
+ ComboBox(
+ Id(:gfxmode),
+ Opt(:editable, :hstretch),
+ _("&Console resolution"),
+ [""]
+ ),
+ HBox(
+ Left(
+ InputField(
+ Id(:gfxtheme),
+ Opt(:hstretch),
+ _("&Console theme")
+ )
+ ),
+ VBox(
+ Left(Label("")),
+ Left(
+ PushButton(
+ Id(:browsegfx),
+ Opt(:notify),
+ Label.BrowseButton
+ )
+ )
+ )
+ ),
+ HStretch()
+ )
+ ),
+ CheckBoxFrame(
+ Id(:console_frame),
+ _("Use &serial console"),
+ true,
+ HBox(
+ HSpacing(2),
+ InputField(
+ Id(:console_args),
+ Opt(:hstretch),
+ _("&Console arguments")
+ ),
+ HStretch()
+ )
+ )
+ )
+ end
+
+ MASKED_PASSWORD = "**********"
+
+ def grub2_pwd_store(key, event)
+ usepass = UI.QueryWidget(Id(:use_pas), :Value)
+ if !usepass
+ # we are in proper module that can store password
+ self.password = nil
+ return
+ end
+
+ value = UI.QueryWidget(Id(:pw1), :Value)
+ # special value as we do not know password, so it mean user do not change it
+ if value == MASKED_PASSWORD
+ self.password = ""
+ else
+ self.password = value
+ end
+ end
+
+ def grub2_pwd_init(widget)
+ passwd = GRUB2Pwd.new.used?
+ if passwd
+ UI.ChangeWidget(Id(:use_pas), :Value, true)
+ UI.ChangeWidget(Id(:pw1), :Enabled, true)
+ UI.ChangeWidget(Id(:pw1), :Value, MASKED_PASSWORD)
+ UI.ChangeWidget(Id(:pw2), :Enabled, true)
+ UI.ChangeWidget(Id(:pw2), :Value, MASKED_PASSWORD)
+ else
+ UI.ChangeWidget(Id(:use_pas), :Value, false)
+ UI.ChangeWidget(Id(:pw1), :Enabled, false)
+ UI.ChangeWidget(Id(:pw1), :Value, "")
+ UI.ChangeWidget(Id(:pw2), :Enabled, false)
+ UI.ChangeWidget(Id(:pw2), :Value, "")
+ end
+ end
+
def Grub2Options
grub2_specific = {
"distributor" => CommonInputFieldWidget(
@@ -273,56 +365,7 @@
},
"console" => {
"widget" => :custom,
- "custom_widget" => VBox(
- CheckBoxFrame(
- Id(:gfxterm_frame),
- _("Use &graphical console"),
- true,
- HBox(
- HSpacing(2),
- ComboBox(
- Id(:gfxmode),
- Opt(:editable, :hstretch),
- _("&Console resolution"),
- [""]
- ),
- HBox(
- Left(
- InputField(
- Id(:gfxtheme),
- Opt(:hstretch),
- _("&Console theme")
- )
- ),
- VBox(
- Left(Label("")),
- Left(
- PushButton(
- Id(:browsegfx),
- Opt(:notify),
- Label.BrowseButton
- )
- )
- )
- ),
- HStretch()
- )
- ),
- CheckBoxFrame(
- Id(:console_frame),
- _("Use &serial console"),
- true,
- HBox(
- HSpacing(2),
- InputField(
- Id(:console_args),
- Opt(:hstretch),
- _("&Console arguments")
- ),
- HStretch()
- )
- )
- ),
+ "custom_widget" => ConsoleContent(),
"init" => fun_ref(method(:ConsoleInit), "void (string)"),
"store" => fun_ref(
method(:ConsoleStore),
@@ -334,6 +377,28 @@
),
"handle_events" => [:browsegfx],
"help" => Ops.get(@grub_help_messages, "serial", "")
+ },
+ "password" => {
+ "widget" => :custom,
+ "custom_widget" => passwd_content,
+ "init" => fun_ref(
+ method(:grub2_pwd_init),
+ "void (string)"
+ ),
+ "handle" => fun_ref(
+ method(:HandlePasswdWidget),
+ "symbol (string, map)"
+ ),
+ "store" => fun_ref(
+ method(:grub2_pwd_store),
+ "void (string, map)"
+ ),
+ "validate_type" => :function,
+ "validate_function" => fun_ref(
+ method(:ValidatePasswdWidget),
+ "boolean (string, map)"
+ ),
+ "help" => @grub_help_messages["password"] || ""
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/lib/bootloader/grub2base.rb new/yast2-bootloader-3.1.6/src/lib/bootloader/grub2base.rb
--- old/yast2-bootloader-3.1.5/src/lib/bootloader/grub2base.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/lib/bootloader/grub2base.rb 2014-02-27 16:13:28.000000000 +0100
@@ -0,0 +1,150 @@
+# encoding: utf-8
+require "yast"
+require "bootloader/grub2pwd"
+
+module Yast
+ class GRUB2Base < Module
+ def main
+ Yast.import "UI"
+
+ textdomain "bootloader"
+
+ Yast.import "BootArch"
+ Yast.import "BootCommon"
+ Yast.import "BootStorage"
+ Yast.import "Kernel"
+ Yast.import "Mode"
+ Yast.import "Stage"
+ Yast.import "Storage"
+ Yast.import "StorageDevices"
+ Yast.import "Pkg"
+ Yast.import "HTML"
+ Yast.import "Initrd"
+ Yast.import "Product"
+
+ # includes
+ # for simplified widgets than other
+ Yast.include self, "bootloader/grub2/dialogs.rb"
+
+ # password can have three states
+ # 1. nil -> remove password
+ # 2. "" -> do not change it
+ # 3. "something" -> set password to this value
+ @password = ""
+ end
+
+ # general functions
+
+ # Propose global options of bootloader
+ def StandardGlobals
+ {
+ "timeout" => "8",
+ "default" => "0",
+ "vgamode" => "",
+ "gfxmode" => "auto",
+ "terminal" => "gfxterm",
+ "os_prober" => "true"
+ }
+ end
+
+ # Update read settings to new version of configuration files
+ def Update
+ Read(true, true)
+
+ #we don't handle sections, grub2 section create them for us
+ #BootCommon::UpdateSections ();
+ BootCommon.UpdateGlobals
+
+ nil
+ end
+
+ # Reset bootloader settings
+ # @param [Boolean] init boolean true to repropose also device map
+ def Reset(init)
+ return if Mode.autoinst
+ BootCommon.Reset(init)
+
+ nil
+ end
+
+ def Dialogs
+ Builtins.y2milestone("Called GRUB2 Dialogs")
+ {
+ "installation" => fun_ref(
+ method(:Grub2InstallDetailsDialog),
+ "symbol ()"
+ ),
+ "loader" => fun_ref(
+ method(:Grub2LoaderDetailsDialog),
+ "symbol ()"
+ )
+ }
+ end
+
+ def Propose
+ if BootCommon.was_proposed
+ # workaround autoyast config is Imported thus was_proposed always set
+ if Mode.autoinst
+ Builtins.y2milestone(
+ "autoinst mode we ignore meaningless was_proposed as it always set"
+ )
+ else
+ Builtins.y2milestone(
+ "calling Propose with was_proposed set is really bogus, clear it to force a re-propose"
+ )
+ return
+ end
+ end
+
+
+ BootCommon.globals ||= Hash.new
+ BootCommon.globals.merge! StandardGlobals()
+
+ swap_parts = BootCommon.getSwapPartitions
+ largest_swap_part = swap_parts.max_by{|part, size| size}.first || ""
+
+ resume = BootArch.ResumeAvailable ? largest_swap_part : ""
+ # try to use label or udev id for device name... FATE #302219
+ if resume != "" && resume != nil
+ resume = BootStorage.Dev2MountByDev(resume)
+ end
+
+ BootCommon.globals["append"] = BootArch.DefaultKernelParams(resume)
+ BootCommon.globals["append_failsafe"] = BootArch.FailsafeKernelParams
+ BootCommon.globals["distributor"] = Product.name
+ BootCommon.kernelCmdLine = Kernel.GetCmdLine
+
+ Builtins.y2milestone("Proposed globals: %1", BootCommon.globals)
+
+ nil
+ end
+
+ # overwrite Save to allow generation of modification scripts
+ def Save(clean, init, flush)
+ case @password
+ when nil
+ GRUB2Pwd.new.disable
+ when ""
+ #do nothing
+ else
+ GRUB2Pwd.new.enable @password
+ end
+
+ BootCommon.Save(clean, init, flush)
+ end
+
+ # Initializer of GRUB bootloader
+ def Initializer
+ Builtins.y2milestone("Called GRUB2 initializer")
+ BootCommon.current_bootloader_attribs = {
+ "propose" => false,
+ "read" => false,
+ "scratch" => false,
+ "restore_mbr" => false,
+ "bootloader_on_disk" => false
+ }
+
+ nil
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/lib/bootloader/grub2pwd.rb new/yast2-bootloader-3.1.6/src/lib/bootloader/grub2pwd.rb
--- old/yast2-bootloader-3.1.5/src/lib/bootloader/grub2pwd.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/lib/bootloader/grub2pwd.rb 2014-02-27 16:13:28.000000000 +0100
@@ -0,0 +1,59 @@
+require "yast"
+
+class GRUB2Pwd
+ YAST_BASH_PATH = Yast::Path.new(".target.bash_output")
+ PWD_ENCRYPTION_FILE = "/etc/grub.d/42_password"
+
+ def used?
+ Yast.import "FileUtils"
+
+ Yast::FileUtils.Exists PWD_ENCRYPTION_FILE
+ end
+
+ def enable(password)
+ enc_passwd = encrypt(password)
+
+ file_content = "#! /bin/sh\n" +
+ "exec tail -n +3 $0\n" +
+ "# File created by YaST and next password change in YaST will overwrite it\n" +
+ "set superusers=\"root\"\n" +
+ "password_pbkdf2 root #{enc_passwd}\n" +
+ "export superusers"
+
+ Yast::SCR.Write(
+ Yast::Path.new(".target.string"),
+ [PWD_ENCRYPTION_FILE, 0755],
+ file_content
+ )
+ end
+
+ def disable
+ return unless used?
+
+ Yast::SCR.Execute(YAST_BASH_PATH, "rm '#{PWD_ENCRYPTION_FILE}'")
+ end
+
+private
+
+ def encrypt(password)
+ result = Yast::SCR.Execute(YAST_BASH_PATH,
+ "echo -e \"#{password}\\n#{password}\" | grub2-mkpasswd-pbkdf2"
+ )
+
+ if result["exit"] != 0
+ raise "Failed to create encrypted password for grub2. Command output: #{result["stderr"]}"
+ end
+
+ pwd_line = result["stdout"].split("\n").grep(/password is/).first
+ if !pwd_line
+ raise "INTERNAL ERROR: output do not contain encrypted password. Output: #{result["stdout"]}"
+ end
+
+ ret = pwd_line[/^.*password is\s*(\S+)/,1]
+ if !ret
+ raise "INTERNAL ERROR: output do not contain encrypted password. Output: #{result["stdout"]}"
+ end
+
+ return ret
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/modules/BootCommon.rb new/yast2-bootloader-3.1.6/src/modules/BootCommon.rb
--- old/yast2-bootloader-3.1.5/src/modules/BootCommon.rb 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/modules/BootCommon.rb 2014-02-27 16:13:28.000000000 +0100
@@ -996,10 +996,6 @@
Builtins.y2milestone(
"It is XEN domU and the bootloader should be installed"
)
- # bnc #766283 - opensuse 12.2 pv guests can not start after installation
- # due to lack of grub2 support in the host
- # fallback to use grub until grub2 really works on it
- @loader_type = "grub" if @loader_type == "grub2"
end
if (Arch.i386 || Arch.x86_64) && Linuxrc.InstallInf("EFI") == "1"
# use grub2-efi as default bootloader for x86_64/i386 EFI
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.5/src/modules/BootGRUB2.rb new/yast2-bootloader-3.1.6/src/modules/BootGRUB2.rb
--- old/yast2-bootloader-3.1.5/src/modules/BootGRUB2.rb 2014-02-12 17:28:04.000000000 +0100
+++ new/yast2-bootloader-3.1.6/src/modules/BootGRUB2.rb 2014-02-27 16:13:28.000000000 +0100
@@ -19,49 +19,21 @@
# $Id: BootGRUB.ycp 63508 2011-03-04 12:53:27Z jreidinger $
#
require "yast"
+require "bootloader/grub2base"
module Yast
- class BootGRUB2Class < Module
+ class BootGRUB2Class < GRUB2Base
def main
- Yast.import "UI"
-
- textdomain "bootloader"
-
- Yast.import "BootArch"
- Yast.import "BootCommon"
- Yast.import "BootStorage"
- Yast.import "Kernel"
- Yast.import "Mode"
- Yast.import "Stage"
- Yast.import "Storage"
- Yast.import "StorageDevices"
- Yast.import "Pkg"
- Yast.import "HTML"
- Yast.import "Initrd"
- Yast.import "Product"
+ super
# includes
# for shared some routines with grub
Yast.include self, "bootloader/grub2/misc.rb"
- # for simplified widgets than other
- Yast.include self, "bootloader/grub2/dialogs.rb"
BootGRUB2()
end
# general functions
- # Propose global options of bootloader
- def StandardGlobals
- {
- "timeout" => "8",
- "default" => "0",
- "vgamode" => "",
- "gfxmode" => "auto",
- "terminal" => "gfxterm",
- "os_prober" => "true"
- }
- end
-
# Read settings from disk
# @param [Boolean] reread boolean true to force reread settings from system
# @param [Boolean] avoid_reading_device_map do not read new device map from file, use
@@ -109,16 +81,6 @@
ret
end
- # Update read settings to new version of configuration files
- def Update
- Read(true, true)
-
- #we don't handle sections, grub2 section create them for us
- #BootCommon::UpdateSections ();
- BootCommon.UpdateGlobals
-
- nil
- end
# Write bootloader settings to disk
# @return [Boolean] true on success
def Write
@@ -141,87 +103,9 @@
ret
end
- # Reset bootloader settings
- # @param [Boolean] init boolean true to repropose also device map
- def Reset(init)
- return if Mode.autoinst
- BootCommon.Reset(init)
-
- nil
- end
-
- # Propose bootloader settings
-
def Propose
- if BootCommon.was_proposed
- # workaround autoyast config is Imported thus was_proposed always set
- if Mode.autoinst
- Builtins.y2milestone(
- "autoinst mode we ignore meaningless was_proposed as it always set"
- )
- else
- Builtins.y2milestone(
- "calling Propose with was_proposed set is really bogus, clear it to force a re-propose"
- )
- return
- end
- end
-
- if BootCommon.globals == nil || Builtins.size(BootCommon.globals) == 0
- BootCommon.globals = StandardGlobals()
- else
- BootCommon.globals = Convert.convert(
- Builtins.union(BootCommon.globals, StandardGlobals()),
- :from => "map",
- :to => "map