Package: console-setup
Version: 1.15
Severity: wishlist
Tags: patch
I have found it useful to have a --save-only option to setupcon, which
acts like 'setupcon --save' except that it does *not* attempt to set the
keyboard or font immediately. This is useful so that you can run
'setupcon --save-only' while in X to get the keymap and font onto the
root filesystem, e.g. on upgrade, and avoid triggering problems caused
by some kernel console drivers (at least vgacon) being fundamentally
unable to change the font only on some virtual consoles and corrupting
video memory if you try.
The attached patch implements this option.
Thanks,
--
Colin Watson [EMAIL PROTECTED]
--- console-setup.orig/setupcon 2006-09-28 08:00:10.000000000 +0100
+++ console-setup/setupcon 2007-01-15 17:27:38.000000000 +0000
@@ -48,6 +48,11 @@
--save)
save=yes
;;
+ --save-only)
+ force=yes
+ save=yes
+ save_only=yes
+ ;;
-h|--help)
cat >&2 <<EOF
Usage: setupcon [OPTION] [VARIANT]
@@ -59,6 +64,7 @@
-v, --verbose explain what is being doing, try it if s.t. goes wrong
--save copy the font and the ACM in /etc/console-setup,
update /etc/console-setup/boottime.kmap.gz
+ --save-only only save; don't setup keyboard/font immediately
-h, --help display this help and exit
If VARIANT is not specified setupcon looks for the configuration files
@@ -140,10 +146,12 @@
for console in $ACTIVE_CONSOLES; do
[ -w $console ] || continue
# Setup unicode/non-unicode mode
- if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM$CHARMAP" ]; then
- /bin/echo -n -e '\033%G' >$console
- else
- /bin/echo -n -e '\033%@' >$console
+ if [ "$save_only" != yes ]; then
+ if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM$CHARMAP" ]; then
+ /bin/echo -n -e '\033%G' >$console
+ else
+ /bin/echo -n -e '\033%@' >$console
+ fi
fi
# Load the font
@@ -194,13 +202,15 @@
;;
esac
fi
- if which consolechars >/dev/null; then
- if [ "$bigfont" = yes ]; then
- echo "setupcon: The console-chars utility from the console-setup font can load only fonts witn 8 pixel width matrix. Please install the setfont utility from the kbd package." >&2
- fi
- eval consolechars -v --tty=$console -f "$FONT" $verbose
- elif which setfont >/dev/null; then
- eval setfont -v -C $console "$FONT" $verbose
+ if [ "$save_only" != yes ]; then
+ if which consolechars >/dev/null; then
+ if [ "$bigfont" = yes ]; then
+ echo "setupcon: The console-chars utility from the console-setup font can load only fonts witn 8 pixel width matrix. Please install the setfont utility from the kbd package." >&2
+ fi
+ eval consolechars -v --tty=$console -f "$FONT" $verbose
+ elif which setfont >/dev/null; then
+ eval setfont -v -C $console "$FONT" $verbose
+ fi
fi
# Load the ACM
@@ -226,7 +236,7 @@
else
ACM="$CHARMAP.acm.gz"
fi
- if [ "$CHARMAP" != UTF-8 ]; then
+ if [ "$save_only" != yes ] && [ "$CHARMAP" != UTF-8 ]; then
if which consolechars >/dev/null; then
eval consolechars -v --tty=$console --acm "$ACM" $verbose
elif which setfont >/dev/null; then
@@ -247,7 +257,8 @@
# This code was borrowed from the keymap.sh script of console-common
# Copyright © 2001 Yann Dirson
# Copyright © 2001 Alcove http://www.alcove.fr/
- if [ -x /sbin/sysctl ] && [ -r /etc/sysctl.conf ]; then
+ if [ "$save_only" != yes ] && \
+ [ -x /sbin/sysctl ] && [ -r /etc/sysctl.conf ]; then
if grep -v '^\#' /etc/sysctl.conf | grep -q keycodes ; then
grep keycodes /etc/sysctl.conf | grep -v "^#" \
| while read d ; do
@@ -256,12 +267,14 @@
fi
fi
- if which kbd_mode >/dev/null; then
- if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM" ]; then
- kbd_mode -u
- else
- kbd_mode -a
- fi
+ if [ "$save_only" != yes ]; then
+ if which kbd_mode >/dev/null; then
+ if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM" ]; then
+ kbd_mode -u
+ else
+ kbd_mode -a
+ fi
+ fi
fi
if which loadkeys >/dev/null; then
@@ -271,15 +284,18 @@
else
acm_option=''
fi
- ckbcomp $acm_option -model "$XKBMODEL" \
- "$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" \
- | eval loadkeys $verbose
+ if [ "$save_only" != yes ]; then
+ ckbcomp $acm_option -model "$XKBMODEL" \
+ "$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" \
+ | eval loadkeys $verbose
+ fi
if which gzip >/dev/null && [ "$save" = yes ]; then
ckbcomp $acm_option -model "$XKBMODEL" \
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" \
| gzip -9 >/etc/console-setup/boottime.kmap.gz
fi
- elif [ -f /etc/console-setup/boottime.kmap.gz ]; then
+ elif [ "$save_only" != yes ] && \
+ [ -f /etc/console-setup/boottime.kmap.gz ]; then
eval loadkeys /etc/console-setup/boottime.kmap.gz $verbose
fi
fi