Commit af88fdff authored by Andreas Henriksson's avatar Andreas Henriksson

Stop shipping /etc/init.d/kbd and /etc/kbd/*

Basic console setup is best done with console-setup since quite a while
in Debian.

Closes: #796583
parent ab4b2927
#
# This files tells the 'kbd' package:
#
# - whether to load a specific font and boot (and maybe a screen-font map,
# but you should avoid that if possible).
# - whether to setup an Application-Charset Map other than the default CP437.
# - whether to do screen saver/DPMS settings
# - whether to change the keyboard rate/delay or the state of the
# keyboard indicators
# - whether to show a clock
#
# You can also specify per-VC settings by suffixing variable names as in
# the examples below. This only works on framebuffer devices.
#
# For consistency with the configuration file of console-tools the
# following variables and their _vcN versions are also supported:
# SCREEN_FONT, SCREEN_FONT_MAP and APP_CHARSET_MAP.
#
#
# Example:
#
#CONSOLE_FONT=iso01.f16
#CONSOLE_FONT_vc2=LatArCyrHeb-16
#
#CONSOLE_MAP=iso05
#CONSOLE_MAP_vc2=user
#
# Set the following - more euro-friendly default than kernel font.
#CONSOLE_FONT=latarcyrheb-sun16.psf
# Forget this one unless you _know_ it is necessary for your font:
#FONT_MAP=iso01
# **** screen saver/DPMS settings: all VCs ****
# These settings are commented by default to avoid the chance of damage to
# very old monitors that don't support DPMS signalling.
# screen blanking timeout. monitor remains on, but the screen is cleared to
# range: 0-60 min (0==never) kernels I've looked at default to 10 minutes.
# (see linux/drivers/char/console.c)
BLANK_TIME=30
# blanking method (VESA DPMS mode to use after BLANK_TIME, before powerdown):
# on: the default, no DPMS signalling. near instant powerup, no power saving
# vsync: DPMS Standby mode. nearly instant recovery, uses 110/120W (17" screen)
# hsync: DPMS Suspend mode. typically 3s recovery, uses 15/120W (17" screen)
# powerdown,off: DPMS Off mode, typ. 10s recovery, uses 5/120W (17" screen)
# Those values are for my 17" Mag, but some monitors do suspend the same as
# standby. xset dpms force {off|standby|suspend|on} is useful for this, if X
# supports DPMS on your video card. Set X's DPMS screensaver with xset dpms
# or use option power_saver in XF86Config
#
# DPMS set by default to on, because hsync can cause problems on certain
# hardware, such as Armada E500 laptops
BLANK_DPMS=off
# Powerdown time. The console will go to DPMS Off mode POWERDOWN_TIME
# minutes _after_ blanking. (POWERDOWN_TIME + BLANK_TIME after the last input)
POWERDOWN_TIME=30
# rate and delay can get only specific values, consult kbdrate(1) for help
#KEYBOARD_RATE="30"
#KEYBOARD_DELAY="250"
# Turn on numlock by default
#LEDS=+num
# Display a clock in the right upper corner of the console by running vcstime
#DO_VCSTIME=yes
# This sed script is run across the dumpkeys output to remap keys on the console
# This turns caps lock into control
#s/keycode 58 = Caps_Lock/keycode 58 = Control/;
#!/bin/sh
### BEGIN INIT INFO
# Provides: kbd
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Description: Set console screen modes and fonts
# Short-Description: Prepare console
### END INIT INFO
# This is the boot script for the `kbd' package.
# It loads parameters from /etc/kbd/config and maybe loads
# default font and map.
# (c) 1997 Yann Dirson
PKG=kbd
if [ -r /etc/$PKG/config ]; then
. /etc/$PKG/config
fi
if [ -d /etc/$PKG/config.d ]; then
for i in `run-parts --list /etc/$PKG/config.d `; do
. $i
done
fi
# do some magic with the variables for compatibility with the config
# file of console-tools
for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed 's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
do
eval [ '"'\${SCREEN_FONT$vc}'"' ] && eval CONSOLE_FONT$vc=\${CONSOLE_FONT$vc:-\${SCREEN_FONT$vc}}
eval [ '"'\${SCREEN_FONT_MAP$vc}'"' ] && eval FONT_MAP$vc=\${FONT_MAP$vc:-\${SCREEN_FONT_MAP$vc}}
eval [ '"'\${APP_CHARSET_MAP$vc}'"' ] && eval CONSOLE_MAP$vc=\${CONSOLE_MAP$vc:-\${APP_CHARSET_MAP$vc}}
done
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
SETFONT_OPT="-v"
if which setupcon >/dev/null
then
HAVE_SETUPCON=yes
fi
# set DEVICE_PREFIX depending on devfs/udev
if [ -d /dev/vc ]; then
DEVICE_PREFIX="/dev/vc/"
else
DEVICE_PREFIX="/dev/tty"
fi
# determine the system charmap
ENV_FILE=''
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
[ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
if [ "$CHARMAP" = "UTF-8" -a -z "$CONSOLE_MAP" ]
then
UNICODE_MODE=yes
fi
unicode_start_stop ()
{
vc=$1
if [ -n "$UNICODE_MODE" -a -z "`eval echo \\$CONSOLE_MAP_vc$vc`" ]; then
action=unicode_start
else
action=unicode_stop
fi
if [ "${CONSOLE_FONT}" ]; then
$action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
else
$action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
fi
}
test_console () {
local ok
ok=0
if which tty >/dev/null; then
case "`tty`" in
/dev/tty[1-9]*|/dev/vc/[0-9]*|/dev/console|/dev/ttyv[0-9]*)
return 0
;;
esac
ok=1
fi
if which kbd_mode >/dev/null; then
mode="`(LC_ALL=C; export LC_ALL; kbd_mode) 2>&1`"
mode=${mode#The keyboard is in }
case "$mode" in
Unicode*|default*|xlate*) return 0 ;;
esac
ok=1
fi
if which vidcontrol >/dev/null; then
if vidcontrol -i adapter >&- 2>&-; then
return 0
fi
ok=1
fi
return $ok
}
setup ()
{
# be sure the main program is installed
which setfont >/dev/null || return
# drop out if we can't access the console
test_console || return
# start vcstime
if [ "${DO_VCSTIME}" = "yes" ] && which vcstime >/dev/null; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
vcstime &
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
if [ -d /etc/init ] && which initctl >/dev/null; then
# Upstart
LIST_CONSOLES=`cd /etc/init; find -name 'tty*.conf' -printf '%f ' | sed -e 's/[^0-9 ]//g'`
elif [ -f /etc/systemd/logind.conf ] && [ -d /run/systemd/system ]; then
# systemd
N_CONSOLES=`sed -ne 's/#.*//; /NAutoVTs/ { s/[^0-9]//g; p }' /etc/systemd/logind.conf`
if [ -z "$N_CONSOLES" ]; then
N_CONSOLES=6
fi
LIST_CONSOLES=`seq 1 "$N_CONSOLES"`
elif [ -f /etc/inittab ]; then
# traditional SysV init
LIST_CONSOLES=`sed -ne '/^[ \t]*#/d; /tty[0-9]\+/ s/.*tty\([0-9]\+\).*/\1/ p' /etc/inittab`
else
LIST_CONSOLES=`seq 1 6`
fi
# Global default font+map
if [ -z "${HAVE_SETUPCON}" -a "${CONSOLE_FONT}${CONSOLE_MAP}${FONT_MAP}" ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
sfm="${FONT_MAP}" && [ "$sfm" ] && sfm="-u $sfm"
acm="${CONSOLE_MAP}" && [ "$acm" ] && acm="-m $acm"
# Set for the first 6 VCs (as they are allocated in /etc/inittab)
for vc in $LIST_CONSOLES
do
if ! ( unicode_start_stop $vc \
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm ${CONSOLE_FONT} $acm )
then
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
break
fi
done
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# Default to Unicode mode for new VTs?
if [ -f /sys/module/vt/parameters/default_utf8 ]; then
if [ -n "$UNICODE_MODE" ]; then
echo 1
else
echo 0
fi > /sys/module/vt/parameters/default_utf8
fi
# Per-VC font+sfm
PERVC_FONTS="`set | grep "^CONSOLE_FONT_vc[0-9]*=" | tr -d \' `"
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_FONTS}" ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
for font in ${PERVC_FONTS}
do
# extract VC and FONTNAME info from variable setting
vc=`echo $font | cut -b16- | cut -d= -f1`
eval font=\$CONSOLE_FONT_vc$vc
# eventually find an associated SFM
eval sfm=\${FONT_MAP_vc${vc}}
[ "$sfm" ] && sfm="-u $sfm"
if ! ( unicode_start_stop $vc \
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font )
then
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
break
fi
done
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# Per-VC ACMs
PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*=" | tr -d \' `"
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_ACMS}" ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
for acm in ${PERVC_ACMS}
do
# extract VC and ACM_FONTNAME info from variable setting
vc=`echo $acm | cut -b15- | cut -d= -f1`
eval acm=\$CONSOLE_MAP_vc$vc
if ! setfont -C "${DEVICE_PREFIX}$vc" ${SETFONT_OPT} -m "$acm"; then
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
break
fi
done
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# screensaver stuff
setterm_args=""
if [ "$BLANK_TIME" ]; then
setterm_args="$setterm_args -blank $BLANK_TIME"
fi
if [ "$BLANK_DPMS" ]; then
setterm_args="$setterm_args -powersave $BLANK_DPMS"
fi
if [ "$POWERDOWN_TIME" ]; then
setterm_args="$setterm_args -powerdown $POWERDOWN_TIME"
fi
if [ "$setterm_args" ]; then
if [ -d /run/systemd/system ]; then
# setterm relies on $TERM and STDIN/STDOUT which has been
# sanitized away by systemd, so we use --term and redirect
# input/output.
setterm --term linux $setterm_args \
< ${DEVICE_PREFIX}1 > ${DEVICE_PREFIX}1
else
setterm $setterm_args
fi
fi
# Keyboard rate and delay
KBDRATE_ARGS=""
if [ -n "$KEYBOARD_RATE" ]; then
KBDRATE_ARGS="-r $KEYBOARD_RATE"
fi
if [ -n "$KEYBOARD_DELAY" ]; then
KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY"
fi
if [ -n "$KBDRATE_ARGS" ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay"
kbdrate -s $KBDRATE_ARGS
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# Inform gpm if present, of potential changes.
if [ -f /var/run/gpm.pid ]; then
kill -s WINCH `cat /var/run/gpm.pid` 2> /dev/null
fi
# Allow user to remap keys on the console
if [ -z "${HAVE_SETUPCON}" -a -r /etc/$PKG/remap ]; then
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/$PKG/remap | loadkeys --quiet
fi
# Set LEDS here
if [ -n "$LEDS" ]; then
for i in $LIST_CONSOLES
do
setleds -D $LEDS < $DEVICE_PREFIX$i
done
fi
}
case "$1" in
start|reload|restart|force-reload)
if [ -n "$HAVE_SETUPCON" ]
then
log_action_msg "Setting console screen modes"
else
log_action_msg "Setting console screen modes and fonts"
fi
setup
;;
stop)
;;
status)
;;
*)
setup
;;
esac
:
......@@ -62,14 +62,9 @@ override_dh_auto_install:
mv $(addprefix debian/kbd/usr/bin/,$(MOVE_TO_BIN)) $(KBD)/bin/
mv $(addprefix debian/kbd/usr/bin/,$(MOVE_TO_SBIN)) $(KBD)/sbin/
mv $(addprefix debian/kbd/usr/bin/,$(MOVE_TO_USR_SBIN)) $(KBD)/usr/sbin/
# configuration files
install -m644 debian/conffiles.d/* $(KBD)/etc/kbd/
# prepare udeb
for ITEM in $(UDEB_BINARIES); do install -m755 src/$$ITEM-udeb $(KBD_UDEB)/bin/$$ITEM; done
override_dh_installinit:
dh_installinit -r
override_dh_installdocs:
dh_installdocs
install -d $(KBD_DOC)/charsets
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment