diff --git a/init.d/Makefile.Linux b/init.d/Makefile.Linux index 653913cb..0e476b57 100644 --- a/init.d/Makefile.Linux +++ b/init.d/Makefile.Linux @@ -1,5 +1,5 @@ SRCS+= hwclock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ - procfs.in + procfs.in termencoding.in .SUFFIXES: .Linux.in .Linux.in: diff --git a/init.d/consolefont.in b/init.d/consolefont.in index a30961e4..c8ec311b 100644 --- a/init.d/consolefont.in +++ b/init.d/consolefont.in @@ -6,8 +6,7 @@ description="Sets a font for the consoles." depend() { - need localmount - need keymaps # sets up terminal encoding scheme + need localmount termencoding after hotplug keyword noopenvz noprefix nouml novserver noxenu } @@ -34,7 +33,7 @@ start() return 0 fi - local x= param= sf_param= retval=0 ttydev= + local x= param= sf_param= retval=0 ttydev=/dev/tty # Get additional parameters if [ -n "${consoletranslation}" ]; then @@ -46,10 +45,7 @@ start() # Set the console font ebegin "Setting user font" - [ -d /dev/vc ] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - + [ -d /dev/vc ] && ttydev=/dev/vc/ x=1 while [ ${x} -le ${ttyn} ]; do setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null @@ -61,17 +57,17 @@ start() # Store the last font so we can use it ASAP on boot if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then mkdir -p "${RC_LIBDIR}"/console - for font in /usr/share/consolefonts/"${consolefont}".*; do : done cp "${font}" "${RC_LIBDIR}"/console echo "${font##*/}" > "${RC_LIBDIR}"/console/font if yesno ${unicode:-${UNICODE}}; then - cp /dev/null "${RC_LIBDIR}"/console/unicode + echo "" > "${RC_LIBDIR}"/console/unicode else rm -f "${RC_LIBDIR}"/console/unicode fi + fi return ${retval} diff --git a/init.d/keymaps.in b/init.d/keymaps.in index 2079e049..1c2c6f59 100644 --- a/init.d/keymaps.in +++ b/init.d/keymaps.in @@ -14,7 +14,7 @@ dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}} depend() { - need localmount + need localmount termencoding keyword noopenvz noprefix nouml novserver noxenu } @@ -25,43 +25,41 @@ start() return 1 fi - local ttydev= n= - [ -d /dev/vc ] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty + local ttydev=/dev/tty n= + [ -d /dev/vc ] && ttydev=/dev/vc/ # Force linux keycodes for PPC. if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes fi - ebegin "Loading key mappings" - local loadkeys_uni= wkeys= - yesno ${unicode} && loadkeys_uni="--unicode" + ebegin "Loading key mappings (${keymap})" + local loadkeys_uni= wkeys= kmode="-a" msg="ASCII" + if yesno ${unicode}; then + loadkeys_uni="--unicode" + kmode="-u" + msg="UTF-8" + fi yesno ${windowskeys} && wkeys="windowkeys" loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} eend $? "Error loading key mappings" || return $? if yesno ${fix_euro}; then + ebegin "Fixing font for euro symbol" # Fix some fonts displaying the Euro, #173528. echo "altgr keycode 18 = U+20AC" | loadkeys -q + eend $? fi # Set terminal encoding to either ASCII or UNICODE. # See utf-8(7) for more information. - local termencoding="%@" termmsg="ASCII" kmode="-a" + ebegin "Setting keyboard mode to ${msg}" if yesno ${unicode}; then dumpkeys ${dumpkeys_charset:+-c} \ ${dumpkeys_charset} | loadkeys --unicode - termencoding="%G" - termmsg="UTF-8" - kmode="-u" fi - - ebegin "Setting terminal encoding to" ${termmsg} n=1 while [ ${n} -le "${ttyn}" ]; do - printf "\033%s" "${termencoding}" >"${ttydev}${n}" kbd_mode "${kmode}" -C "${ttydev}${n}" n=$((${n} + 1)) done diff --git a/init.d/termencoding.in b/init.d/termencoding.in new file mode 100644 index 00000000..bdae8362 --- /dev/null +++ b/init.d/termencoding.in @@ -0,0 +1,35 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2008 Roy Marples +# All rights reserved. Released under the 2-clause BSD license. + +description="Configures terminal encoding." + +ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} +unicode=${unicode:-${UNICODE}} + +depend() +{ + keyword noopenvz noprefix nouml novserver noxenu +} + +start() +{ + local ttydev=/dev/tty n= + [ -d /dev/vc ] && ttydev=/dev/vc/ + + # Set terminal encoding to either ASCII or UNICODE. + # See utf-8(7) for more information. + local termencoding="%@" termmsg="ASCII" + if yesno ${unicode}; then + termencoding="%G" + termmsg="UTF-8" + fi + + ebegin "Setting terminal encoding to ${termmsg}" + n=1 + while [ ${n} -le "${ttyn}" ]; do + printf "\033%s" "${termencoding}" >"${ttydev}${n}" + n=$((${n} + 1)) + done + eend 0 +} diff --git a/runlevels/Makefile.Linux b/runlevels/Makefile.Linux index 1aa23f96..f9a32044 100644 --- a/runlevels/Makefile.Linux +++ b/runlevels/Makefile.Linux @@ -1,2 +1,3 @@ -BOOT+= hwclock consolefont keymaps modules mtab net.lo procfs +BOOT+= hwclock consolefont keymaps modules mtab net.lo procfs \ + termencoding DEFAULT+= hdparm