SHA256
1
0
forked from pool/kbd

Accepting request 162636 from Base:System

- disable vlock build, which is in vlock package.

- Remove sysvinit support, init scripts from this package 
  are masked by systemd and only serve for confusion.

- sysconfig.keyboard: Updated description of KBD_NUMLOCK
  (bnc#746595#c74).

OBS-URL: https://build.opensuse.org/request/show/162636
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kbd?expand=0&rev=63
This commit is contained in:
Stephan Kulow 2013-04-05 05:32:47 +00:00 committed by Git OBS Bridge
commit 9251dce1b6
4 changed files with 23 additions and 491 deletions

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Apr 4 15:57:45 UTC 2013 - meissner@suse.com
- disable vlock build, which is in vlock package.
-------------------------------------------------------------------
Thu Apr 4 01:34:32 UTC 2013 - crrodriguez@opensuse.org
- Remove sysvinit support, init scripts from this package
are masked by systemd and only serve for confusion.
-------------------------------------------------------------------
Wed Apr 3 19:06:41 CEST 2013 - sbrabec@suse.cz
- sysconfig.keyboard: Updated description of KBD_NUMLOCK
(bnc#746595#c74).
-------------------------------------------------------------------
Wed Dec 5 20:45:40 UTC 2012 - dap.darkness@gmail.com

473
kbd.init
View File

@ -1,473 +0,0 @@
#! /bin/bash
# Copyright (c) 1995-2005 SUSE LINUX Products AG, Nuernberg, Germany.
#
# Author: Burchard Steinbild
# Werner Fink <werner@suse.de>
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/kbd
#
# and symbolic its link
#
# /sbin/rckbd
#
# Warning:
# /etc/init.d/earlykbd can run this script even if
# the Required-Start conditions listed here are not satisfied.
# Our use of $remote_fs is
# /usr/share/kbd - for finding keymaps
# /usr/sbin/hwinfo - for numlock from bios
#
### BEGIN INIT INFO
# Provides: kbd
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: fbset setserial
# Should-Stop: $null
# Default-Start: 1 2 3 5 S
# Default-Stop: 0 6
# X-Interactive: true
# Short-Description: Keyboard settings
# Description: Keyboard settings (don't disable!)
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/console
. /etc/sysconfig/keyboard
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/profile.d/lang.sh && . /etc/profile.d/lang.sh
LOCALE_CHARMAP=`locale charmap 2>/dev/null`
LC_ALL=POSIX
KBDBASE="/usr/share/kbd"
#
# setup kbdrate and led status
#
function set_kbdrate ()
{
local line
if test "$MACHINE" != "mac" ; then
KBDOPT=""
if test -n "$KBD_RATE" ; then
KBDOPT="${KBDOPT:+$KBDOPT }-r $KBD_RATE"
fi
if test -n "$KBD_DELAY"; then
KBDOPT="${KBDOPT:+$KBDOPT }-d $KBD_DELAY"
fi
if test -n "$KBDOPT" -a -x /bin/kbdrate ; then
echo -n "Keyboard: "
for tty in $KBD_TTY; do
/bin/kbdrate $KBDOPT < $tty 2> /dev/null
rc_status
case "$KBDOPT" in
*-s*) continue ;;
esac
KBDOPT="${KBDOPT:+$KBDOPT }-s"
done
rc_status -v1
fi
fi
# setleds
#
# Note: The file /var/run/numlock-on is used in ~/.xinitrc
# to reflect the correct numlock state choosen by the
# user even under X11
#
if test "$KBD_NUMLOCK" = "yes"; then
touch /var/run/numlock-on
elif test "$KBD_NUMLOCK" = "no"; then
rm -f /var/run/numlock-on
elif test "$KBD_NUMLOCK" = "bios"; then
if test -x /usr/sbin/hwinfo ; then
/usr/sbin/hwinfo --bios | \
while read line ; do
case "$line" in
Num\ Lock:\ on) touch /var/run/numlock-on ;;
Num\ Lock:\ off) rm -f /var/run/numlock-on ;;
Caps\ Lock:) break
esac
done
else
echo "no /usr/sbin -> Numlock off."
rm -f /var/run/numlock-on
fi
fi
unset line
#
# Only change keyboard leds if setleds is in path
#
type -p setleds &> /dev/null || return
if test -e /var/run/numlock-on ; then
LEDOPT="+num"
else
LEDOPT="-num"
fi
if test "$KBD_CAPSLOCK" = "yes"; then
LEDOPT="$LEDOPT +caps"
else
LEDOPT="$LEDOPT -caps"
fi
if test "$KBD_SCRLOCK" = "yes"; then
LEDOPT="$LEDOPT +scroll"
else
LEDOPT="$LEDOPT -scroll"
fi
#
# Only change keyboard leds if they will be switched
# on ... OR if they are switched on currently
#
if [[ $LEDOPT == *+* ]] ; then
touch /var/run/setleds-on
else
test -e /var/run/setleds-on || return
test -n "$LEDOPT" || return
rm -f /var/run/setleds-on
fi
for tty in $KBD_TTY; do
setleds -D $LEDOPT < $tty
done
}
function console_font_height ()
{
if test -x /sbin/fbtest && /sbin/fbtest -C $1 ; then
echo 16
else
set -- $(IFS=x /bin/showconsolefont -i -C $1 2> /dev/null)
if test -n "$2" ; then
echo $2
else
echo 8
fi
fi
}
#
rc_reset
case "$1" in
start|restart|reload|force-reload)
case "$1" in
start)
# don't do anything if we have this file.
# this means that initialization was already done.
# don't do it twice unless forced, it may annoy xdm and
# produce lots of error messages.
test -s /var/run/keymap -a "$RUNLEVEL" != S && exit 0
;;
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
# do not mess up console
unset CONSOLE_FONT
fi
# setfont
if test -d ${KBDBASE}/consolefonts -a \
-n "$CONSOLE_FONT" -a "$CONSOLE_FONT" != "YAST_ASK"
then
if test ! -z "$CONSOLE_UNICODEMAP"; then
UMAP="-u $CONSOLE_UNICODEMAP"
fi
if test ! -z "$CONSOLE_SCREENMAP"; then
SMAP="-m $CONSOLE_SCREENMAP"
fi
PRINTABLE_MAGIC="";
if test -n "$CONSOLE_MAGIC" -a "$CONSOLE_MAGIC" != "none"; then
case $CONSOLE_MAGIC in
\(B) PRINTABLE_MAGIC="G0:iso8859-1" ;;
\(0) PRINTABLE_MAGIC="G0:vt100" ;;
\(U) PRINTABLE_MAGIC="G0:ROM" ;;
\(K) PRINTABLE_MAGIC="G0:loadable" ;;
\)B) PRINTABLE_MAGIC="G1:iso8859-1" ;;
\)0) PRINTABLE_MAGIC="G1:vt100" ;;
\)U) PRINTABLE_MAGIC="G1:ROM" ;;
\)K) PRINTABLE_MAGIC="G1:loadable" ;;
*) PRINTABLE_MAGIC="magic='$CONSOLE_MAGIC'" ;;
esac
CONSOLE_MAGIC="\033$CONSOLE_MAGIC"
else
CONSOLE_MAGIC="";
fi
if test -x /bin/setfont -a -n "$CONSOLE_FONT" ; then
echo "Loading console font $CONSOLE_FONT $UMAP $SMAP $PRINTABLE_MAGIC"
for tty in $KBD_TTY; do
# The chvt is not needed for SuSE kernels
test "$NON_SUSE_KERNEL" != "yes" || chvt ${tty#*tty}
# Setfont tries to open a device
test "${tty##*/}" = "${tty}" && tty=/dev/$tty
if test "$CONSOLE_FONT" = "default" ; then
setfont -C $tty -$(console_font_height $tty) $UMAP $SMAP
else
setfont -C $tty $CONSOLE_FONT $UMAP $SMAP
fi
rc_status
echo -en "$CONSOLE_MAGIC" > $tty
done
test "$NON_SUSE_KERNEL" != "yes" || chvt $FGCONS
rc_status -v1
fi
fi
if test -z "$KEYTABLE"; then
echo "No keyboard map to load"
else
if test "${#KEYMAP[@]}" = 0 -o ! -d "$KBDBASE" ; then
if test -r /etc/defkeymap.map ; then
if test "${#KEYMAP[@]}" -gt 0; then
echo "$KEYMAP is unvailable, using /etc/defkeymap.map instead."
if test -r /var/run/keymap ; then
read cached < /etc/defkeymap.name
if test "$KEYMAP" != "$cached"; then
echo "Warning: fallback differs: $cached"
fi
fi
else
echo "Can not find a keymap for ${KEYTABLE}, trying fallback."
fi
KEYMAP=(/etc/defkeymap.map)
else
echo "Fallback /etc/defkeymap.map not there."
echo "Can not find a keymap for ${KEYTABLE}, Exit."
rc_failed
fi
else
if test "${#KEYMAP[@]}" -gt 1 ; then
echo "Found more than one keymap ${KEYTABLE}"
echo "Using $KEYMAP."
echo "If you want another one, please add complete path to"
echo "KEYTABLE in /etc/sysconfig/keyboard."
fi
fi
rc_status && retmsg="`loadkeys -C "$KBD_TTY" $KEYMAP 2>&1`"
if test $? -eq 0 && ( > /var/run/keymap ) > /dev/null 2>&1 ; then
echo "$KEYMAP" > /var/run/keymap
else
case "$RUNLEVEL" in
S|N|1|\#) true ;;
*) rc_failed ;;
esac
fi
echo "Loading keymap ${retmsg#Loading*${KBDBASE}/keymaps/}"
rc_status -v1
set_kbdrate
fi
# Disable CAPS LOCK key if wanted
if test "$KBD_DISABLE_CAPS_LOCK" = "yes"; then
loadkeys -C "$KBD_TTY" disable.capslock >/dev/null 2>&1 || echo "Could not disable Caps Lock"
fi
# Load compose tables
case "$RUNLEVEL" in
S|N|1|\#) COMPOSETABLE="" ;;
esac
if test ! -z "$COMPOSETABLE"; then
unset COMPOSELOADED COMPOSECLEAR
for name in $COMPOSETABLE; do
# Test for compose clear flag
if test "$name" = "-c" -o "$name" = "clear"; then
COMPOSECLEAR=-c
continue
fi
# Handle the first table differently ...
if test -z "$COMPOSELOADED"; then
echo -n "Loading compose table $name"
loadkeys -C "$KBD_TTY" $COMPOSECLEAR compose.$name >/dev/null 2>&1
rc_check
#if test $name = clear; then rc_reset; fi
COMPOSELOADED=1
else
echo -n " $name"
loadkeys -C "$KBD_TTY" compose.$name >/dev/null 2>&1
rc_check
fi
done
if test ! -z "$COMPOSELOADED"; then
rc_status -v
fi
fi
# Unicode mode
if test -x /bin/kbd_mode ; then
case $LOCALE_CHARMAP in
UTF-8)
echo Start Unicode mode
for tty in $KBD_TTY; do
# The chvt is not needed for SuSE kernels
test "$NON_SUSE_KERNEL" != "yes" || chvt ${tty#*tty}
# Tell the console output driver that the bytes
# arriving are UTF-8 encoded multibyte sequences.
echo -n -e '\033%G' > $tty
# Set the keyboard driver in Unicode mode.
# (Default is ASCII mode.)
# This really does nothing with the way normal
# keys are handled in the kernel. All it does is:
# - It is necessary for `dumpkeys' in order to
# not drop U+XXXX entries from the keymaps.
# - It is necessary for `loadkeys' in order to
# avoid warnings.
# - Unicode characters typed as Alt-x1 ... Alt-xn
# (where x1,...,xn are digits on the numeric keypad)
# will be emitted in UTF-8.
kbd_mode -u -C $tty
rc_status
done
;;
*)
echo Stop Unicode mode
for tty in $KBD_TTY; do
# The chvt is not needed for SuSE kernels
test "$NON_SUSE_KERNEL" != "yes" || chvt ${tty#*tty}
echo -n -e '\033%@' > $tty
kbd_mode -a -C $tty
rc_status
done
;;
esac
test "$NON_SUSE_KERNEL" != "yes" || chvt $FGCONS
rc_status -v1
fi
case "$RUNLEVEL" in
S|N|1|\#) true ;;
*)
map=`mktemp --tmpdir keymap.XXXXXX` && {
trap "rm -f $map" EXIT SIGTERM
if test -n "$KBD_TTY" ; then
dumpkeys -C ${KBD_TTY%% *}
else
dumpkeys
fi > $map
if type -p cmp > /dev/null 2>&1 && cmp -s /etc/defkeymap.map $map
then
rm -f $map
fi
if test -s $map; then
# FIXME: this should be done much earlier
# to avoid bugzilla# 259694 or similar.
mv $map /etc/defkeymap.map
if test "${#KEYMAP[@]}" -gt 0 -a "$KEYMAP" != "/etc/defkeymap.map" ; then
echo $KEYMAP > /etc/defkeymap.name
fi
fi
trap - EXIT SIGTERM
}
esac
;;
stop)
# enable start after stop.
echo -n "$0 stop"
rm -f /var/run/keymap
rc_status -v
;;
check|status)
if test -r /var/run/keymap ; then
read current < /var/run/keymap
echo "Keymap $current is loaded."
else
rc_failed 3
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status|check}"
exit 2
;;
esac
rc_exit

