diff options
Diffstat (limited to 'init.d.Linux')
-rwxr-xr-x | init.d.Linux/consolefont | 39 | ||||
-rwxr-xr-x | init.d.Linux/keymaps | 52 | ||||
-rwxr-xr-x | init.d.Linux/numlock | 4 |
3 files changed, 48 insertions, 47 deletions
diff --git a/init.d.Linux/consolefont b/init.d.Linux/consolefont index 21333fff..0fe7f98e 100755 --- a/init.d.Linux/consolefont +++ b/init.d.Linux/consolefont @@ -37,17 +37,22 @@ start() { rm -rf "${RC_LIBDIR}"/console case "${RC_SYS}" in - UML|VPS|XEN) return 0 ;; + UML|VPS|XEN) return 0;; esac - if [ -z "${CONSOLEFONT}" ] ; then - ebegin $"Using the default console font" + ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} + consolefont=${consolefont:-${CONSOLEFONT}} + unicodemap=${unicodemap:-${UNICODEMAP}} + consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}} + + if [ -z "${consolefont}" ]; then + ebegin "Using the default console font" eend 0 return 0 fi - if [ ${RC_TTY_NUMBER} -eq 0 ] ; then - ebegin "Skipping font setup (RC_TTY_NUMBER == 0); you should disable this init.d" + if [ "${ttyn}" = 0 ]; then + ebegin "Skipping font setup (rc_tty_number == 0); you should disable this init.d" eend 0 return 0 fi @@ -55,11 +60,11 @@ start() { local x= param= sf_param= retval=1 # Get additional parameters - if [ -n "${CONSOLETRANSLATION}" ] ; then - param="${param} -m ${CONSOLETRANSLATION}" + if [ -n "${consoletranslation}" ]; then + param="${param} -m ${consoletranslation}" fi - if [ -n "${UNICODEMAP}" ] ; then - param="${param} -u ${UNICODEMAP}" + if [ -n "${unicodemap}" ]; then + param="${param} -u ${unicodemap}" fi # Set the console font @@ -70,7 +75,7 @@ start() { if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \ [ -n "$(setfont --help 2>&1 | grep -e '-C')" ] then - if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] ; then + if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ]; then sf_param="--tty=" else sf_param="-C " @@ -81,14 +86,14 @@ start() { || ttydev=/dev/tty x=1 - while [ ${x} -le "${RC_TTY_NUMBER}" ] ; do - /bin/setfont ${CONSOLEFONT} ${param} \ + while [ ${x} -le ${ttyn} ]; do + /bin/setfont ${consolefont} ${param} \ ${sf_param}/${ttydev}${x} > /dev/null retval=$? x=$((${x} + 1)) done else - /bin/setfont ${CONSOLEFONT} ${param} > /dev/null + /bin/setfont ${consolefont} ${param} > /dev/null retval=$? fi errmsg="Failed to set user font" @@ -99,14 +104,14 @@ start() { eend ${retval} "${errmsg}" # 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 - for font in /usr/share/consolefonts/"${CONSOLEFONT}".* ; do : ; done + for font in /usr/share/consolefonts/"${consolefont}".*; do :; done cp "${font}" "${RC_LIBDIR}"/console echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font - if [ "${UNICODE}" = "yes" ] ; then - echo > "${RC_LIBDIR}"/console/unicode + if yesno ${unicode:-${UNICODE}} ; then + printf "" > "${RC_LIBDIR}"/console/unicode else rm -f "${RC_LIBDIR}"/console/unicode fi diff --git a/init.d.Linux/keymaps b/init.d.Linux/keymaps index 8548a170..9b3ce03f 100755 --- a/init.d.Linux/keymaps +++ b/init.d.Linux/keymaps @@ -26,22 +26,18 @@ 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() { 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() { case "${RC_SYS}" in UML|VPS|XEN) @@ -51,37 +47,39 @@ start() { ;; 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= [ -d /dev/vc ] \ && ttydev=/dev/vc/ \ || ttydev=/dev/tty - checkconfig || return 1 - # 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 # Turn on unicode if user wants it - if [ "${UNICODE}" = "yes" ]; then + if yesno ${unicode}; then n=1 - while [ ${n} -le "${RC_TTY_NUMBER}" ]; do + while [ ${n} -le "${ttyn}" ]; do kbd_mode -u -C "${ttydev}${n}" n=$((${n} + 1)) done - LOADKEYS_UNI="--unicode" + loadkeys_uni="--unicode" fi ebegin "Loading key mappings" if [ -x /bin/loadkeys ] ; then - [ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys" - loadkeys -q ${LOADKEYS_UNI} ${WINDOWKEYS_KEYMAP} ${KEYMAP} \ - ${EXTENDED_KEYMAPS} + yesno ${windowskeys} && wkeys="windowkeys" + loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} eend $? "Error loading key mappings" - if [ "${FIX_EURO}" = "yes" ] ; then + if yesno ${fix_euro}; then # Fix some fonts displaying the Euro, #173528. echo "altgr keycode 18 = U+20AC" | loadkeys -q fi @@ -93,11 +91,8 @@ start() { # Set terminal encoding to either ASCII or UNICODE. # See utf-8(7) for more information. local termencoding= termmsg= - if [ "${UNICODE}" = "yes" ] ; then - local dumpkey_opts= - [ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}" - - dumpkeys ${dumpkey_opts} | loadkeys --unicode + if yesno ${unicode}; then + dumpkeys ${dumpkeys_charset:+-c} ${dumpkeys_charset} | loadkeys --unicode termencoding="%G" termmsg="UTF-8" else @@ -107,12 +102,11 @@ start() { ebegin "Setting terminal encoding to" ${termmsg} n=1 - while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do + while [ ${n} -le "${ttyn}" ]; do printf "\033%s" "${termencoding}" >"${ttydev}${n}" n=$((${n} + 1)) done eend 0 } - # vim:ts=4 diff --git a/init.d.Linux/numlock b/init.d.Linux/numlock index 7bbd1314..5b2bca99 100755 --- a/init.d.Linux/numlock +++ b/init.d.Linux/numlock @@ -26,6 +26,8 @@ description="Turns numlock on for the consoles." +ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12} + depend() { need localmount } @@ -36,7 +38,7 @@ _setleds() { local dev=/dev/tty t= i=1 retval=0 [ -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 i=$((${i} + 1)) done |