-
Notifications
You must be signed in to change notification settings - Fork 883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cc_keyboard in mantic #4361
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,11 +300,38 @@ def update_package_sources(self): | |
def get_primary_arch(self): | ||
return util.get_dpkg_architecture() | ||
|
||
def set_keymap(self, layout, model, variant, options): | ||
# Let localectl take care of updating /etc/default/keyboard | ||
distros.Distro.set_keymap(self, layout, model, variant, options) | ||
# Workaround for localectl not applying new settings instantly | ||
def set_keymap(self, layout: str, model: str, variant: str, options: str): | ||
# localectl is broken on some versions of Debian. See | ||
# https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2030788 and | ||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1038762 | ||
# | ||
# Instead, write the file directly. According to the keyboard(5) man | ||
# page, this file is shared between both X and the console. | ||
|
||
contents = "\n".join( | ||
[ | ||
"# This file was generated by cloud-init", | ||
"", | ||
f'XKBMODEL="{model}"', | ||
f'XKBLAYOUT="{layout}"', | ||
f'XKBVARIANT="{variant}"', | ||
f'XKBOPTIONS="{options}"', | ||
"", | ||
'BACKSPACE="guess"', # This is provided on default installs | ||
"", | ||
] | ||
) | ||
util.write_file( | ||
filename="/etc/default/keyboard", | ||
content=contents, | ||
mode=644, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mode here needs to be octal not decimal, this resulted in some very bad behavior on mantic when cloud-init wrote the file with perms 1204 :)
More details in the bug |
||
omode="w", | ||
) | ||
|
||
# Due to | ||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=926037 | ||
# if localectl can be used in the future, this line may still | ||
# be needed | ||
self.manage_service("restart", "console-setup") | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a nitpick... Is it possible to allow the user to configure this, but still default to "guess" incase they do not configure this option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While a good thought, the implementation is highly debian-specific given that this implementation is writing directly to /etc/default/keyboard. Surfacing such and option is something that won't be supportable easily on any other distribution that is calling
localectl
directly, because that command doesn't support setting backspace values.