Hello community,
here is the log from the commit of package yast2-bootloader for openSUSE:Factory checked in at 2014-10-14 07:09:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-10-05 20:27:28.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-bootloader.new/yast2-bootloader.changes 2014-10-14 07:09:14.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Oct 7 09:08:07 UTC 2014 - jreidinger@suse.com
+
+- keep user selection for password (bnc#900026)
+- fix build on ppc
+- 3.1.101
+
+-------------------------------------------------------------------
Old:
----
yast2-bootloader-3.1.100.tar.bz2
New:
----
yast2-bootloader-3.1.101.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.gyJnLa/_old 2014-10-14 07:09:15.000000000 +0200
+++ /var/tmp/diff_new_pack.gyJnLa/_new 2014-10-14 07:09:15.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-bootloader
-Version: 3.1.100
+Version: 3.1.101
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-bootloader-3.1.100.tar.bz2 -> yast2-bootloader-3.1.101.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/package/yast2-bootloader.changes new/yast2-bootloader-3.1.101/package/yast2-bootloader.changes
--- old/yast2-bootloader-3.1.100/package/yast2-bootloader.changes 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/package/yast2-bootloader.changes 2014-10-13 11:02:12.000000000 +0200
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Tue Oct 7 09:08:07 UTC 2014 - jreidinger@suse.com
+
+- keep user selection for password (bnc#900026)
+- fix build on ppc
+- 3.1.101
+
+-------------------------------------------------------------------
Tue Sep 30 09:30:52 UTC 2014 - jreidinger@suse.com
- use short product name to avoid truncated text on small
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/package/yast2-bootloader.spec new/yast2-bootloader-3.1.101/package/yast2-bootloader.spec
--- old/yast2-bootloader-3.1.100/package/yast2-bootloader.spec 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/package/yast2-bootloader.spec 2014-10-13 11:02:12.000000000 +0200
@@ -17,7 +17,7 @@
Name: yast2-bootloader
-Version: 3.1.100
+Version: 3.1.101
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/clients/bootloader_finish.rb new/yast2-bootloader-3.1.101/src/clients/bootloader_finish.rb
--- old/yast2-bootloader-3.1.100/src/clients/bootloader_finish.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/clients/bootloader_finish.rb 2014-10-13 11:02:12.000000000 +0200
@@ -150,10 +150,6 @@
# Install bootloader (always, see #23018)
# should also set Misc::boot_msg appropriate
- # FIXME: this is the plan B solution, try to solve plan A in
- # BootCommon.ycp:CreateLinuxSection() (line 435)
- # resolve symlinks in kernel and initrd paths
-
# In Mode::update(), the configuration is not yet read (for some
# unresearched reason). Therefore, for Mode::update(), there is another
# call of ResolveSymlinksInSections() after a Read() in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/include/bootloader/grub2/misc.rb new/yast2-bootloader-3.1.101/src/include/bootloader/grub2/misc.rb
--- old/yast2-bootloader-3.1.100/src/include/bootloader/grub2/misc.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/include/bootloader/grub2/misc.rb 2014-10-13 11:02:12.000000000 +0200
@@ -267,9 +267,10 @@
"Creating backup of boot sectors of %1",
disks_to_rewrite
)
- Builtins.foreach(disks_to_rewrite) do |device|
- ::Bootloader::BootRecordBackup.create_for(device)
+ backups = disks_to_rewrite.map do |d|
+ ::Bootloader::BootRecordBackup.new(d)
end
+ backups.each(&:write)
end
ret = true
# if the bootloader stage 1 is not installed in the MBR, but
@@ -895,7 +896,6 @@
!# ! haskey( BootCommon::globals, "boot_mbr_md" ) &&
Builtins.haskey(BootCommon.globals, "boot_custom")
grub_DetectDisks
- BootCommon.del_parts = BootStorage.getPartitionList(:deleted, "grub")
# check whether edd is loaded; if not: load it
lsmod_command = "lsmod | grep edd"
Builtins.y2milestone("Running command %1", lsmod_command)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/include/bootloader/grub2/options.rb new/yast2-bootloader-3.1.101/src/include/bootloader/grub2/options.rb
--- old/yast2-bootloader-3.1.100/src/include/bootloader/grub2/options.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/include/bootloader/grub2/options.rb 2014-10-13 11:02:12.000000000 +0200
@@ -327,20 +327,14 @@
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
+ # read state on disk only if not already set by user (bnc#900026)
+ password_used = password == "" ? GRUB2Pwd.new.used? : password
+ value = password_used ? MASKED_PASSWORD : ""
+ UI.ChangeWidget(Id(:use_pas), :Value, password_used)
+ UI.ChangeWidget(Id(:pw1), :Enabled, password_used)
+ UI.ChangeWidget(Id(:pw1), :Value, value)
+ UI.ChangeWidget(Id(:pw2), :Enabled, password_used)
+ UI.ChangeWidget(Id(:pw2), :Value, value)
end
def Grub2Options
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/include/bootloader/routines/global_widgets.rb new/yast2-bootloader-3.1.101/src/include/bootloader/routines/global_widgets.rb
--- old/yast2-bootloader-3.1.100/src/include/bootloader/routines/global_widgets.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/include/bootloader/routines/global_widgets.rb 2014-10-13 11:02:12.000000000 +0200
@@ -149,7 +149,6 @@
"Proceed?\n"
)
)
- Ops.set(BootCommon.other_bl, old_bl, Bootloader.Export)
BootCommon.setLoaderType("none")
BootCommon.location_changed = true
end
@@ -157,7 +156,6 @@
end
if ["grub2", "grub2-efi"].include? (new_bl)
- Ops.set(BootCommon.other_bl, old_bl, Bootloader.Export)
BootCommon.setLoaderType(new_bl)
Bootloader.Propose
BootCommon.location_changed = true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/include/bootloader/routines/misc.rb new/yast2-bootloader-3.1.101/src/include/bootloader/routines/misc.rb
--- old/yast2-bootloader-3.1.100/src/include/bootloader/routines/misc.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/include/bootloader/routines/misc.rb 2014-10-13 11:02:12.000000000 +0200
@@ -130,79 +130,26 @@
# @return [Array] device names
def GetBootloaderDevices
ret = []
- if Ops.get(@globals, "boot_boot", "false") == "true"
- ret = Builtins.add(ret, BootStorage.BootPartitionDevice)
+ if @globals["boot_boot"] == "true"
+ ret << BootStorage.BootPartitionDevice
end
- if Ops.get(@globals, "boot_root", "false") == "true"
- ret = Builtins.add(ret, BootStorage.RootPartitionDevice)
+ if @globals["boot_root"] == "true"
+ ret << BootStorage.RootPartitionDevice
end
- if Ops.get(@globals, "boot_mbr", "false") == "true"
- ret = Builtins.add(ret, @mbrDisk)
+ if @globals["boot_mbr"] == "true"
+ ret << @mbrDisk
end
- if Builtins.haskey(@globals, "boot_extended") &&
- Ops.get(@globals, "boot_extended", "false") == "true"
- ret = Builtins.add(ret, BootStorage.ExtendedPartitionDevice)
+ if @globals["boot_extended"] == "true"
+ ret << BootStorage.ExtendedPartitionDevice
end
- if Builtins.haskey(@globals, "boot_custom")
- ret = Builtins.add(ret, Ops.get(@globals, "boot_custom", ""))
+ if @globals["boot_custom"]
+ ret << @globals["boot_custom"]
end
- return deep_copy(ret) if Ops.greater_than(Builtins.size(ret), 0)
+ return ret unless ret.empty?
# FIXME: find out what the best value is here: nil, [] or ["/dev/null"]
["/dev/null"]
end
- # Check if the PBR of the given partition seems to contain a known boot block
- # @param [String] device string partition device to check
- # @return true if the PBR seems to contain a known boot block
- def IsPartitionBootable(device)
- #FIXME this is only for grub and should go to BootGRUB
- # use examineMBR to analyze PBR (partition boot record):
- # examineMBR returns "* stage1" when it finds the signature
- # of some stage1 bootloader
- result = examineMBR(device)
- if result == "grub"
- return true
- else
- return false
- end
- end
-
- # Get the list of particular kernel parameters
- # @param [String] line string the whole kernel command line
- # @return a list of the kernel parameters split each separaterlly
- def ListKernelParamsInLine(line)
- # FIXME this function is really similar to code in Kernel.ycp
- cmdlist = []
- parse_index = 0
- in_quotes = false
- after_backslash = false
- current_param = ""
- while Ops.less_than(parse_index, Builtins.size(line))
- current_char = Builtins.substring(line, parse_index, 1)
- in_quotes = !in_quotes if current_char == "\"" && !after_backslash
- if current_char == " " && !in_quotes
- cmdlist = Builtins.add(cmdlist, current_param)
- current_param = ""
- else
- current_param = Ops.add(current_param, current_char)
- end
- if current_char == "\\"
- after_backslash = true
- else
- after_backslash = false
- end
- parse_index = Ops.add(parse_index, 1)
- end
- cmdlist = Builtins.add(cmdlist, current_param)
- cmdlist = Builtins.maplist(cmdlist) do |c|
- if Builtins.regexpmatch(c, "^[^=]+=")
- c = Builtins.regexpsub(c, "^([^=]+)=", "\\1")
- end
- c
- end
- deep_copy(cmdlist)
- end
-
# get kernel parameter from kernel command line
# @param [String] line string original line
# @param [String] key string parameter key
@@ -211,13 +158,10 @@
def getKernelParamFromLine(line, key)
# FIXME this doesn't work with quotes and spaces
res = "false"
- params = Builtins.splitstring(line, " ")
- params = Builtins.filter(params) { |p| p != "" }
- Builtins.foreach(params) do |p|
- l = Builtins.filter(Builtins.splitstring(p, "=")) do |e|
- e != " " && e != ""
- end
- res = Ops.get(l, 1, "true") if Ops.get(l, 0, "") == key
+ params = line.split(" ").reject(&:empty?)
+ params.each do |p|
+ l = p.split("=")
+ res = l[1] || "true" if l[0] == key
end
res
end
@@ -408,66 +352,39 @@
# @param [String] device string device to rewrite MBR to
# @return [Boolean] true on success
def restoreMBR(device)
- device_file = Builtins.mergestring(Builtins.splitstring(device, "/"), "_")
- if Ops.less_or_equal(
- SCR.Read(
- path(".target.size"),
- Builtins.sformat(
- "/var/lib/YaST2/backup_boot_sectors/%1",
- device_file
- )
- ),
- 0
- )
+ backup = ::Bootloader::BootRecordBackup.new(device)
+ begin
+ backup.restore
+ rescue ::Bootloader::BootRecordBackup::Missing
Report.Error("Can't restore MBR. No saved MBR found")
return false
end
- # added fix 446 -> 440 for Vista booting problem bnc #396444
- ret = Convert.to_integer(
- SCR.Execute(
- path(".target.bash"),
- Builtins.sformat(
- "/bin/dd of=%1 if=/var/lib/YaST2/backup_boot_sectors/%2 bs=440 count=1",
- device,
- device_file
- )
- )
- )
- ret == 0
end
# Get map of swap partitions
# @return a map where key is partition name and value its size
def getSwapPartitions
- #FIXME use cache of storage map
+ # FIXME move to boot storage
tm = Storage.GetTargetMap
- installation = Mode.installation
ret = {}
- Builtins.foreach(tm) do |k, v|
- cyl_size = Ops.get_integer(v, "cyl_size", 0)
- partitions = Ops.get_list(v, "partitions", [])
- partitions = Builtins.filter(partitions) do |p|
- Ops.get_string(p, "mount", "") == "swap" &&
- !Ops.get_boolean(p, "delete", false)
+ tm.each do |k, v|
+ cyl_size = v["cyl_size"] || 0
+ partitions = v["partitions"] || []
+ partitions = partitions.select do |p|
+ p["mount"] == "swap" && !p["delete"]
end
- Builtins.foreach(partitions) do |s|
+ partitions.each do |s|
# bnc#577127 - Encrypted swap is not properly set up as resume device
- dev = ""
- if Ops.get_string(s, "crypt_device", "") != nil &&
- Ops.get_string(s, "crypt_device", "") != ""
- dev = Ops.get_string(s, "crypt_device", "")
+ if s["crypt_device"] && !s["crypt_device"].empty?
+ dev = s["crypt_device"]
else
- dev = Ops.get_string(s, "device", "")
+ dev = s["device"]
end
- Ops.set(
- ret,
- dev,
- Ops.multiply(Ops.get_integer(s, ["region", 1], 0), cyl_size)
- )
+ ret[dev] = Ops.get_integer(s, ["region", 1], 0) * cyl_size
end
end
Builtins.y2milestone("Available swap partitions: %1", ret)
- deep_copy(ret)
+ ret
end
@@ -559,32 +476,6 @@
elsif Builtins.search(getBootPartition, "/dev/evms/") == 0
Builtins.y2milestone("Cannot install bootloader on EVMS")
return false
- # LVM
- elsif !Ops.is_integer?(Ops.get(dev, "nr", 0))
- lt = getLoaderType(false)
- if lt != "grub2" && lt != "grub2-efi"
- Builtins.y2milestone("Cannot install bootloader %1 on LVM", lt)
- return false
- end
- else
- tm = Storage.GetTargetMap
- dm = Ops.get_map(tm, Ops.get_string(dev, "disk", ""), {})
- parts = Ops.get_list(dm, "partitions", [])
- info = {}
- Builtins.foreach(parts) do |p|
- if Ops.get_string(p, "device", "") ==
- BootStorage.BootPartitionDevice
- info = deep_copy(p)
- end
- end
-
- if Ops.get(info, "used_fs") == :btrfs
- lt = getLoaderType(false)
- if lt != "grub2" && lt != "grub2-efi"
- Builtins.y2milestone("Cannot install bootloader %1 on btrfs", lt)
- return false
- end
- end
end
return true
@@ -789,12 +680,6 @@
""
end
- # FATE #303548 - Grub: limit device.map to devices detected by BIOS Int 13
- # Function select boot device - disk
- #
- # @return [String] name of boot device - disk
-
-
# FATE #110038: Serial console
# Function build value for console from:
# @param [String] unit no of console
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/lib/bootloader/boot_record_backup.rb new/yast2-bootloader-3.1.101/src/lib/bootloader/boot_record_backup.rb
--- old/yast2-bootloader-3.1.100/src/lib/bootloader/boot_record_backup.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/lib/bootloader/boot_record_backup.rb 2014-10-13 11:02:12.000000000 +0200
@@ -3,92 +3,136 @@
Yast.import "BootCommon"
module Bootloader
- # Responsibility of class is to manage backups of MBR, respective PBR of disk,
+ # Responsibility of class is to manage backup of MBR, respective PBR of disk,
# respective partition.
class BootRecordBackup
- class << self
- include Yast::Logger
- BASH_PATH = Yast::Path.new(".target.bash")
- BASH_OUTPUT_PATH = Yast::Path.new(".target.bash_output")
- MAIN_BACKUP_DIR = "/var/lib/YaST2/backup_boot_sectors/"
- KEPT_BACKUPS = 10
-
- # Creates backup of MBR or PBR of given device.
- # Backup is stored in /var/lib/YaST2/backup_boot_sectors, in logs
- # directory and if it is MBR of primary disk, then also in /boot/backup_mbr
- def create_for(device)
- device_file = device.tr("/", "_")
- device_file_path = MAIN_BACKUP_DIR + device_file
-
- Yast::SCR.Execute(BASH_PATH, "mkdir -p #{MAIN_BACKUP_DIR}")
-
- # check if file exists
- if Yast::SCR.Read(Yast::Path.new(".target.size"), device_file_path) > 0
- # move it so we do not overwrite it
- change_date = formated_file_ctime(device_file_path)
+ include Yast::Logger
+ BASH_PATH = Yast::Path.new(".target.bash")
+ BASH_OUTPUT_PATH = Yast::Path.new(".target.bash_output")
+ TARGET_SIZE = Yast::Path.new(".target.size")
+ MAIN_BACKUP_DIR = "/var/lib/YaST2/backup_boot_sectors/"
+ KEPT_BACKUPS = 10
+
+ attr_reader :device
+
+ # Exception from this class
+ class Error < RuntimeError;end
+
+ # Exception used to indicate that backup missing, so any action with it is
+ # not possible
+ class Missing < Error
+ def initialize
+ super "Backup for boot record missing."
+ end
+ end
+
+
+
+ # Create backup handling class for given device
+ # @param device[String] expect kernel name of device like "/dev/sda"
+ def initialize(device)
+ @device = device
+ end
+
+ # Write fresh backup of MBR or PBR of given device.
+ # Backup is stored in /var/lib/YaST2/backup_boot_sectors, in logs
+ # directory and if it is MBR of primary disk, then also in /boot/backup_mbr
+ def write
+ Yast::SCR.Execute(BASH_PATH, "mkdir -p #{MAIN_BACKUP_DIR}")
+
+ if exists?
+ rotate
+ reduce_backup_count
+ end
+
+ copy_br(device, device_file_path)
+
+ # save MBR to yast2 log directory
+ logs_path = "/var/log/YaST2/" + device_file
+ copy_br(device, logs_path)
+
+ if device == Yast::BootCommon.mbrDisk
+ copy_br(device, "/boot/backup_mbr")
+
+ # save thinkpad MBR
+ if Yast::BootCommon.ThinkPadMBR(device)
+ device_file_path_thinkpad = device_file_path + "thinkpadMBR"
+ log.info("Backup thinkpad MBR")
Yast::SCR.Execute(
BASH_PATH,
- Yast::Builtins.sformat("/bin/mv %1 %1-%2", device_file_path, change_date)
+ "cp #{device_file_path} #{device_file_path_thinkpad}",
)
-
- cleanup_backups(device_file)
end
+ end
+ end
- copy_br(device, device_file_path)
+ # Restore backup
+ # @raise [::Bootloader::BootRecordBackup::Missing] if backup missing
+ # @return true if copy is successful
+ def restore
+ raise Missing.new unless exists?
+
+ # Copy only 440 bytes for Vista booting problem bnc #396444
+ # and also to not destroy partition table
+ copy_br(device_file_path, device, bs: 440) == 0
+ end
- # save MBR to yast2 log directory
- logs_path = "/var/log/YaST2/" + device_file
- copy_br(device, logs_path)
-
- if device == Yast::BootCommon.mbrDisk
- copy_br(device, "/boot/backup_mbr")
-
- # save thinkpad MBR
- if Yast::BootCommon.ThinkPadMBR(device)
- device_file_path_thinkpad = device_file_path + "thinkpadMBR"
- log.info("Backup thinkpad MBR")
- Yast::SCR.Execute(
- BASH_PATH,
- "cp #{device_file_path} #{device_file_path_thinkpad}",
- )
- end
- end
- end
+ private
- private
- # Get last change time of file
- # @param [String] filename string name of file
- # @return [String] last change date as YYYY-MM-DD-HH-MM-SS
- def formated_file_ctime(filename)
- stat = Yast::SCR.Read(Yast::Path.new(".target.stat"), filename)
- ctime = stat["ctime"] or raise "Cannot get modification time of file #{filename}"
- time = DateTime.strptime(ctime.to_s, "%s")
+ def device_file
+ @device_file ||= @device.tr("/", "_")
+ end
- time.strftime("%Y-%m-%d-%H-%M-%S")
- end
+ def device_file_path
+ @device_file_path ||= MAIN_BACKUP_DIR + device_file
+ end
+
+ def exists?
+ Yast::SCR.Read(TARGET_SIZE, device_file_path) > 0
+ end
+
+ # Get last change time of file
+ # @param [String] filename string name of file
+ # @return [String] last change date as YYYY-MM-DD-HH-MM-SS
+ def formated_file_ctime(filename)
+ stat = Yast::SCR.Read(Yast::Path.new(".target.stat"), filename)
+ ctime = stat["ctime"] or raise(Error, "Cannot get modification time of file #{filename}")
+ time = DateTime.strptime(ctime.to_s, "%s")
+
+ time.strftime("%Y-%m-%d-%H-%M-%S")
+ end
+
+ def copy_br(device, target_path, bs: 512)
+ Yast::SCR.Execute(
+ BASH_PATH,
+ "/bin/dd if=#{device} of=#{target_path} bs=#{bs} count=1 2>&1"
+ )
+ end
- def copy_br(device, target_path)
+ def reduce_backup_count
+ files = Yast::SCR.Read(Yast::Path.new(".target.dir"), MAIN_BACKUP_DIR)
+ # clean only backups for this device
+ files.select! do |c|
+ c =~ /#{Regexp.escape(device_file)}-\d{4}(?:-\d{2}){5}/
+ end
+ # and sort so we can benefit from its ascending order
+ files.sort!
+ files.drop(KEPT_BACKUPS).each do |file_name|
Yast::SCR.Execute(
- BASH_PATH,
- "/bin/dd if=#{device} of=#{target_path} bs=512 count=1 2>&1"
+ Yast::Path.new(".target.remove"),
+ MAIN_BACKUP_DIR + file_name
)
end
+ end
- def cleanup_backups(device_file)
- files = Yast::SCR.Read(Yast::Path.new(".target.dir"), MAIN_BACKUP_DIR)
- # clean only backups for this device
- files.select! do |c|
- c =~ /#{Regexp.escape(device_file)}-\d{4}(?:-\d{2}){5}/
- end
- # and sort so we can benefit from its ascending order
- files.sort!
- files.drop(KEPT_BACKUPS).each do |file_name|
- Yast::SCR.Execute(
- Yast::Path.new(".target.remove"),
- MAIN_BACKUP_DIR + file_name
- )
- end
- end
+ def rotate
+ # move it so we do not overwrite it
+ change_date = formated_file_ctime(device_file_path)
+ Yast::SCR.Execute(
+ BASH_PATH,
+ "/bin/mv %{path} %{path}-%{date}" %
+ { path: device_file_path, date: change_date }
+ )
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/lib/bootloader/grub2base.rb new/yast2-bootloader-3.1.101/src/lib/bootloader/grub2base.rb
--- old/yast2-bootloader-3.1.100/src/lib/bootloader/grub2base.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/lib/bootloader/grub2base.rb 2014-10-13 11:02:12.000000000 +0200
@@ -78,12 +78,10 @@
end
# Reset bootloader settings
- # @param [Boolean] init boolean true to repropose also device map
+ # @param [Boolean] unused
def Reset(init)
return if Mode.autoinst
- BootCommon.Reset(init)
-
- nil
+ BootCommon.Reset
end
def Dialogs
@@ -137,9 +135,6 @@
BootCommon.globals["distributor"] = Product.name
end
-
- BootCommon.kernelCmdLine ||= Kernel.GetCmdLine
-
# Propose bootloader serial settings from kernel cmdline during install (bnc#862388)
serial = BootCommon.GetSerialFromAppend
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/modules/BootArch.rb new/yast2-bootloader-3.1.101/src/modules/BootArch.rb
--- old/yast2-bootloader-3.1.100/src/modules/BootArch.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/modules/BootArch.rb 2014-10-13 11:02:12.000000000 +0200
@@ -57,18 +57,6 @@
end
ret = Ops.add(ret, "splash=silent quiet showopts")
return ret
- elsif Arch.ia64
- ret = kernel_cmdline != "" ? Ops.add(kernel_cmdline, " ") : ""
- ret = Ops.add(Ops.add(ret, features), " ") if features != ""
- ret = Ops.add(ret, "splash=silent quiet")
-
- # FIXME: this does not belong here, it cannot be tracked or maintained
- # and is undocumented
- # on SGI Altix change kernel default hash tables sizes
- if SCR.Read(path(".target.stat"), "/proc/sgi_sn") != {}
- ret = Ops.add(ret, " thash_entries=2097152")
- end
- return ret
elsif Arch.s390
file_desc = Convert.convert(
SCR.Execute(path(".target.bash_output"), "echo $TERM"),
@@ -102,8 +90,6 @@
ret = "showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset"
elsif Arch.x86_64
ret = "showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset"
- elsif Arch.ia64
- ret = "nohalt noresume powersaved=off"
elsif Arch.s390
ret = Ops.add(DefaultKernelParams(""), " noresume")
else
@@ -134,13 +120,13 @@
# Is VGA parameter setting available
# @return true if vga= can be set
def VgaAvailable
- Arch.i386 || Arch.x86_64 || Arch.ia64
+ Arch.i386 || Arch.x86_64
end
# Is Suspend to Disk available?
# @return true if STD is available
def ResumeAvailable
- Arch.i386 || Arch.x86_64 || Arch.ia64 || Arch.s390
+ Arch.i386 || Arch.x86_64 || Arch.s390
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-bootloader-3.1.100/src/modules/BootCommon.rb new/yast2-bootloader-3.1.101/src/modules/BootCommon.rb
--- old/yast2-bootloader-3.1.100/src/modules/BootCommon.rb 2014-10-01 12:20:04.000000000 +0200
+++ new/yast2-bootloader-3.1.101/src/modules/BootCommon.rb 2014-10-13 11:02:12.000000000 +0200
@@ -23,6 +23,13 @@
module Yast
class BootCommonClass < Module
+
+ SUPPORTED_BOOTLOADERS = [
+ "none", # allow user to manage bootloader itself
+ "grub2",
+ "grub2-efi"
+ ]
+
def main
Yast.import "Pkg"
Yast.import "UI"
@@ -34,9 +41,6 @@
Yast.import "Mode"
Yast.import "PackageSystem"
Yast.import "Storage"
- Yast.import "String"
- Yast.import "Popup"
- Yast.import "Package"
Yast.import "PackagesProposal"
Yast.import "BootStorage"
@@ -45,9 +49,6 @@
# General bootloader settings
- # map of global options and types for new perl-Bootloader interface
- @global_options = {}
-
# map of global options and values
@globals = {}
@@ -102,9 +103,6 @@
# values are :add, :remove or nil, means do nothing
@pmbr_action = nil
- # Kernel parameters at previous detection
- @kernelCmdLine = ""
-
# were settings changed (== true)
@changed = false
@@ -115,33 +113,16 @@
@loader_type = nil
@secure_boot = nil
- # sysconfig variables
-
- # installation proposal help variables
-
- # List of partitions deleted in primary proposal
- @del_parts = []
-
- # variables for storing data
-
# saving mode setting functions
# map of save mode settings
@write_settings = {}
- # summary dialog state
-
- # ui help variables
-
-
@additional_failsafe_params = ""
# other variables
- # Settings of other bootloaders used when switching bootloader
- @other_bl = {}
-
# bootloader installation variables
# Was the activate flag changed by user?
@@ -157,16 +138,6 @@
@was_read = false
# Was bootloader location changed? (== true)
@location_changed = false
- # Were configuration files manually edited and chamged?
- @files_edited = false
- # time of last change of partitioning
- @partitioning_last_change = 0
-
- # List of all supported bootloaders
- @bootloaders = [
- "grub2",
- "grub2-efi"
- ]
# FATE#305008: Failover boot configurations for md arrays with redundancy
# if true enable redundancy for md array
@@ -180,190 +151,6 @@
Yast.include self, "bootloader/routines/lib_iface.rb"
end
- # interface to bootloader library
-
- # Create section for linux kernel
- # @param [String] title string the section name to create (untranslated)
- # @return a map describing the section
- def CreateLinuxSection(title)
- ret = {
- "name" => title,
- "original_name" => title,
- "type" => "image",
- "__auto" => true,
- "__changed" => true
- }
-
- resume = BootArch.ResumeAvailable ? getLargestSwapPartition : ""
- # try to use label or udev id for device name... FATE #302219
- if resume != "" && resume != nil
- resume = ::Bootloader::DeviceMapping.to_mountby_device(resume)
- end
-
-
- # FIXME:
- # This only works in the installed system (problem with GetFinalKernel()),
- # in all other cases we use the symlinks.
-
- kernel_fn = ""
- initrd_fn = ""
-
- if Mode.normal
- # Find out the file names of the "real" kernel and initrd files, with
- # version etc. pp. whatever (currently version-flavor) attached.
- # FIXME: also do this for xen and xenpae kernels as found below
- #
- # Note: originally, we wanted to find out the kernel file names during
- # installation proposal when the files are not yet installed. But not
- # all the necessary interfaces work at that time. Now, this variant is
- # only run in the "running system", and could as well look at the
- # installed files.
- #
-
- # First of all, we have to initialize the RPM database
- Pkg.TargetInit(
- "/", # installed system
- false
- ) # don't create a new RPM database
-
- # Then, get the file names in the "selected" kernel package,
- kernel_package = Kernel.ComputePackage
- files = Pkg.PkgGetFilelist(kernel_package, :installed)
- Builtins.y2milestone(
- "kernel package %1 has these files: %2",
- kernel_package,
- files
- )
-
- # then find the first file that matches the arch-dependent kernel file
- # name prefix and the initrd filename prefix.
- kernel_prefix = Ops.add("/boot/", Kernel.GetBinary)
- initrd_prefix = "/boot/initrd"
-
- files_filtered = Builtins.filter(files) do |file|
- Builtins.substring(file, 0, Builtins.size(kernel_prefix)) == kernel_prefix
- end
-
-
- # Sort the filtered files, thus the image strings by length, the big ones
- # at the beginning, the small ones at the end of the list.
- # So, the first element of the sorted list files_filtered is the image string
- # containing the version and flavor.
- files_filtered = Builtins.sort(files_filtered) do |kbig, ksmall|
- Ops.greater_than(Builtins.size(kbig), Builtins.size(ksmall))
- end
-
- kernel_fn = Ops.get(files_filtered, 0, "")
-
- files_filtered = Builtins.filter(files) do |file|
- Builtins.substring(file, 0, Builtins.size(initrd_prefix)) == initrd_prefix &&
- !Builtins.regexpmatch(file, "-kdump$")
- end
-
- # Sort the filtered files, thus the initrd strings by length, the big ones
- # at the beginning, the small ones at the end of the list.
- # So, the first element of the sorted list files_filtered is the initrd string
- # containing the version and flavor.
- files_filtered = Builtins.sort(files_filtered) do |ibig, ismall|
- Ops.greater_than(Builtins.size(ibig), Builtins.size(ismall))
- end
-
- initrd_fn = Ops.get(files_filtered, 0, "")
-
- kernel_fn = "/boot/vmlinuz" if kernel_fn == "" || kernel_fn == nil
-
- initrd_fn = "/boot/initrd" if initrd_fn == "" || initrd_fn == nil
-
- # read commandline options for kernel
- cmd = Convert.convert(
- SCR.Read(path(".proc.cmdline")),
- :from => "any",
- :to => "list <string>"
- )
-
- vga = nil
-
- # trying to find "vga" option
- Builtins.foreach(cmd) do |key|
- vga = key if Builtins.issubstring(key, "vga=")
- Builtins.y2milestone("key: %1", key)
- end
- Builtins.y2milestone("vga from command line: %1", vga)
- mode = []
-
- # split vga=value
- if vga != nil && vga != ""
- mode = Builtins.splitstring(Builtins.tostring(vga), "=")
- end
-
- vgamode = nil
-
- # take value if exist
- if Ops.greater_than(Builtins.size(mode), 1) &&
- Ops.get(mode, 0, "") == "vga"
- vgamode = Ops.get(mode, 1)
- end
-
- # add value of vga into proposal (if exist)
- if vgamode != nil && vgamode != ""
- Ops.set(ret, "vgamode", vgamode)
- Builtins.y2milestone("vga mode: %1", vgamode)
- end
- else
- # the links are shown in the proposal; at the end of an installation,
- # in bootloader_finish, they will be resolved to the real filenames
- kernel_fn = Ops.add("/boot/", Kernel.GetBinary)
- initrd_fn = "/boot/initrd"
- end
- # done: kernel_fn and initrd_fn are the results
- Builtins.y2milestone("kernel_fn: %1 initrd_fn: %2", kernel_fn, initrd_fn)
-
- ret = Convert.convert(
- Builtins.union(
- ret,
- {
- "image" => kernel_fn,
- "initrd" => initrd_fn,
- # try to use label or udev id for device name... FATE #302219
- "root" => ::Bootloader::DeviceMapping.to_mountby_device(
- BootStorage.RootPartitionDevice
- ),
- "append" => title == "failsafe" ?
- BootArch.FailsafeKernelParams :
- BootArch.DefaultKernelParams(resume),
- "__devs" => [
- BootStorage.BootPartitionDevice,
- BootStorage.RootPartitionDevice
- ]
- }
- ),
- :from => "map",
- :to => "map