File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,21 @@ systemd_journald_audit_transport_enable() {
3737 touch " /var/lib/usability-misc/do_once/${FUNCNAME} _version_1"
3838}
3939
40+ generate_grub_keyboard_layouts_maybe () {
41+ if [ -f " /var/lib/usability-misc/do_once/${FUNCNAME} _version_1" ]; then
42+ return 0
43+ fi
44+
45+ if ! [ -d /boot/grub/kb_layouts ]; then
46+ if timeout --kill-after 5 5 localectl > /dev/null; then
47+ set-grub-keymap --build-all || true
48+ fi
49+ fi
50+
51+ mkdir -p " /var/lib/usability-misc/do_once"
52+ touch " /var/lib/usability-misc/do_once/${FUNCNAME} _version_1"
53+ }
54+
4055true "
4156#####################################################################
4257## INFO: BEGIN: $DPKG_MAINTSCRIPT_PACKAGE $DPKG_MAINTSCRIPT_NAME $@
@@ -61,6 +76,8 @@ case "$1" in
6176
6277 adduser --home /run/tunnel --no-create-home --quiet --system --group --shell /bin/false " tunnel" || true
6378
79+ generate_grub_keyboard_layouts_maybe
80+
6481 true " INFO: End configuring $DPKG_MAINTSCRIPT_PACKAGE ."
6582
6683 ;;
Original file line number Diff line number Diff line change @@ -13,8 +13,6 @@ if ! [ -d /boot/grub/kb_layouts ]; then
1313 exit 0
1414fi
1515
16- user_layout_name=" $( cat /boot/grub/kb_layouts/user-layout.name) " || { user_layout_name=' unknown' ; true ; }
17-
1816printf ' %s\n' " \
1917function load_kb_layout {
2018 kb_layout_name=\"\$ 1\"
@@ -52,10 +50,20 @@ function load_kb_layout {
5250 return 0
5351}
5452
55- submenu 'Keyboard layout options' \$ menuentry_id_option 'kb-layout-options' {
53+ submenu 'Keyboard layout options' \$ menuentry_id_option 'kb-layout-options' {"
54+
55+ if [ -f /boot/grub/kb_layouts/user-layout.gkb ]; then
56+ if [ -f /boot/grub/kb_layouts/user-layout.name ]; then
57+ user_layout_name=" $( cat /boot/grub/kb_layouts/user-layout.name) " || { user_layout_name=' unknown' ; true ; }
58+ else
59+ user_layout_name=' unknown'
60+ fi
61+
62+ printf ' %s\n' " \
5663 menuentry \" SWITCH to user-defined keyboard layout '$user_layout_name '\" \$ menuentry_id_option 'switch-kb-layout-user-defined' {
5764 load_kb_layout 'user-layout'
5865 }"
66+ fi
5967
6068for layout_file in /boot/grub/kb_layouts/* .gkb; do
6169 if ! [ -f " $layout_file " ]; then
You can’t perform that action at this time.
0 commit comments