5 [[ "$mount_needs" ]] && return 1
7 require_binaries setfont loadkeys kbd_mode ||
return 1
19 if dracut_module_included
"systemd"; then
22 [[ -f /etc
/vconsole.conf
]] && .
/etc
/vconsole.conf
25 KBDSUBDIRS
=consolefonts
,consoletrans
,keymaps
,unimaps
26 DEFAULT_FONT
="${i18n_default_font:-LatArCyrHeb-16}"
27 I18N_CONF
="/etc/locale.conf"
28 VCONFIG_CONF
="/etc/vconsole.conf"
30 # This is from 10redhat-i18n.
34 MAP
=$
(find ${kbddir}/keymaps
-type f
-name $MAP -o -name $MAP.\
* |
head -n1)
35 [[ " $KEYMAPS " = *" $MAP "* ]] && return
36 KEYMAPS
="$KEYMAPS $MAP"
43 for INCL
in $
($cmd "^include " $MAP |
while read a a b ||
[ -n "$a" ]; do echo ${a//\"/}; done); do
44 for FN
in $
(find ${kbddir}/keymaps
-type f
-name $INCL\
*); do
50 # Function gathers variables from distributed files among the tree, maps to
51 # specified names and prints the result in format "new-name=value".
53 # $@ = list in format specified below (BNF notation)
55 # <list> ::= <element> | <element> " " <list>
56 # <element> ::= <conf-file-name> ":" <map-list>
57 # <map-list> ::= <mapping> | <mapping> "," <map-list>
58 # <mapping> ::= <src-var> "-" <dst-var> | <src-var>
60 # We assume no whitespace are allowed between symbols.
61 # <conf-file-name> is a file holding <src-var> in your system.
62 # <src-var> is a variable holding value of meaning the same as <dst-var>.
63 # <dst-var> is a variable which will be set up inside initramfs.
64 # If <dst-var> has the same name as <src-var> we can omit <dst-var>.
67 # /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
68 # <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
69 # <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
70 # <conf-file-name> = /etc/conf.d/keymaps
71 # <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
74 # <mapping> = extended_keymaps-EXT_KEYMAPS
75 # <src-var> = extended_keymaps
76 # <dst-var> = EXT_KEYMAPS
83 for map
in ${item[1]//,/ }
86 if [[ -f "${item[0]}" ]]; then
87 value
=$
(grep "^${map[0]}=" "${item[0]}")
89 echo "${map[1]:-${map[0]}}=${value}"
96 inst_multiple setfont loadkeys kbd_mode stty
98 if ! dracut_module_included
"systemd"; then
99 inst
${moddir}/console_init.sh
/lib
/udev
/console_init
100 inst_rules
${moddir}/10-console.rules
101 inst_hook cmdline
20 "${moddir}/parse-i18n.sh"
108 for _src
in $
(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
110 cp --reflink=auto
--sparse=auto
-prfL -t "${initdir}/${_src}" "$_src"/*
113 # remove unnecessary files
114 rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
115 find "${initdir}${kbddir}/" -name README\
* -delete
116 find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
117 |
while read line ||
[ -n "$line" ]; do
121 find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
122 |
while read line ||
[ -n "$line" ]; do
127 install_local_i18n
() {
130 eval $
(gather_vars
${i18n_vars})
131 [ -f $I18N_CONF ] && .
$I18N_CONF
132 [ -f $VCONFIG_CONF ] && .
$VCONFIG_CONF
134 shopt -q -s nocasematch
137 if [[ ${UNICODE} = YES ||
${UNICODE} = 1 ]]
140 elif [[ ${UNICODE} = NO ||
${UNICODE} = 0 ]]
147 if [[ ! ${UNICODE} && ${LANG} =~ .
*\.UTF-?
8 ]]
151 shopt -q -u nocasematch
153 # Gentoo user may have KEYMAP set to something like "-u pl2",
156 # openSUSE user may have KEYMAP set to something like ".gz"
157 KEYMAP
=${KEYMAP/.gz/}
159 # KEYTABLE is a bit special - it defines base keymap name and UNICODE
160 # determines whether non-UNICODE or UNICODE version is used
162 if [[ ${KEYTABLE} ]]; then
163 if [[ ${UNICODE} == 1 ]]; then
164 [[ ${KEYTABLE} =~ .
*\.uni.
* ]] || KEYTABLE
=${KEYTABLE%.map*}.uni
169 # I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in
170 # original redhat-i18n module. Anyway it won't hurt.
171 EXT_KEYMAPS
+=\
${UNIKEYMAP}\
${GRP_TOGGLE}
174 dinfo
'No KEYMAP configured.'
180 for map
in ${EXT_KEYMAPS}
182 ddebug
"Adding extra map: ${map}"
186 inst_opt_decompress
${KEYMAPS}
188 inst_opt_decompress
${kbddir}/consolefonts
/${DEFAULT_FONT}.
*
190 if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
193 inst_opt_decompress
${kbddir}/consolefonts
/${FONT}.
*
198 FONT_MAP
=${FONT_MAP%.trans}
199 inst_simple
${kbddir}/consoletrans
/${FONT_MAP}.trans
202 if [[ ${FONT_UNIMAP} ]]
204 FONT_UNIMAP
=${FONT_UNIMAP%.uni}
205 inst_simple
${kbddir}/unimaps
/${FONT_UNIMAP}.uni
208 if dracut_module_included
"systemd" && [[ -f ${I18N_CONF} ]]; then
209 inst_simple
${I18N_CONF}
211 mksubdirs
${initdir}${I18N_CONF}
212 print_vars LC_ALL LANG
>> ${initdir}${I18N_CONF}
215 if dracut_module_included
"systemd" && [[ -f ${VCONFIG_CONF} ]]; then
216 inst_simple
${VCONFIG_CONF}
218 mksubdirs
${initdir}${VCONFIG_CONF}
219 print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP
>> ${initdir}${VCONFIG_CONF}
226 for kbddir
in ${kbddir} /usr
/lib
/kbd
/lib
/kbd
/usr
/share
/usr
/share
/kbd
228 [[ -d "${kbddir}" ]] && \
229 for dir
in ${KBDSUBDIRS//,/ }
231 [[ -d "${kbddir}/${dir}" ]] && continue
237 [[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
238 [[ ! ${hostonly} ||
${i18n_vars} ]] ||
{
239 derror
'i18n_vars not set! Please set up i18n_vars in ' \
240 'configuration file.'
248 if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
249 install_local_i18n || install_all_kbd