Fix var names

This commit is contained in:
Roy Marples 2007-11-23 22:23:20 +00:00
parent 168fa73a49
commit 206f7096e0
5 changed files with 61 additions and 69 deletions

View File

@ -1,19 +1,19 @@
# /etc/conf.d/consolefont # /etc/conf.d/consolefont
# CONSOLEFONT specifies the default font that you'd like Linux to use on the # consolefont specifies the default font that you'd like Linux to use on the
# console. You can find a good selection of fonts in /usr/share/consolefonts; # console. You can find a good selection of fonts in /usr/share/consolefonts;
# you shouldn't specify the trailing ".psf.gz", just the font name below. # you shouldn't specify the trailing ".psf.gz", just the font name below.
# To use the default console font, comment out the CONSOLEFONT setting below. # To use the default console font, comment out the CONSOLEFONT setting below.
# This setting is used by the /etc/init.d/consolefont script (NOTE: if you do # This setting is used by the /etc/init.d/consolefont script (NOTE: if you do
# not want to use it, run "rc-update del consolefont" as root). # not want to use it, run "rc-update del consolefont" as root).
CONSOLEFONT="default8x16" consolefont="default8x16"
# CONSOLETRANSLATION is the charset map file to use. Leave commented to use # consoletranslation is the charset map file to use. Leave commented to use
# the default one. Have a look in /usr/share/consoletrans for a selection of # the default one. Have a look in /usr/share/consoletrans for a selection of
# map files you can use. # map files you can use.
#CONSOLETRANSLATION="8859-1_to_uni" #consoletranslation="8859-1_to_uni"
# UNICODEMAP is the unicode map file to use. Leave commented to use the # unicodemap is the unicode map file to use. Leave commented to use the
# default one. Have a look in /usr/share/unimaps for a selection of map files # default one. Have a look in /usr/share/unimaps for a selection of map files
# you can use. # you can use.
#UNICODEMAP="iso01" #unicodemap="iso01"

View File

@ -2,31 +2,22 @@
# Use KEYMAP to specify the default console keymap. There is a complete tree # Use KEYMAP to specify the default console keymap. There is a complete tree
# of keymaps in /usr/share/keymaps to choose from. # of keymaps in /usr/share/keymaps to choose from.
keymap="us"
KEYMAP="us"
# Should we first load the 'windowkeys' console keymap? Most x86 users will # Should we first load the 'windowkeys' console keymap? Most x86 users will
# say "yes" here. Note that non-x86 users should leave it as "no". # say "yes" here. Note that non-x86 users should leave it as "no".
windowkeys="no"
SET_WINDOWKEYS="no"
# The maps to load for extended keyboards. Most users will leave this as is. # The maps to load for extended keyboards. Most users will leave this as is.
extended_keymaps=""
EXTENDED_KEYMAPS="" #extended_keymaps="backspace keypad euro2"
#EXTENDED_KEYMAPS="backspace keypad euro2"
# Tell dumpkeys(1) to interpret character action codes to be # Tell dumpkeys(1) to interpret character action codes to be
# from the specified character set. # from the specified character set.
# This only matters if you set UNICODE="yes" in /etc/rc.conf. # This only matters if you set unicode="yes" in /etc/rc.conf.
# For a list of valid sets, run `dumpkeys --help` # For a list of valid sets, run `dumpkeys --help`
dumpkeys_charset=""
DUMPKEYS_CHARSET=""
# Some fonts map AltGr-E to the currency symbol ¤ instead of the Euro € # Some fonts map AltGr-E to the currency symbol ¤ instead of the Euro €
# To fix this, set to "yes" # To fix this, set to "yes"
fix_euro="no"
FIX_EURO="no"

View File

