network: don't use "ifup -m"
[dracut.git] / modules.d / 10i18n / console_init.sh
blob2536f14dd44beeacd586380320e0173bd46abbb2
1 #!/bin/sh
3 [ -n "$DRACUT_SYSTEMD" ] && exit 0
5 if [ -x $systemdutildir/systemd-vconsole-setup ]; then
6 $systemdutildir/systemd-vconsole-setup "$@"
7 fi
9 [ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
11 DEFAULT_FONT=LatArCyrHeb-16
12 DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
14 set_keyboard() {
15 local param
17 [ "${UNICODE}" = 1 ] && param=-u || param=-a
18 kbd_mode ${param}
21 set_terminal() {
22 local dev=$1
24 if [ "${UNICODE}" = 1 ]; then
25 printf '\033%%G' >&7
26 stty -F ${dev} iutf8
27 else
28 printf '\033%%@' >&7
29 stty -F ${dev} -iutf8
33 set_keymap() {
34 local utf_switch
36 if [ -z "${KEYMAP}" ]; then
37 [ -f "${DEFAULT_KEYMAP}" ] && KEYMAP=${DEFAULT_KEYMAP}
40 [ -n "${KEYMAP}" ] || return 1
42 [ "${UNICODE}" = 1 ] && utf_switch=-u
44 loadkeys -q ${utf_switch} ${KEYMAP} ${EXT_KEYMAPS}
47 set_font() {
48 local dev=$1; local trans=''; local uni=''
50 [ -z "${FONT}" ] && FONT=${DEFAULT_FONT}
51 [ -n "${FONT_MAP}" ] && trans="-m ${FONT_MAP}"
52 [ -n "${FONT_UNIMAP}" ] && uni="-u ${FONT_UNIMAP}"
54 setfont ${FONT} -C ${dev} ${trans} ${uni}
57 dev_close() {
58 exec 6>&-
59 exec 7>&-
62 dev_open() {
63 local dev=$1
65 exec 6<${dev} && \
66 exec 7>>${dev}
69 dev=/dev/${1#/dev/}
70 devname=${dev#/dev/}
72 [ -c "${dev}" ] || {
73 echo "Usage: $0 device" >&2
74 exit 1
77 dev_open ${dev}
79 for fd in 6 7; do
80 if ! [ -t ${fd} ]; then
81 echo "ERROR: File descriptor not opened: ${fd}" >&2
82 dev_close
83 exit 1
85 done
87 set_keyboard
88 set_terminal ${dev}
89 set_font ${dev}
90 set_keymap
92 dev_close