View File

@ -1,7 +1,7 @@
#
# spec file for package kbd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -32,7 +32,6 @@ Source: %{name}-%{version}-repack.tar.bz2
Source1: kbd_fonts.tar.bz2
Source2: suse-add.tar.bz2
Source3: README.SuSE
Source4: kbd.init
Source5: kbd.fillup
Source6: kbd.fillup.nonpc
Source8: sysconfig.console
@ -58,8 +57,6 @@ BuildRequires: flex
BuildRequires: pam-devel
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
Recommends: fbset
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -107,8 +104,9 @@ popd
--datadir=%{kbd} \
--enable-nls \
--localedir=/usr/share/locale \
--enable-optional-progs
make CFLAGS="%{optflags} -Os"
--enable-optional-progs \
--disable-vlock
make CFLAGS="%{optflags}"
gcc %{optflags} -o fbtest $RPM_SOURCE_DIR/fbtest.c
# fix lat2-16.psfu (bnc#340579)
font=data/consolefonts/lat2a-16.psfu
@ -119,7 +117,6 @@ make
%install
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_sysconfdir}/init.d
DOC=%{buildroot}%{_defaultdocdir}/kbd
KBD=%{kbd}
K=%{buildroot}$KBD
@ -152,8 +149,6 @@ if ls $K/consolefonts/Agafari-* > /dev/null 2>&1; then
echo "";
exit 1
fi
install -m 755 %{SOURCE4} %{buildroot}%{_initddir}/kbd
ln -s /etc/init.d/kbd %{buildroot}%{_sbindir}/rckbd
ln -sf us.map.gz $K/keymaps/i386/qwerty/khmer.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/korean.map.gz
ln -sf us.map.gz $K/keymaps/i386/qwerty/arabic.map.gz
@ -272,7 +267,6 @@ ln -s %{_bindir}/testutf8 %{buildroot}/bin
ln -s %{_bindir}/unicode_start %{buildroot}/bin
ln -s %{_bindir}/unicode_stop %{buildroot}/bin
ln -s %{_sbindir}/fbtest %{buildroot}/sbin
ln -s %{_sbindir}/rckbd %{buildroot}/sbin
%ifnarch %sparc m68k
ln -s %{_bindir}/getkeycodes %{buildroot}/bin
ln -s %{_bindir}/setkeycodes %{buildroot}/bin
@ -287,26 +281,21 @@ ln -s %{_bindir}/resizecons %{buildroot}/bin
%find_lang %{name}
%post
%{fillup_and_insserv -ny console kbd}
%{fillup_only -n console}
%{fillup_only -n keyboard}
#echo "Please read the docu about the new COMPOSETABLE rc.config variable."
#echo "See /etc/sysconfig/console, /etc/sysconfig/keyboard"
#echo "and {_docdir}/kbd/README.SuSE."
%postun
%{insserv_cleanup}
%files -f %{name}.lang
%defattr(-,root,root)
#config(noreplace) /etc/sysconfig/console
%doc %{_defaultdocdir}/kbd
#doc COPYING CHANGES README CREDITS
%config %{_sysconfdir}/init.d/kbd
%{_localstatedir}/adm/fillup-templates/sysconfig.console
%{_localstatedir}/adm/fillup-templates/sysconfig.keyboard
%{kbd}
#UsrMerge
/sbin/rckbd
/sbin/fbtest
/bin/chvt
/bin/openvt
@ -353,7 +342,6 @@ ln -s %{_bindir}/resizecons %{buildroot}/bin
/bin/spawn_console
/bin/spawn_login
#EndUsrMerge
%{_sbindir}/rckbd
%{_sbindir}/fbtest
%{_bindir}/chvt
%{_bindir}/openvt
@ -399,7 +387,6 @@ ln -s %{_bindir}/resizecons %{buildroot}/bin
%{_bindir}/setvesablank
%{_bindir}/spawn_console
%{_bindir}/spawn_login
%{_bindir}/vlock
%doc %{_mandir}/man1/*
%doc %{_mandir}/man5/keymaps.5.gz
%ifnarch %sparc m68k

View File

@ -28,6 +28,7 @@ KBD_RATE=""
## Default: bios
#
# NumLock on? ("yes" or "no" or empty or "bios" for BIOS setting)
# This setting may interfere with GNOME /desktop/gnome/peripherals/keyboard/remember_numlock_state GConf key.
KBD_NUMLOCK="bios"
## Type: yesno