@ -37,17 +37,22 @@ start() {
rm -rf "${RC_LIBDIR}"/console rm -rf "${RC_LIBDIR}"/console
case "${RC_SYS}" in case "${RC_SYS}" in
UML|VPS|XEN) return 0 ;; UML|VPS|XEN) return 0;;
esac esac
if [ -z "${CONSOLEFONT}" ] ; then ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
ebegin $"Using the default console font" consolefont=${consolefont:-${CONSOLEFONT}}
unicodemap=${unicodemap:-${UNICODEMAP}}
consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}}
if [ -z "${consolefont}" ]; then
ebegin "Using the default console font"
eend 0 eend 0
return 0 return 0
fi fi
if [ ${RC_TTY_NUMBER} -eq 0 ] ; then if [ "${ttyn}" = 0 ]; then
ebegin "Skipping font setup (RC_TTY_NUMBER == 0); you should disable this init.d" ebegin "Skipping font setup (rc_tty_number == 0); you should disable this init.d"
eend 0 eend 0
return 0 return 0
fi fi
@ -55,11 +60,11 @@ start() {
local x= param= sf_param= retval=1 local x= param= sf_param= retval=1
# Get additional parameters # Get additional parameters
if [ -n "${CONSOLETRANSLATION}" ] ; then if [ -n "${consoletranslation}" ]; then
param="${param} -m ${CONSOLETRANSLATION}" param="${param} -m ${consoletranslation}"
fi fi
if [ -n "${UNICODEMAP}" ] ; then if [ -n "${unicodemap}" ]; then
param="${param} -u ${UNICODEMAP}" param="${param} -u ${unicodemap}"
fi fi
# Set the console font # Set the console font
@ -70,7 +75,7 @@ start() {
if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \ if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
[ -n "$(setfont --help 2>&1 | grep -e '-C')" ] [ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
then then
if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] ; then if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ]; then
sf_param="--tty=" sf_param="--tty="
else else
sf_param="-C " sf_param="-C "
@ -81,14 +86,14 @@ start() {
|| ttydev=/dev/tty || ttydev=/dev/tty
x=1 x=1
while [ ${x} -le "${RC_TTY_NUMBER}" ] ; do while [ ${x} -le ${ttyn} ]; do
/bin/setfont ${CONSOLEFONT} ${param} \ /bin/setfont ${consolefont} ${param} \
${sf_param}/${ttydev}${x} > /dev/null ${sf_param}/${ttydev}${x} > /dev/null
retval=$? retval=$?
x=$((${x} + 1)) x=$((${x} + 1))
done done
else else
/bin/setfont ${CONSOLEFONT} ${param} > /dev/null /bin/setfont ${consolefont} ${param} > /dev/null
retval=$? retval=$?
fi fi
errmsg="Failed to set user font" errmsg="Failed to set user font"
@ -99,14 +104,14 @@ start() {
eend ${retval} "${errmsg}" eend ${retval} "${errmsg}"
# Store the last font so we can use it ASAP on boot # Store the last font so we can use it ASAP on boot
if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ] ; then if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then
mkdir -p "${RC_LIBDIR}"/console mkdir -p "${RC_LIBDIR}"/console
for font in /usr/share/consolefonts/"${CONSOLEFONT}".* ; do : ; done for font in /usr/share/consolefonts/"${consolefont}".*; do :; done
cp "${font}" "${RC_LIBDIR}"/console cp "${font}" "${RC_LIBDIR}"/console
echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font
if [ "${UNICODE}" = "yes" ] ; then if yesno ${unicode:-${UNICODE}} ; then
echo > "${RC_LIBDIR}"/console/unicode printf "" > "${RC_LIBDIR}"/console/unicode
else else
rm -f "${RC_LIBDIR}"/console/unicode rm -f "${RC_LIBDIR}"/console/unicode
fi fi

View File

@ -26,22 +26,18 @@
description="Applies a keymap for the consoles." description="Applies a keymap for the consoles."
ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12}
unicode=${unicode:-${UNICODE}}
keymap=${keymap:-${KEYMAP}}
extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}}
windowskeys=${windowskeys:-${SET_WINDOWSKEYS}}
fix_euro=${fix_euro:-${FIX_EURO}}
dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}}
depend() { depend() {
need localmount need localmount
} }
checkconfig() {
if [ -z "${KEYMAP}" ] ; then
eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first"
return 1
fi
# Make sure user isn't using rc.conf anymore
if grep -q "^KEYMAP=" /etc/rc.conf ; then
ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps"
fi
}
start() { start() {
case "${RC_SYS}" in case "${RC_SYS}" in
UML|VPS|XEN) UML|VPS|XEN)
@ -51,37 +47,39 @@ start() {
;; ;;
esac esac
local WINDOWKEYS_KEYMAP= LOADKEYS_UNI= if [ -z "${keymap}" ] ; then
eerror "You need to setup keymap in /etc/conf.d/keymaps first"
return 1
fi
local loadkeys_uni= wkeys=
local ttydev= n= local ttydev= n=
[ -d /dev/vc ] \ [ -d /dev/vc ] \
&& ttydev=/dev/vc/ \ && ttydev=/dev/vc/ \
|| ttydev=/dev/tty || ttydev=/dev/tty
checkconfig || return 1
# Force linux keycodes for PPC. # Force linux keycodes for PPC.
if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
fi fi
# Turn on unicode if user wants it # Turn on unicode if user wants it
if [ "${UNICODE}" = "yes" ]; then if yesno ${unicode}; then
n=1 n=1
while [ ${n} -le "${RC_TTY_NUMBER}" ]; do while [ ${n} -le "${ttyn}" ]; do
kbd_mode -u -C "${ttydev}${n}" kbd_mode -u -C "${ttydev}${n}"
n=$((${n} + 1)) n=$((${n} + 1))
done done
LOADKEYS_UNI="--unicode" loadkeys_uni="--unicode"
fi fi
ebegin "Loading key mappings" ebegin "Loading key mappings"
if [ -x /bin/loadkeys ] ; then if [ -x /bin/loadkeys ] ; then
[ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys" yesno ${windowskeys} && wkeys="windowkeys"
loadkeys -q ${LOADKEYS_UNI} ${WINDOWKEYS_KEYMAP} ${KEYMAP} \ loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps}
${EXTENDED_KEYMAPS}
eend $? "Error loading key mappings" eend $? "Error loading key mappings"
if [ "${FIX_EURO}" = "yes" ] ; then if yesno ${fix_euro}; then
# Fix some fonts displaying the Euro, #173528. # Fix some fonts displaying the Euro, #173528.
echo "altgr keycode 18 = U+20AC" | loadkeys -q echo "altgr keycode 18 = U+20AC" | loadkeys -q
fi fi
@ -93,11 +91,8 @@ start() {
# Set terminal encoding to either ASCII or UNICODE. # Set terminal encoding to either ASCII or UNICODE.
# See utf-8(7) for more information. # See utf-8(7) for more information.
local termencoding= termmsg= local termencoding= termmsg=
if [ "${UNICODE}" = "yes" ] ; then if yesno ${unicode}; then
local dumpkey_opts= dumpkeys ${dumpkeys_charset:+-c} ${dumpkeys_charset} | loadkeys --unicode
[ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
dumpkeys ${dumpkey_opts} | loadkeys --unicode
termencoding="%G" termencoding="%G"
termmsg="UTF-8" termmsg="UTF-8"
else else
@ -107,12 +102,11 @@ start() {
ebegin "Setting terminal encoding to" ${termmsg} ebegin "Setting terminal encoding to" ${termmsg}
n=1 n=1
while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do while [ ${n} -le "${ttyn}" ]; do
printf "\033%s" "${termencoding}" >"${ttydev}${n}" printf "\033%s" "${termencoding}" >"${ttydev}${n}"
n=$((${n} + 1)) n=$((${n} + 1))
done done
eend 0 eend 0
} }
# vim:ts=4 # vim:ts=4

View File

@ -26,6 +26,8 @@
description="Turns numlock on for the consoles." description="Turns numlock on for the consoles."
ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12}
depend() { depend() {
need localmount need localmount
} }
@ -36,7 +38,7 @@ _setleds() {
local dev=/dev/tty t= i=1 retval=0 local dev=/dev/tty t= i=1 retval=0
[ -d /dev/vc ] && dev=/dev/vc/ [ -d /dev/vc ] && dev=/dev/vc/
while [ ${i} -le ${RC_TTY_NUMBER:-11} ] ; do while [ ${i} -le ${ttyn} ] ; do
setleds -D "$1"num < ${dev}${i} || retval=1 setleds -D "$1"num < ${dev}${i} || retval=1
i=$((${i} + 1)) i=$((${i} + 1))
done done