Skip to content

Commit

Permalink
AY writing keyboard settings
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Dec 13, 2017
1 parent b44514a commit 6d9a056
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions keyboard/src/modules/Keyboard.rb
Expand Up @@ -836,7 +836,7 @@ def Modified
# Save the current data into a file to be read after a reboot.
#
def Save
if Mode.update
if Mode.update && !Mode.autoupgrade
kbd = Misc.SysconfigRead(path(".sysconfig.keyboard.YAST_KEYBOARD"), "")
if kbd.empty?
kmap = Misc.SysconfigRead(path(".etc.vconsole_conf.KEYMAP"), "")
Expand Down Expand Up @@ -1120,7 +1120,7 @@ def MakeProposal(force_reset, language_changed)
# Only follow the language if the user has never actively chosen
# a keyboard. The indicator for this is user_decision which is
# set from outside the module.
if @user_decision || Mode.update && !Stage.initial || Mode.autoinst ||
if @user_decision || Mode.update && !Stage.initial || Mode.auto ||
Mode.live_installation ||
ProductFeatures.GetStringFeature("globals", "keyboard") != ""
if language_changed
Expand Down
31 changes: 31 additions & 0 deletions keyboard/test/keyboard_test.rb
Expand Up @@ -16,6 +16,7 @@ module Yast
import "Report"
import "OSRelease"
import "Keyboard"
import "Mode"

::RSpec.configure do |c|
c.include SCRStub
Expand Down Expand Up @@ -122,6 +123,28 @@ module Yast
Keyboard.Save
end
end

context "during autoupgrade with german keyboard" do
let(:mode) { "autoupgrade" }
let(:stage) { "initial" }
let(:chroot) { "installing" }
let(:new_lang) { "german" }

it "writes the configuration" do
expect(SCR).to execute_bash(/loadkeys/)
expect(SCR).to execute_bash(/xkbctrl/)
expect(AsciiFile).to receive(:AppendLine).with(anything,
["Keytable:", "de-nodeadkeys.map.gz"])

Keyboard.Set("german")
Keyboard.Save

expect(written_value_for(".sysconfig.keyboard.YAST_KEYBOARD")).to eq("german,pc104")
expect(written_value_for(".sysconfig.keyboard")).to be_nil
expect(written_value_for(".etc.vconsole_conf.KEYMAP")).to eq("de-nodeadkeys")
expect(written_value_for(".etc.vconsole_conf")).to be_nil
end
end
end

describe "#Set" do
Expand Down Expand Up @@ -462,6 +485,14 @@ module Yast
end
end
end

context "AutoYaST upgrade mode" do
it "do not make a new proposal" do
expect(Mode).to receive(:autoupgrade).and_return true
expect(Keyboard).to_not receive(:Set)
Keyboard.MakeProposal(false, false)
end
end
end

describe "#Probe" do
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-country.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Dec 13 13:48:06 CET 2017 - schubi@suse.de

- AutoYaST upgrade fix: Writing keyboard settings defined in AY
configuration file (bnc1070305).
- 3.1.37

----------------------------------------------------------------
Thu Mar 2 12:24:03 UTC 2017 - kanderssen@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-country.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-country
Version: 3.1.36
Version: 3.1.37
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down

0 comments on commit 6d9a056

Please sign in to comment.