From df5af8fd497ed39cb2e2e880fa759216257afef0 Mon Sep 17 00:00:00 2001 From: dteske Date: Thu, 25 May 2017 18:16:17 +0000 Subject: [PATCH] Fix long standing issue in bsdconfig's keymap selection Since the translation to vt as terminal emulator, the keymaps files path has changed and this change does not get followed in bsdconfig. This implicates boot time warnings about a wrong keymap file, what is very confusing for the new users and for me too, so initialize the default keymaps search path depending on terminal type. Differential Revision: https://reviews.freebsd.org/D8734 Submitted by: Oliver Pinter Reviewed by: ed, jilles, dteske MFC after: 3 days X-MFC-to: stable/11 Sponsored by: HardenedBSD Signed-off-by: Oliver Pinter --- usr.sbin/bsdconfig/console/keymap | 8 +++++++- usr.sbin/bsdconfig/share/keymap.subr | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bsdconfig/console/keymap b/usr.sbin/bsdconfig/console/keymap index c163a1b7e1bb..28c0500cf8ac 100755 --- a/usr.sbin/bsdconfig/console/keymap +++ b/usr.sbin/bsdconfig/console/keymap @@ -172,6 +172,7 @@ dialog_menu_main() uk.iso) defaultitem="$msg_uk_iso" ;; ua.koi8-u) defaultitem="$msg_ukrainian_koi8_u" ;; ua.koi8-u.shift.alt) defaultitem="$msg_ukrainian_koi8_u_koi8_r" ;; + us.ctrl) defaultitem="$msg_usa_capslock_ctrl" ;; us.pc-ctrl) defaultitem="$msg_usa_capslock_ctrl" ;; us.dvorak) defaultitem="$msg_usa_dvorak" ;; us.dvorakl) defaultitem="$msg_usa_dvorak_left" ;; @@ -307,7 +308,12 @@ while :; do uk_iso) keymap_to_set="uk.iso" ;; ukrainian_koi8_u) keymap_to_set="ua.koi8-u" ;; ukrainian_koi8_u_koi8_r) keymap_to_set="ua.koi8-u.shift.alt" ;; - usa_capslock_ctrl) keymap_to_set="us.pc-ctrl" ;; + usa_capslock_ctrl) + case "$( sysctl -n kern.vty )" in + vt) keymap_to_set="us.ctrl" ;; + *) keymap_to_set="us.pc-ctrl" ;; + esac + ;; usa_dvorak) keymap_to_set="us.dvorak" ;; usa_dvorak_left) keymap_to_set="us.dvorakl" ;; usa_dvorak_right) keymap_to_set="us.dvorakr" ;; diff --git a/usr.sbin/bsdconfig/share/keymap.subr b/usr.sbin/bsdconfig/share/keymap.subr index 7f2f87c91b38..ca6f3c8df841 100644 --- a/usr.sbin/bsdconfig/share/keymap.subr +++ b/usr.sbin/bsdconfig/share/keymap.subr @@ -39,7 +39,10 @@ f_include $BSDCFG_SHARE/struct.subr # Defaults taken from usr.sbin/kbdmap/kbdmap.h # : ${DEFAULT_LANG:=en} -: ${DEFAULT_KEYMAP_DIR:=/usr/share/syscons/keymaps} +case "$( sysctl -n kern.vty )" in +vt) : ${DEFAULT_KEYMAP_DIR:=/usr/share/vt/keymaps} ;; +*) : ${DEFAULT_KEYMAP_DIR:=/usr/share/syscons/keymaps} ;; +esac ############################################################ GLOBALS