Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/dracut/modules..../10i18n
File: module-setup.sh
#!/bin/bash
[0] Fix | Delete
[1] Fix | Delete
# called by dracut
[2] Fix | Delete
check() {
[3] Fix | Delete
[[ "$mount_needs" ]] && return 1
[4] Fix | Delete
[5] Fix | Delete
require_binaries setfont loadkeys kbd_mode || return 1
[6] Fix | Delete
[7] Fix | Delete
return 0
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
# called by dracut
[11] Fix | Delete
depends() {
[12] Fix | Delete
return 0
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
# called by dracut
[16] Fix | Delete
install() {
[17] Fix | Delete
if dracut_module_included "systemd"; then
[18] Fix | Delete
unset FONT
[19] Fix | Delete
unset KEYMAP
[20] Fix | Delete
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
[21] Fix | Delete
fi
[22] Fix | Delete
[23] Fix | Delete
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
[24] Fix | Delete
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
[25] Fix | Delete
I18N_CONF="/etc/locale.conf"
[26] Fix | Delete
VCONFIG_CONF="/etc/vconsole.conf"
[27] Fix | Delete
[28] Fix | Delete
# This is from 10redhat-i18n.
[29] Fix | Delete
findkeymap () {
[30] Fix | Delete
local MAPS=$1
[31] Fix | Delete
local MAPNAME=${1%.map*}
[32] Fix | Delete
local map
[33] Fix | Delete
[[ ! -f $MAPS ]] && \
[34] Fix | Delete
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
[35] Fix | Delete
[36] Fix | Delete
for map in $MAPS; do
[37] Fix | Delete
KEYMAPS="$KEYMAPS $map"
[38] Fix | Delete
case $map in
[39] Fix | Delete
*.gz) cmd=zgrep;;
[40] Fix | Delete
*.bz2) cmd=bzgrep;;
[41] Fix | Delete
*) cmd=grep ;;
[42] Fix | Delete
esac
[43] Fix | Delete
[44] Fix | Delete
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
[45] Fix | Delete
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
[46] Fix | Delete
strstr "$KEYMAPS" "$FN" || findkeymap $FN
[47] Fix | Delete
done
[48] Fix | Delete
done
[49] Fix | Delete
done
[50] Fix | Delete
}
[51] Fix | Delete
[52] Fix | Delete
# Function gathers variables from distributed files among the tree, maps to
[53] Fix | Delete
# specified names and prints the result in format "new-name=value".
[54] Fix | Delete
#
[55] Fix | Delete
# $@ = list in format specified below (BNF notation)
[56] Fix | Delete
#
[57] Fix | Delete
# <list> ::= <element> | <element> " " <list>
[58] Fix | Delete
# <element> ::= <conf-file-name> ":" <map-list>
[59] Fix | Delete
# <map-list> ::= <mapping> | <mapping> "," <map-list>
[60] Fix | Delete
# <mapping> ::= <src-var> "-" <dst-var> | <src-var>
[61] Fix | Delete
#
[62] Fix | Delete
# We assume no whitespace are allowed between symbols.
[63] Fix | Delete
# <conf-file-name> is a file holding <src-var> in your system.
[64] Fix | Delete
# <src-var> is a variable holding value of meaning the same as <dst-var>.
[65] Fix | Delete
# <dst-var> is a variable which will be set up inside initramfs.
[66] Fix | Delete
# If <dst-var> has the same name as <src-var> we can omit <dst-var>.
[67] Fix | Delete
#
[68] Fix | Delete
# Example:
[69] Fix | Delete
# /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
[70] Fix | Delete
# <list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
[71] Fix | Delete
# <element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
[72] Fix | Delete
# <conf-file-name> = /etc/conf.d/keymaps
[73] Fix | Delete
# <map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
[74] Fix | Delete
# <mapping> = KEYMAP
[75] Fix | Delete
# <src-var> = KEYMAP
[76] Fix | Delete
# <mapping> = extended_keymaps-EXT_KEYMAPS
[77] Fix | Delete
# <src-var> = extended_keymaps
[78] Fix | Delete
# <dst-var> = EXT_KEYMAPS
[79] Fix | Delete
gather_vars() {
[80] Fix | Delete
local item map value
[81] Fix | Delete
[82] Fix | Delete
for item in $@
[83] Fix | Delete
do
[84] Fix | Delete
item=(${item/:/ })
[85] Fix | Delete
for map in ${item[1]//,/ }
[86] Fix | Delete
do
[87] Fix | Delete
map=(${map//-/ })
[88] Fix | Delete
if [[ -f "${item[0]}" ]]; then
[89] Fix | Delete
value=$(grep "^${map[0]}=" "${item[0]}")
[90] Fix | Delete
value=${value#*=}
[91] Fix | Delete
echo "${map[1]:-${map[0]}}=${value}"
[92] Fix | Delete
fi
[93] Fix | Delete
done
[94] Fix | Delete
done
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
install_base() {
[98] Fix | Delete
inst_multiple setfont loadkeys kbd_mode stty
[99] Fix | Delete
[100] Fix | Delete
if ! dracut_module_included "systemd"; then
[101] Fix | Delete
inst ${moddir}/console_init.sh /lib/udev/console_init
[102] Fix | Delete
inst_rules ${moddir}/10-console.rules
[103] Fix | Delete
inst_hook cmdline 20 "${moddir}/parse-i18n.sh"
[104] Fix | Delete
fi
[105] Fix | Delete
[106] Fix | Delete
if [[ ${kbddir} != "/usr/share" ]]; then
[107] Fix | Delete
inst_dir /usr/share
[108] Fix | Delete
for _src in $(eval echo {${KBDSUBDIRS}}); do
[109] Fix | Delete
[ ! -e "${initdir}/usr/share/${_src}" ] && ln -s "${kbddir}/${_src}" "${initdir}/usr/share/${_src}"
[110] Fix | Delete
done
[111] Fix | Delete
fi
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
install_all_kbd() {
[115] Fix | Delete
local rel f
[116] Fix | Delete
[117] Fix | Delete
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
[118] Fix | Delete
inst_dir "$_src"
[119] Fix | Delete
$DRACUT_CP -L -t "${initdir}/${_src}" "$_src"/*
[120] Fix | Delete
done
[121] Fix | Delete
[122] Fix | Delete
# remove unnecessary files
[123] Fix | Delete
rm -f -- "${initdir}${kbddir}/consoletrans/utflist"
[124] Fix | Delete
find "${initdir}${kbddir}/" -name README\* -delete
[125] Fix | Delete
find "${initdir}${kbddir}/" -name '*.gz' -print -quit \
[126] Fix | Delete
| while read line || [ -n "$line" ]; do
[127] Fix | Delete
inst_multiple gzip
[128] Fix | Delete
done
[129] Fix | Delete
[130] Fix | Delete
find "${initdir}${kbddir}/" -name '*.bz2' -print -quit \
[131] Fix | Delete
| while read line || [ -n "$line" ]; do
[132] Fix | Delete
inst_multiple bzip2
[133] Fix | Delete
done
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
install_local_i18n() {
[137] Fix | Delete
local map
[138] Fix | Delete
[139] Fix | Delete
eval $(gather_vars ${i18n_vars})
[140] Fix | Delete
[ -f $I18N_CONF ] && . $I18N_CONF
[141] Fix | Delete
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
[142] Fix | Delete
[143] Fix | Delete
shopt -q -s nocasematch
[144] Fix | Delete
if [[ ${UNICODE} ]]
[145] Fix | Delete
then
[146] Fix | Delete
if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
[147] Fix | Delete
then
[148] Fix | Delete
UNICODE=1
[149] Fix | Delete
elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
[150] Fix | Delete
then
[151] Fix | Delete
UNICODE=0
[152] Fix | Delete
else
[153] Fix | Delete
UNICODE=''
[154] Fix | Delete
fi
[155] Fix | Delete
fi
[156] Fix | Delete
if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
[157] Fix | Delete
then
[158] Fix | Delete
UNICODE=1
[159] Fix | Delete
fi
[160] Fix | Delete
shopt -q -u nocasematch
[161] Fix | Delete
[162] Fix | Delete
# Gentoo user may have KEYMAP set to something like "-u pl2",
[163] Fix | Delete
KEYMAP=${KEYMAP#-* }
[164] Fix | Delete
[165] Fix | Delete
# openSUSE user may have KEYMAP set to something like ".gz"
[166] Fix | Delete
KEYMAP=${KEYMAP/.gz/}
[167] Fix | Delete
[168] Fix | Delete
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
[169] Fix | Delete
# determines whether non-UNICODE or UNICODE version is used
[170] Fix | Delete
[171] Fix | Delete
if [[ ${KEYTABLE} ]]; then
[172] Fix | Delete
if [[ ${UNICODE} == 1 ]]; then
[173] Fix | Delete
[[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
[174] Fix | Delete
fi
[175] Fix | Delete
KEYMAP=${KEYTABLE}
[176] Fix | Delete
fi
[177] Fix | Delete
[178] Fix | Delete
# I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in
[179] Fix | Delete
# original redhat-i18n module. Anyway it won't hurt.
[180] Fix | Delete
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
[181] Fix | Delete
[182] Fix | Delete
[[ ${KEYMAP} ]] || {
[183] Fix | Delete
dinfo 'No KEYMAP configured.'
[184] Fix | Delete
return 1
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
findkeymap ${KEYMAP}
[188] Fix | Delete
[189] Fix | Delete
for map in ${EXT_KEYMAPS}
[190] Fix | Delete
do
[191] Fix | Delete
ddebug "Adding extra map: ${map}"
[192] Fix | Delete
findkeymap ${map}
[193] Fix | Delete
done
[194] Fix | Delete
[195] Fix | Delete
for keymap in ${KEYMAPS}; do
[196] Fix | Delete
inst_opt_decompress ${keymap}
[197] Fix | Delete
done
[198] Fix | Delete
[199] Fix | Delete
inst_opt_decompress ${kbddir}/consolefonts/${DEFAULT_FONT}.*
[200] Fix | Delete
[201] Fix | Delete
if [[ ${FONT} ]] && [[ ${FONT} != ${DEFAULT_FONT} ]]
[202] Fix | Delete
then
[203] Fix | Delete
FONT=${FONT%.psf*}
[204] Fix | Delete
inst_opt_decompress ${kbddir}/consolefonts/${FONT}.*
[205] Fix | Delete
fi
[206] Fix | Delete
[207] Fix | Delete
if [[ ${FONT_MAP} ]]
[208] Fix | Delete
then
[209] Fix | Delete
FONT_MAP=${FONT_MAP%.trans}
[210] Fix | Delete
# There are three different formats that setfont supports
[211] Fix | Delete
inst_simple ${kbddir}/consoletrans/${FONT_MAP} \
[212] Fix | Delete
|| inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans \
[213] Fix | Delete
|| inst_simple ${kbddir}/consoletrans/${FONT_MAP}_to_uni.trans \
[214] Fix | Delete
|| dwarn "Could not find FONT_MAP ${FONT_MAP}!"
[215] Fix | Delete
fi
[216] Fix | Delete
[217] Fix | Delete
if [[ ${FONT_UNIMAP} ]]
[218] Fix | Delete
then
[219] Fix | Delete
FONT_UNIMAP=${FONT_UNIMAP%.uni}
[220] Fix | Delete
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
[221] Fix | Delete
fi
[222] Fix | Delete
[223] Fix | Delete
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
[224] Fix | Delete
inst_simple ${I18N_CONF}
[225] Fix | Delete
else
[226] Fix | Delete
mksubdirs ${initdir}${I18N_CONF}
[227] Fix | Delete
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
[228] Fix | Delete
fi
[229] Fix | Delete
[230] Fix | Delete
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
[231] Fix | Delete
inst_simple ${VCONFIG_CONF}
[232] Fix | Delete
else
[233] Fix | Delete
mksubdirs ${initdir}${VCONFIG_CONF}
[234] Fix | Delete
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
[235] Fix | Delete
fi
[236] Fix | Delete
[237] Fix | Delete
return 0
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
checks() {
[241] Fix | Delete
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
[242] Fix | Delete
do
[243] Fix | Delete
[[ -d "${kbddir}" ]] && \
[244] Fix | Delete
for dir in ${KBDSUBDIRS//,/ }
[245] Fix | Delete
do
[246] Fix | Delete
[[ -d "${kbddir}/${dir}" ]] && continue
[247] Fix | Delete
false
[248] Fix | Delete
done && break
[249] Fix | Delete
kbddir=''
[250] Fix | Delete
done
[251] Fix | Delete
[252] Fix | Delete
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
[253] Fix | Delete
[[ ! ${hostonly} || ${i18n_vars} ]] || {
[254] Fix | Delete
derror 'i18n_vars not set! Please set up i18n_vars in ' \
[255] Fix | Delete
'configuration file.'
[256] Fix | Delete
}
[257] Fix | Delete
return 0
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
if checks; then
[261] Fix | Delete
install_base
[262] Fix | Delete
[263] Fix | Delete
if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} == "yes" ]]; then
[264] Fix | Delete
install_local_i18n || install_all_kbd
[265] Fix | Delete
else
[266] Fix | Delete
install_all_kbd
[267] Fix | Delete
fi
[268] Fix | Delete
fi
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function