Hello community,
here is the log from the commit of package yast2-installation for openSUSE:Factory checked in at 2018-03-14 19:34:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-installation (Old)
and /work/SRC/openSUSE:Factory/.yast2-installation.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-installation"
Wed Mar 14 19:34:50 2018 rev:398 rq:586686 version:4.0.39
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-installation/yast2-installation.changes 2018-03-04 11:50:39.526349917 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-installation.new/yast2-installation.changes 2018-03-14 19:34:54.218012605 +0100
@@ -1,0 +2,22 @@
+Tue Mar 13 16:37:23 UTC 2018 - igonzalezsosa@suse.com
+
+- Set the 'ro' property on Btrfs filesystem when using an AutoYaST
+ profile which sets the 'ro' option explicitly (related to
+ bsc#1079000).
+- 4.0.39
+
+-------------------------------------------------------------------
+Tue Mar 13 12:09:45 CET 2018 - schubi@suse.de
+
+- complex_welcome: Translate license text if the language has been
+ changed (bnc#1077733).
+- 4.0.38
+
+-------------------------------------------------------------------
+Mon Mar 12 15:34:38 UTC 2018 - igonzalezsosa@suse.com
+
+- Set Btrfs 'ro' property at the end of the installation
+ when needed (bsc#1079000)
+- 4.0.37
+
+-------------------------------------------------------------------
Old:
----
yast2-installation-4.0.36.tar.bz2
New:
----
yast2-installation-4.0.39.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-installation.spec ++++++
--- /var/tmp/diff_new_pack.qynxvI/_old 2018-03-14 19:34:55.085981777 +0100
+++ /var/tmp/diff_new_pack.qynxvI/_new 2018-03-14 19:34:55.089981635 +0100
@@ -17,7 +17,7 @@
Name: yast2-installation
-Version: 4.0.36
+Version: 4.0.39
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ yast2-installation-4.0.36.tar.bz2 -> yast2-installation-4.0.39.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/doc/control-file.md new/yast2-installation-4.0.39/doc/control-file.md
--- old/yast2-installation-4.0.36/doc/control-file.md 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/doc/control-file.md 2018-03-14 09:42:14.000000000 +0100
@@ -923,12 +923,6 @@
partitioner dialog during installation, for example because the product has
special requirements for partitioning (Btrfs to support snapshots etc.).
-*root_subvolume_read_only* (boolean, default _false_) specifies whether the
-root subvolume should be mounted read-only in /etc/fstab and its 'ro' Btrfs
-property should be set to _true_. This works only for Btrfs root
-filesystems. If another root filesystem type is chosen, this might fail
-silently.
-
*home_path* (string) is the path (mount point) for the home
partition or volume, if any is created (depending on *try_separate_home*,
*limit_try_home* and available disk space).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/package/yast2-installation.changes new/yast2-installation-4.0.39/package/yast2-installation.changes
--- old/yast2-installation-4.0.36/package/yast2-installation.changes 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/package/yast2-installation.changes 2018-03-14 09:42:14.000000000 +0100
@@ -1,4 +1,26 @@
-------------------------------------------------------------------
+Tue Mar 13 16:37:23 UTC 2018 - igonzalezsosa@suse.com
+
+- Set the 'ro' property on Btrfs filesystem when using an AutoYaST
+ profile which sets the 'ro' option explicitly (related to
+ bsc#1079000).
+- 4.0.39
+
+-------------------------------------------------------------------
+Tue Mar 13 12:09:45 CET 2018 - schubi@suse.de
+
+- complex_welcome: Translate license text if the language has been
+ changed (bnc#1077733).
+- 4.0.38
+
+-------------------------------------------------------------------
+Mon Mar 12 15:34:38 UTC 2018 - igonzalezsosa@suse.com
+
+- Set Btrfs 'ro' property at the end of the installation
+ when needed (bsc#1079000)
+- 4.0.37
+
+-------------------------------------------------------------------
Thu Mar 1 14:48:45 UTC 2018 - shundhammer@suse.com
- Pass args to parent class constructor (bsc#1083500)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/package/yast2-installation.spec new/yast2-installation-4.0.39/package/yast2-installation.spec
--- old/yast2-installation-4.0.36/package/yast2-installation.spec 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/package/yast2-installation.spec 2018-03-14 09:42:14.000000000 +0100
@@ -16,7 +16,7 @@
#
Name: yast2-installation
-Version: 4.0.36
+Version: 4.0.39
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/src/lib/installation/clients/umount_finish.rb new/yast2-installation-4.0.39/src/lib/installation/clients/umount_finish.rb
--- old/yast2-installation-4.0.36/src/lib/installation/clients/umount_finish.rb 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/src/lib/installation/clients/umount_finish.rb 2018-03-14 09:42:14.000000000 +0100
@@ -28,6 +28,9 @@
# Authors:
# Jiri Srain
+require "y2storage"
+require "pathname"
+
module Yast
class UmountFinishClient < Client
include Yast::Logger
@@ -118,6 +121,18 @@
SCR.Execute(path(".target.bash"), "ln -s /proc/self/mounts /etc/mtab")
end
+ # BNC #692799: Preserve the randomness state before umounting
+ preserve_randomness_state
+
+ #
+ # !!! NO WRITE OPERATIONS TO THE TARGET AFTER THIS POINT !!!
+ #
+
+ # This must be done as long as the target root is still mounted
+ # (because the btrfs command requires that), but after the last write
+ # access to it (because it will be read only afterwards).
+ set_btrfs_defaults_as_ro
+
# Stop SCR on target
WFM.SCRClose(Installation.scr_handle)
@@ -171,18 +186,6 @@
end
end
- # BNC #692799: Preserve the randomness state before umounting
- preserve_randomness_state
-
- #
- # !!! NO WRITE OPERATIONS TO THE TARGET AFTER THIS POINT !!!
- #
-
- # This must be done as long as the target root is still mounted
- # (because the btrfs command requires that), but after the last write
- # access to it (because it will be read only afterwards).
- set_root_subvol_read_only
-
# storage-ng
# rubocop:disable Style/BlockComments
=begin
@@ -398,43 +401,36 @@
# Set the root subvolume to read-only and change the /etc/fstab entry
# accordingly
- #
- def set_root_subvol_read_only
- return unless root_subvol_read_only_configured?
- log.info("Setting root subvolume to read-only")
- set_fstab_root_subvol_read_only
- set_root_subvol_property_read_only
- end
+ def set_btrfs_defaults_as_ro
+ devicegraph = Y2Storage::StorageManager.instance.staging
- # Check the product configuration (control.xml) if the root subvolume
- # should be set to read-only.
- #
- def root_subvol_read_only_configured?
- # FIXME: this whole method should rely on Y2Storage::ProposalSettings.
- # But right now there is no #root_subvolume_read_only method there
-
- partitioning = ProductFeatures.GetSection("partitioning")
- proposal = partitioning.nil? ? nil : partitioning["proposal"]
- return false if proposal.nil?
- proposal["root_subvolume_read_only"] == true
- end
+ ro_btrfs_filesystems = devicegraph.filesystems.select do |fs|
+ fs.is?(:btrfs) && fs.mount_point && fs.mount_options.include?("ro")
+ end
- # Change /etc/fstab on the target to mount the root subvolume read-only.
- #
- def set_fstab_root_subvol_read_only
- cmd = "sed -i -e '/ \\/ btrfs/s/defaults/ro/' /etc/fstab"
- log.info("Setting root subvol to read-only in /etc/fstab: \"#{cmd}\"")
- SCR.Execute(path(".target.bash"), cmd)
+ ro_btrfs_filesystems.each { |f| default_subvolume_as_ro(f) }
end
+ # [String] Name used by btrfs tools to name the filesystem tree.
+ BTRFS_FS_TREE = "(FS_TREE)".freeze
+
# Set the "read-only" property for the root subvolume.
# This has to be done as long as the target root filesystem is still
# mounted.
#
- def set_root_subvol_property_read_only
- cmd = "btrfs property set /.snapshots/1/snapshot ro true"
- log.info("Setting root subvol read-only property: \"#{cmd}\"")
- SCR.Execute(path(".target.bash"), cmd)
+ # @param fs [Y2Storage::Filesystems::Btrfs] Btrfs filesystem to set read-only property on.
+ def default_subvolume_as_ro(fs)
+ output = Yast::Execute.on_target(
+ "btrfs", "subvolume", "get-default", fs.mount_point.path, stdout: :capture
+ )
+ default_subvolume = output.strip.split.last
+ # no btrfs_default_subvolume and no snapshots
+ default_subvolume = "" if default_subvolume == BTRFS_FS_TREE
+
+ subvolume_path = fs.btrfs_subvolume_mount_point(default_subvolume)
+
+ log.info("Setting root subvol read-only property on #{subvolume_path}")
+ Yast::Execute.on_target("btrfs", "property", "set", subvolume_path, "ro", "true")
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/src/lib/installation/dialogs/complex_welcome.rb new/yast2-installation-4.0.39/src/lib/installation/dialogs/complex_welcome.rb
--- old/yast2-installation-4.0.36/src/lib/installation/dialogs/complex_welcome.rb 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/src/lib/installation/dialogs/complex_welcome.rb 2018-03-14 09:42:14.000000000 +0100
@@ -63,7 +63,7 @@
#
# @return [Yast::Term] Dialog's content
def contents
- @contents ||= VBox(
+ VBox(
filling,
locale_settings,
license_or_product_content,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-installation-4.0.36/test/lib/clients/umount_finish_test.rb new/yast2-installation-4.0.39/test/lib/clients/umount_finish_test.rb
--- old/yast2-installation-4.0.36/test/lib/clients/umount_finish_test.rb 2018-03-01 16:08:50.000000000 +0100
+++ new/yast2-installation-4.0.39/test/lib/clients/umount_finish_test.rb 2018-03-14 09:42:14.000000000 +0100
@@ -3,98 +3,132 @@
require_relative "../../test_helper"
require "installation/clients/umount_finish"
-Yast.import "ProductFeatures"
-
describe Yast::UmountFinishClient do
subject(:client) { described_class.new }
- describe "root_subvol_read_only_configured?" do
- before do
- Yast::ProductFeatures.Import(features)
- end
-
- after do
- # Reset the product features to its default values after
- # fiddling with then
- Yast::ProductFeatures.Import({})
- end
-
- context "if there is no /partitioning section in the product features" do
- let(:features) { {} }
-
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
- end
- end
-
- context "if there is no /partitioning/proposal section in the product features" do
- let(:features) { { "partitioning" => {} } }
-
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
- end
- end
-
- context "if root_subvolume_read_only is not set in /partitioning/proposal" do
- let(:features) do
- { "partitioning" => { "proposal" => {} } }
- end
-
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
- end
- end
-
- context "if root_subvolume_read_only is set directly in the /partitioning section" do
- let(:features) do
- { "partitioning" => { "root_subvolume_read_only" => true } }
- end
-
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
- end
- end
-
- context "if root_subvolume_read_only is set to true in the /partitioning/proposal section" do
- let(:features) do
- {
- "partitioning" => {
- "proposal" => { "root_subvolume_read_only" => true }
- }
- }
- end
-
- it "returns true" do
- expect(client.root_subvol_read_only_configured?).to eq true
- end
- end
-
- context "if root_subvolume_read_only is set to false in /partitioning/proposal section" do
- let(:features) do
- {
- "partitioning" => {
- "proposal" => { "root_subvolume_read_only" => false }
- }
- }
- end
+ DEFAULT_SUBVOLUME = "@/.snapshots/1/snapshot".freeze
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
- end
- end
-
- # Validation should protect us from this, but is not always checked
- context "if root_subvolume_read_only has a non boolean value in /partitioning/proposal section" do
- let(:features) do
- {
- "partitioning" => {
- "proposal" => { "root_subvolume_read_only" => "not so sure" }
- }
- }
- end
-
- it "returns false" do
- expect(client.root_subvol_read_only_configured?).to eq false
+ describe "#set_btrfs_defaults_as_ro" do
+ before do
+ allow(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "subvolume", "get-default", "/", anything)
+ .and_return(get_default)
+ allow(Y2Storage::StorageManager.instance).to receive(:staging).and_return(devicegraph)
+ end
+
+ let(:devicegraph) do
+ instance_double(Y2Storage::Devicegraph, filesystems: [root_fs])
+ end
+
+ let(:root_fs) do
+ instance_double(
+ Y2Storage::Filesystems::Btrfs,
+ is?: true,
+ mount_point: mount_point,
+ mount_options: mount_options,
+ subvolumes_prefix: subvolumes_prefix
+ )
+ end
+
+ let(:mount_point) { instance_double(Y2Storage::MountPoint, path: "/") }
+ let(:mount_options) { ["ro"] }
+ let(:subvolumes_prefix) { "@" }
+ let(:get_default) { "ID 276 gen 1172 top level 275 path @/.snapshots/1/snapshot\n" }
+
+ context "when a Btrfs filesystem is mounted as read-only" do
+ context "and there is no subvolume_prefix" do
+ let(:subvolumes_prefix) { "" }
+
+ context "and snapshots are enabled" do
+ let(:get_default) { "ID 276 gen 1172 top level 275 path .snapshots/1/snapshot\n" }
+
+ it "sets 'ro' property to true on the snapshot" do
+ expect(root_fs).to receive(:btrfs_subvolume_mount_point)
+ .with(".snapshots/1/snapshot").and_return("/.snapshots/1/snapshot")
+ expect(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "property", "set", "/.snapshots/1/snapshot", "ro", "true")
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+
+ context "and snapshots are disabled" do
+ let(:get_default) { "ID 5 (FS_TREE)\n" }
+
+ it "sets 'ro' property to true on the mount point" do
+ expect(root_fs).to receive(:btrfs_subvolume_mount_point)
+ .with("").and_return("/")
+ expect(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "property", "set", "/", "ro", "true")
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+ end
+
+ context "and there is a subvolume_prefix" do
+ let(:subvolumes_prefix) { "@" }
+
+ context "and snapshots are enabled" do
+ let(:get_default) { "ID 276 gen 1172 top level 275 path @/.snapshots/1/snapshot\n" }
+
+ it "sets 'ro' property to true on the snapshot" do
+ expect(root_fs).to receive(:btrfs_subvolume_mount_point)
+ .with("@/.snapshots/1/snapshot").and_return("/.snapshots/1/snapshot")
+ expect(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "property", "set", "/.snapshots/1/snapshot", "ro", "true")
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+
+ context "and snapshots are disabled" do
+ let(:get_default) { "ID 276 gen 1172 top level 275 path @\n" }
+
+ it "sets 'ro' property to true on the mount point" do
+ expect(root_fs).to receive(:btrfs_subvolume_mount_point)
+ .with("@").and_return("/")
+ expect(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "property", "set", "/", "ro", "true")
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+ end
+
+ context "mount point is different than root" do
+ let(:mount_point) { instance_double(Y2Storage::MountPoint, path: "/home") }
+ let(:subvolumes_prefix) { "" }
+
+ before do
+ allow(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "subvolume", "get-default", "/home", anything)
+ .and_return("ID 5 (FS_TREE)\n")
+ end
+
+ it "sets 'ro' property to true on the mount point" do
+ expect(root_fs).to receive(:btrfs_subvolume_mount_point)
+ .with("").and_return("/home")
+ expect(Yast::Execute).to receive(:on_target)
+ .with("btrfs", "property", "set", "/home", "ro", "true")
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+ end
+
+ context "when a non-Btrfs filesystem is mounted" do
+ let(:root_fs) { instance_double(Y2Storage::Filesystems::Base, is?: false) }
+
+ it "does not try to set 'ro' property for that filesystem" do
+ expect(Yast::Execute).to_not receive(:on_target)
+ .with("btrfs", "property", "set", any_args)
+ client.set_btrfs_defaults_as_ro
+ end
+ end
+
+ context "when Btrfs filesystem is not mounted as read-only" do
+ let(:mount_options) { [] }
+
+ it "does not try to set 'ro' property" do
+ expect(Yast::Execute).to_not receive(:on_target)
+ .with("btrfs", "property", "set", any_args)
+ client.set_btrfs_defaults_as_ro
end
end
end