summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-14 06:33:49 +0100
committerGitHub <noreply@github.com>2020-11-14 06:33:49 +0100
commit88570e2111ee361bb13f60b70c298cbac7571d19 (patch)
treeaeb8945fdabd4d60a9595e70887feb7cd1fa0e56
parent49e4843a2f1217f75ef41cfe744723021554a2fd (diff)
parentd6ab086a744fe8e1d5bc071ccd8f0cfa4d272e55 (diff)
downloadvyos-1x-88570e2111ee361bb13f60b70c298cbac7571d19.tar.gz
vyos-1x-88570e2111ee361bb13f60b70c298cbac7571d19.zip
Merge pull request #608 from DmitriyEshenko/kb-layout
system: T3038: Add keyboard layout CLI command
-rw-r--r--interface-definitions/system-options.xml.in32
-rwxr-xr-xsrc/conf_mode/system-options.py9
2 files changed, 41 insertions, 0 deletions
diff --git a/interface-definitions/system-options.xml.in b/interface-definitions/system-options.xml.in
index 297f5891e..fab0c0169 100644
--- a/interface-definitions/system-options.xml.in
+++ b/interface-definitions/system-options.xml.in
@@ -80,6 +80,38 @@
#include <include/source-address-ipv4-ipv6.xml.i>
</children>
</node>
+ <leafNode name="keyboard-layout">
+ <properties>
+ <help>System keyboard layout, type ISO2</help>
+ <completionHelp>
+ <list>us fr de fi no dk</list>
+ </completionHelp>
+ <valueHelp>
+ <format>us</format>
+ <description>United States of America</description>
+ </valueHelp>
+ <valueHelp>
+ <format>fr</format>
+ <description>France</description>
+ </valueHelp>
+ <valueHelp>
+ <format>de</format>
+ <description>Germany</description>
+ </valueHelp>
+ <valueHelp>
+ <format>fi</format>
+ <description>Finland</description>
+ </valueHelp>
+ <valueHelp>
+ <format>no</format>
+ <description>Norway</description>
+ </valueHelp>
+ <valueHelp>
+ <format>dk</format>
+ <description>Denmark</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
</children>
</node>
</children>
diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py
index 22765cef7..bf0bd56ec 100755
--- a/src/conf_mode/system-options.py
+++ b/src/conf_mode/system-options.py
@@ -107,6 +107,15 @@ def apply(options):
else:
cmd('systemctl disable tuned.service')
+ # Keyboard layout
+ if 'keyboard_layout' in options.keys():
+ try:
+ cmd('loadkeys {}'.format(options['keyboard_layout']))
+ except OSError:
+ raise ConfigError('Dos not possible to set {} as keyboard layout'.format(options['keyboard_layout']))
+ else:
+ cmd('loadkeys us')
+
if __name__ == '__main__':
try:
c = get_config()