cloud-init: set keyboard through localectl

Set keyboard through systemd's localectl instead of writing to
Debian specific /etc/default/keyboard directly, as this also
works for other Linux distributions.

On Debian/Ubuntu one does still need to run a distro specific
command to have the keyboard change be effective without
reboot first (setupcon).
This commit is contained in:
Floris Bos 2021-11-25 01:34:13 +01:00
parent 6845a86fc3
commit 9a9c5eb490

View file

@ -689,9 +689,8 @@ Popup {
addFirstRun("dpkg-reconfigure -f noninteractive keyboard-configuration") addFirstRun("dpkg-reconfigure -f noninteractive keyboard-configuration")
addCloudInit("timezone: "+fieldTimezone.editText) addCloudInit("timezone: "+fieldTimezone.editText)
addCloudInitWriteFile("/etc/default/keyboard", kbdconfig, '0644') addCloudInitRun("localectl set-x11-keymap \""+fieldKeyboardLayout.editText+"\" pc105")
addCloudInitRun("dpkg-reconfigure -f noninteractive keyboard-configuration || true") addCloudInitRun("setupcon -k --force || true")
addCloudInitRun("setupcon -k -v --force || true")
} }
if (firstrun.length) { if (firstrun.length) {