Accepting request 57985 from home:lnussel:branches:Base:System
OBS-URL: https://build.opensuse.org/request/show/57985 OBS-URL: https://build.opensuse.org/package/show/Base:System/kbd?expand=0&rev=23
This commit is contained in:
parent
d3dd789299
commit
4360c9b4fa
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 12 14:22:09 UTC 2011 - lnussel@suse.de
|
||||||
|
|
||||||
|
- use /etc/defkeymap.name if possible to avoid find call
|
||||||
|
- move some code that is only needed for start to actual start section
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Sep 7 14:48:34 CEST 2010 - anicka@suse.cz
|
Tue Sep 7 14:48:34 CEST 2010 - anicka@suse.cz
|
||||||
|
|
||||||
|
153
kbd.init
153
kbd.init
@ -37,76 +37,14 @@
|
|||||||
|
|
||||||
test -n "$KBD_VERBOSE" && set -x
|
test -n "$KBD_VERBOSE" && set -x
|
||||||
|
|
||||||
|
# XXX: is this really needed just for LOCALE_CHARMAP?
|
||||||
test -e /etc/SuSEconfig/profile && . /etc/SuSEconfig/profile
|
test -e /etc/SuSEconfig/profile && . /etc/SuSEconfig/profile
|
||||||
test -e /etc/profile.d/lang.sh && . /etc/profile.d/lang.sh
|
test -e /etc/profile.d/lang.sh && . /etc/profile.d/lang.sh
|
||||||
LOCALE_CHARMAP=`locale charmap`
|
LOCALE_CHARMAP=`locale charmap`
|
||||||
LC_ALL=POSIX
|
LC_ALL=POSIX
|
||||||
|
|
||||||
MACHINE=`/bin/uname -m 2> /dev/null`
|
|
||||||
if test "$MACHINE" = "sparc" -o "$MACHINE" = "sparc64" ; then
|
|
||||||
# Test if we have a serial console.
|
|
||||||
(test -c /dev/tty1 && > /dev/tty1 ) > /dev/null 2>&1 || exit 0
|
|
||||||
fi
|
|
||||||
# iSeries machines also exit, just a little further down...
|
|
||||||
|
|
||||||
# The variable NON_SUSE_KERNEL determines whether we need to chvt
|
|
||||||
# to a console before some console settings apply.
|
|
||||||
# We have no magic to find out about this (at boot time), so we
|
|
||||||
# leave it to the user to read this comment and put NON_SUSE_KERNEL="yes"
|
|
||||||
# into /etc/sysconfig/console
|
|
||||||
|
|
||||||
test "$NON_SUSE_KERNEL" = "yes" && FGCONS=`/bin/fgconsole`
|
|
||||||
|
|
||||||
KBDBASE="/usr/share/kbd"
|
KBDBASE="/usr/share/kbd"
|
||||||
|
|
||||||
#
|
|
||||||
# first search the wanted keytable.
|
|
||||||
#
|
|
||||||
if test $MACHINE = ppc -o $MACHINE = ppc64 ; then
|
|
||||||
test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
|
|
||||||
while read line; do
|
|
||||||
case "$line" in
|
|
||||||
*MacRISC*) MACHINE="mac"
|
|
||||||
test -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes && \
|
|
||||||
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
|
||||||
;;
|
|
||||||
*CHRP*) MACHINE="chrp";;
|
|
||||||
*PReP*) MACHINE="prep" ;;
|
|
||||||
*PS3*) MACHINE="ps3" ;;
|
|
||||||
*iSeries*) exit 0 ;;
|
|
||||||
esac
|
|
||||||
done < /proc/cpuinfo
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Calculate KBD_TTY array only once
|
|
||||||
#
|
|
||||||
|
|
||||||
KBD_TTY_DEFAULT="${KBD_TTY:-tty1 tty2 tty3 tty4 tty5 tty6}"
|
|
||||||
|
|
||||||
newkbd=""
|
|
||||||
for tty in $KBD_TTY_DEFAULT; do
|
|
||||||
# >=tty7 left out intentionaly (Bug #302010)
|
|
||||||
test ${tty#tty} -ge 7 2>/dev/null && continue
|
|
||||||
test -w /dev/$tty || continue
|
|
||||||
test -c /dev/$tty || continue
|
|
||||||
> /dev/$tty &> /dev/null || continue
|
|
||||||
newkbd="${newkbd:+$newkbd }/dev/$tty"
|
|
||||||
done
|
|
||||||
KBD_TTY="$newkbd"
|
|
||||||
unset newkbd
|
|
||||||
|
|
||||||
KEYMAP=()
|
|
||||||
if test -e /$KEYTABLE ; then
|
|
||||||
KEYMAP=($KEYTABLE)
|
|
||||||
else
|
|
||||||
case "$KEYTABLE" in
|
|
||||||
*.gz) KBDPATH="*/${KEYTABLE}" ;;
|
|
||||||
*.map) KBDPATH="*/${KEYTABLE} */${KEYTABLE}.gz" ;;
|
|
||||||
*) KBDPATH="*/${KEYTABLE} */${KEYTABLE}.gz */${KEYTABLE}.map.gz */${KEYTABLE}.map" ;;
|
|
||||||
esac
|
|
||||||
KEYMAP=($(find ${KBDBASE}/keymaps -type f \( -path ${KBDPATH// / -o -path } \) | sort))
|
|
||||||
fi
|
|
||||||
#
|
#
|
||||||
# setup kbdrate and led status
|
# setup kbdrate and led status
|
||||||
#
|
#
|
||||||
@ -228,6 +166,80 @@ case "$1" in
|
|||||||
test -s /var/run/keymap && exit 0
|
test -s /var/run/keymap && exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
MACHINE=`/bin/uname -m 2> /dev/null`
|
||||||
|
if test "$MACHINE" = "sparc" -o "$MACHINE" = "sparc64" ; then
|
||||||
|
# Test if we have a serial console.
|
||||||
|
(test -c /dev/tty1 && > /dev/tty1 ) > /dev/null 2>&1 || exit 0
|
||||||
|
fi
|
||||||
|
# iSeries machines also exit, just a little further down...
|
||||||
|
|
||||||
|
# The variable NON_SUSE_KERNEL determines whether we need to chvt
|
||||||
|
# to a console before some console settings apply.
|
||||||
|
# We have no magic to find out about this (at boot time), so we
|
||||||
|
# leave it to the user to read this comment and put NON_SUSE_KERNEL="yes"
|
||||||
|
# into /etc/sysconfig/console
|
||||||
|
|
||||||
|
test "$NON_SUSE_KERNEL" = "yes" && FGCONS=`/bin/fgconsole`
|
||||||
|
|
||||||
|
#
|
||||||
|
# first search the wanted keytable.
|
||||||
|
#
|
||||||
|
if test $MACHINE = ppc -o $MACHINE = ppc64 ; then
|
||||||
|
test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
|
||||||
|
while read line; do
|
||||||
|
case "$line" in
|
||||||
|
*MacRISC*) MACHINE="mac"
|
||||||
|
test -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes && \
|
||||||
|
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
||||||
|
;;
|
||||||
|
*CHRP*) MACHINE="chrp";;
|
||||||
|
*PReP*) MACHINE="prep" ;;
|
||||||
|
*PS3*) MACHINE="ps3" ;;
|
||||||
|
*iSeries*) exit 0 ;;
|
||||||
|
esac
|
||||||
|
done < /proc/cpuinfo
|
||||||
|
fi
|
||||||
|
|
||||||
|
KBD_TTY_DEFAULT="${KBD_TTY:-tty1 tty2 tty3 tty4 tty5 tty6}"
|
||||||
|
|
||||||
|
newkbd=""
|
||||||
|
for tty in $KBD_TTY_DEFAULT; do
|
||||||
|
# >=tty7 left out intentionaly (Bug #302010)
|
||||||
|
test ${tty#tty} -ge 7 2>/dev/null && continue
|
||||||
|
test -w /dev/$tty || continue
|
||||||
|
test -c /dev/$tty || continue
|
||||||
|
> /dev/$tty &> /dev/null || continue
|
||||||
|
newkbd="${newkbd:+$newkbd }/dev/$tty"
|
||||||
|
done
|
||||||
|
KBD_TTY="$newkbd"
|
||||||
|
unset newkbd
|
||||||
|
|
||||||
|
KEYMAP=()
|
||||||
|
if test -r /etc/defkeymap.name; then
|
||||||
|
read cached < /etc/defkeymap.name
|
||||||
|
a="${cached##*/}"
|
||||||
|
a="${a%.gz}"
|
||||||
|
a="${a%.map}"
|
||||||
|
b="${KEYTABLE%.gz}"
|
||||||
|
b="${b%.map}"
|
||||||
|
if [ -n "$a" -a "$a" = "$b" ]; then
|
||||||
|
KEYMAP=("$cached")
|
||||||
|
fi
|
||||||
|
unset a b
|
||||||
|
fi
|
||||||
|
if test -z "$KEYMAP"; then
|
||||||
|
if test -e /$KEYTABLE ; then
|
||||||
|
KEYMAP=($KEYTABLE)
|
||||||
|
else
|
||||||
|
case "$KEYTABLE" in
|
||||||
|
*.gz) KBDPATH="*/${KEYTABLE}" ;;
|
||||||
|
*.map) KBDPATH="*/${KEYTABLE} */${KEYTABLE}.gz" ;;
|
||||||
|
*) KBDPATH="*/${KEYTABLE} */${KEYTABLE}.gz */${KEYTABLE}.map.gz */${KEYTABLE}.map" ;;
|
||||||
|
esac
|
||||||
|
KEYMAP=($(find ${KBDBASE}/keymaps -type f \( -path ${KBDPATH// / -o -path } \) | sort))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$MACHINE" = "ps3" ; then
|
if test "$MACHINE" = "ps3" ; then
|
||||||
# do not mess up console
|
# do not mess up console
|
||||||
@ -283,7 +295,6 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test -z "$KEYTABLE"; then
|
if test -z "$KEYTABLE"; then
|
||||||
echo "No keyboard map to load"
|
echo "No keyboard map to load"
|
||||||
else
|
else
|
||||||
@ -413,27 +424,29 @@ case "$1" in
|
|||||||
case "$RUNLEVEL" in
|
case "$RUNLEVEL" in
|
||||||
S|N|1|\#) true ;;
|
S|N|1|\#) true ;;
|
||||||
*)
|
*)
|
||||||
trap "rm -f /dev/shm/defkeymap.map" EXIT SIGTERM
|
map=`mktemp --tmpdir keymap.XXXXXX` && {
|
||||||
|
trap "rm -f $map" EXIT SIGTERM
|
||||||
if test -n "$KBD_TTY" ; then
|
if test -n "$KBD_TTY" ; then
|
||||||
dumpkeys -C ${KBD_TTY%% *}
|
dumpkeys -C ${KBD_TTY%% *}
|
||||||
else
|
else
|
||||||
dumpkeys
|
dumpkeys
|
||||||
fi > /dev/shm/defkeymap.map
|
fi > $map
|
||||||
|
|
||||||
if type -p cmp > /dev/null 2>&1 && cmp -s /etc/defkeymap.map /dev/shm/defkeymap.map
|
if type -p cmp > /dev/null 2>&1 && cmp -s /etc/defkeymap.map $map
|
||||||
then
|
then
|
||||||
rm -f /dev/shm/defkeymap.map
|
rm -f $map
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -s /dev/shm/defkeymap.map ; then
|
if test -s $map; then
|
||||||
# FIXME: this should be done much earlier
|
# FIXME: this should be done much earlier
|
||||||
# to avoid bugzilla# 259694 or similar.
|
# to avoid bugzilla# 259694 or similar.
|
||||||
mv /dev/shm/defkeymap.map /etc/defkeymap.map
|
mv $map /etc/defkeymap.map
|
||||||
if test "${#KEYMAP[@]}" -gt 0 -a "$KEYMAP" != "/etc/defkeymap.map" ; then
|
if test "${#KEYMAP[@]}" -gt 0 -a "$KEYMAP" != "/etc/defkeymap.map" ; then
|
||||||
echo $KEYMAP > /etc/defkeymap.name
|
echo $KEYMAP > /etc/defkeymap.name
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
trap - EXIT SIGTERM
|
trap - EXIT SIGTERM
|
||||||
|
}
|
||||||
esac
|
esac
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -54,11 +54,11 @@ KBD_CAPSLOCK="no"
|
|||||||
KBD_DISABLE_CAPS_LOCK="no"
|
KBD_DISABLE_CAPS_LOCK="no"
|
||||||
|
|
||||||
## Type: string
|
## Type: string
|
||||||
## Default: "tty1 tty2 tty3 tty4 tty5 tty6"
|
## Default:
|
||||||
#
|
#
|
||||||
# ttys for the above settings
|
# ttys for the above settings
|
||||||
# Example: "tty1 tty2"
|
# Example: "tty1 tty2"
|
||||||
# "" for all tty's
|
# "" for tty's 1-6
|
||||||
#
|
#
|
||||||
KBD_TTY="tty1 tty2 tty3 tty4 tty5 tty6"
|
KBD_TTY=""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user