120
if [ "$CONFIG2" -a -f "$CONFIG2" ]; then
353
if [ -f "$CONFIG2" ]; then
356
# in order to permit "if [ cached.kmap.gz -ot $CONFIG2 ]; then ... fi"
125
if [ "$verbose_option" = yes ]; then
361
###########################################################################
362
### INITIALIZATION AND DEFAULT VALUES
363
###########################################################################
366
# The variable VERBOSE_OUTPUT is obsoleted in favour of the option --verbose
128
367
if [ "$VERBOSE_OUTPUT" = yes ]; then
373
if which uname >/dev/null; then
375
*Linux*) kernel=linux ;;
376
*FreeBSD*) kernel=freebsd ;;
378
echo 'Unknown kernel (only Linux and FreeBSD are supported).' >&2
385
if [ -n "$do_save" ]; then
386
if [ ! -d /usr/share ]; then
387
echo It seems /usr is not mounted. Will not save files in /etc. >&2
389
elif [ ! -w /etc/console-setup/ ]; then
390
echo /etc/console-setup is not writable. No files will be saved there. >&2
396
# When ACTIVE_CONSOLES=guess the following will result in ACTIVE_CONSOLES=''
398
for tty in $ACTIVE_CONSOLES; do
404
if [ -z "$ACTIVE_CONSOLES" ]; then
408
# Sys V init: /etc/inittab
409
# Upstart: /etc/init/*
411
# Linux: /dev/tty[1-9][0-9]*
412
# FreeBSD: /dev/ttyv[0-9a-f]
414
$(cat /etc/inittab /etc/init/* /etc/ttys 2>/dev/null \
416
| egrep '([[:blank:]]|^)tty([1-9][0-9]*|v[0-9a-f])([[:blank:]]|$)' \
418
-e 's/.*[[:blank:]]\(tty[1-9][0-9]*\).*/\1/' \
419
-e 's/.*[[:blank:]]\(ttyv[0-9a-f]\).*/\1/')
421
if [ -e /dev/$tty ]; then
422
ACTIVE_CONSOLES="$ACTIVE_CONSOLES /dev/$tty"
426
if [ -z "$ACTIVE_CONSOLES" ]; then
428
linux) ACTIVE_CONSOLES=$(ls /dev/tty[1-6] 2>/dev/null) ;;
429
freebsd) ACTIVE_CONSOLES=$(ls /dev/ttyv[0-3] 2>/dev/null) ;;
431
report Can not find the active virtual consoles, \
432
assuming ACTIVE_CONSOLES=\"$ACTIVE_CONSOLES\" >&2
131
verbose='>/dev/null 2>&1'
434
report Configuring $ACTIVE_CONSOLES
134
if which ckbcomp-mini >/dev/null; then
136
if [ "$VERBOSE_OUTPUT" = yes -a "$CHARMAP" != UTF-8 ]; then
137
echo Only UTF-8 is supported by console-setup-mini
438
if [ "$CHARMAP" = guess -o -z "$CHARMAP" ]; then
440
if which locale >/dev/null; then
441
CHARMAP=`locale charmap`
141
if [ "$force" != yes ]; then
142
case `readlink /proc/self/fd/2` in
143
/dev/tty[0-9]*|/dev/vc/[0-9]*|/dev/console)
146
echo We are not on the Linux console, the console is left unconfigured.
152
ACTIVE_CONSOLES=${ACTIVE_CONSOLES:-/dev/tty[1-6]}
153
444
CHARMAP=${CHARMAP:-UTF-8}
154
CODESET=${CODESET:-Uni2}
445
# FreeBSD uses ISO8859-1, GNU uses ISO-8859-1, we use the GNU names
447
ISO8859-*) CHARMAP="ISO-8859-${CHARMAP#ISO8859-}" ;;
448
US-ASCII|ANSI*) CHARMAP=ISO-8859-1 ;;
450
report The charmap is $CHARMAP
454
[ "$CHARMAP" = UTF-8 ]
462
if [ "$do_font" ]; then
465
if which consolechars >/dev/null ; then
467
elif which setfont >/dev/null ; then
470
echo "Neither setfont nor consolechars is accessible. No font will be configured." >&2
475
if which vidcontrol >/dev/null ; then
478
echo "vidcontrol is not accessible. No font will be configured." >&2
484
# Due to bug in splashy and usplash: do not load fonts (#540314)
485
if which pidof >/dev/null; then
486
if pidof splashy > /dev/null || pidof usplash > /dev/null; then
492
[ "$CODESET" != guess ] || CODESET=''
493
if [ -z "$CODESET" ]; then
495
UTF-8) CODESET=Uni2;;
496
ARMSCII-8) CODESET=Armenian ;;
497
CP1251) CODESET=CyrSlav ;;
498
CP1255) CODESET=Hebrew ;;
499
CP1256) CODESET=Arabic ;;
500
GEORGIAN-ACADEMY) CODESET=Georgian ;;
501
GEORGIAN-PS) CODESET=Georgian ;;
502
IBM1133) CODESET=Lao ;;
503
ISIRI-3342) CODESET=Arabic ;;
504
ISO-8859-1) CODESET=Lat15 ;;
505
ISO-8859-2) CODESET=Lat2 ;;
506
ISO-8859-3) CODESET=Lat38 ;;
507
ISO-8859-4) CODESET=Lat7 ;; # sometimes Lat15
508
ISO-8859-5) CODESET=CyrSlav ;;
509
ISO-8859-6) CODESET=Arabic ;;
510
ISO-8859-7) CODESET=Greek ;;
511
ISO-8859-8) CODESET=Hebrew ;;
512
ISO-8859-9) CODESET=Lat15 ;;
513
ISO-8859-10) CODESET=Lat15 ;;
514
ISO-8859-11) CODESET=Thai ;;
515
ISO-8859-13) CODESET=Lat7 ;;
516
ISO-8859-14) CODESET=Lat38 ;;
517
ISO-8859-15) CODESET=Lat15 ;;
518
ISO-8859-16) CODESET=Lat2 ;;
519
KOI8-R) CODESET=CyrKoi ;;
520
KOI8-U) CODESET=CyrKoi ;;
521
TIS-620) CODESET=Thai ;;
522
VISCII) CODESET=Vietnamese ;;
524
if [ "$do_font" ]; then
525
echo Unsupported charmap $CHARMAP >&2
530
if [ "$kernel" = freebsd ]; then
531
# 512 character fonts are not supported on FreeBSD
533
Uni*|Vietnamese|Arabic|Ethiopian) CODESET=Lat15 ;;
537
if [ "$CHARMAP" != UTF-8 -a "$kernel" = freebsd ]; then
539
[ -z "`findfile share/syscons/scrnmaps ${CHARMAP}_${CODESET}.scm`" ]
541
report "Ignoring the CODESET specification ($CODESET)."
542
CODESET=`findfile share/syscons/scrnmaps ${CHARMAP}_*.scm`
543
if [ -n "$do_font" -a -z "$CODESET" ]; then
544
echo Unsupported charmap $CHARMAP >&2
547
CODESET=${CODESET%%*/}
548
CODESET=${CODESET#.scm*}
549
CODESET=${CODESET%*_}
550
report Using $CODESET instead.
555
if [ -z "$FONTSIZE" -o "$FONTSIZE" = guess ]; then
560
FONTSIZE=${FONTSIZE#*x}
563
FONTSIZE=${FONTSIZE%x*}
568
if [ "$a" -lt "$b" ]; then
574
# mapdir, fontdir, stdfont, stdfontfallback
577
mapdir=share/consoletrans
578
stdmap=$CHARMAP.acm.gz
579
fontdir=share/consolefonts
580
stdfont=$CODESET-$FONTFACE$FONTSIZE.psf.gz
581
# [A-WXYZa-wyz] is a funny way to say [A-Za-wyz]. In some locales
582
# [A-Z] includes x and we don't want this.
583
stdfontfallback=$CODESET-*[A-WXYZa-wyz]$FONTSIZE.psf.gz
586
mapdir=share/syscons/scrnmaps
587
stdmap=${CHARMAP}_${CODESET}.scm
588
fontdir=share/syscons/fonts
589
stdfont16=$CODESET-${FONTFACE}16.fnt
590
stdfont14=$CODESET-${FONTFACE}14.fnt
591
stdfont8=$CODESET-${FONTFACE}8.fnt
592
stdfontfallback16=$CODESET-*[A-WXYZa-wyz]16.fnt
593
stdfontfallback14=$CODESET-*[A-WXYZa-wyz]14.fnt
594
stdfontfallback8=$CODESET-*[A-WXYZa-wyz]8.fnt
155
599
CONSOLE_MAP=${CONSOLE_MAP:-$ACM}
157
#-----------------------#
159
#-----------------------#
161
if [ "$keyboard_only" != yes ] && [ "$ACTIVE_CONSOLES" ]; then
162
# Setup unicode/non-unicode mode
163
if [ "$save_only" != yes ]; then
164
for console in $ACTIVE_CONSOLES; do
165
[ -w $console ] || continue
167
[ "$CHARMAP" = UTF-8 ] || [ -z "$CONSOLE_MAP$CHARMAP" ]
169
printf '\033%%G' >$console
171
printf '\033%%@' >$console
177
if [ -z "$FONT" ]; then
179
if which ckbcomp-mini >/dev/null; then
180
FONT=$(echo `ls /usr/share/consolefonts/$CODESET-*.psf* \
181
/etc/console-setup/$CODESET-*.psf* 2>/dev/null`)
183
if [ "$FONTFACE" ] || [ "$FONTSIZE" ]; then
184
eval echo setupcon: Warning: ignoring the FONTFACE and FONTSIZE specifications! $verbose
186
elif [ "$FONTFACE" ] && [ "$FONTSIZE" ]; then
187
FONT="$CODESET-$FONTFACE$FONTSIZE.psf.gz"
600
[ -z "$CONSOLE_MAP" ] || CONSOLE_MAP=`findfile $mapdir "$CONSOLE_MAP"`
601
[ -n "$CONSOLE_MAP" -o "$CHARMAP" = UTF-8 ] || CONSOLE_MAP=`findfile $mapdir $stdmap`
602
[ -n "$CONSOLE_MAP" -o "$CHARMAP" = UTF-8 ] || CONSOLE_MAP=`findfile $mapdir ${stdmap%.gz}`
199
607
for f in $FONT; do
201
LOADFONTS="$LOADFONTS $f"
205
/usr/local/share/consolefonts \
206
/usr/share/consolefonts \
210
if [ -f "$dir/${f##*/}" ]; then
211
LOADFONTS="$LOADFONTS $dir/${f##*/}"
213
elif [ -f "$dir/${fdec##*/}" ]; then
214
LOADFONTS="$LOADFONTS $dir/${fdec##*/}"
217
if [ "$dir" = FONT_IS_MISSING ]; then
218
echo setupcon: Warning: the font ${f##*/} does not exist! >&2
224
for f in $FONT_MAP; do
225
[ -z "$LOADFONT_MAP" ] || break # only one unicode map
227
LOADFONT_MAP="$LOADFONT_MAP $f"
230
/usr/local/share/consoletrans \
231
/usr/share/consoletrans \
235
if [ -f "$dir/${f##*/}" ]; then
236
LOADFONT_MAP="$LOADFONT_MAP $dir/${f##*/}"
239
if [ "$dir" = FONT_MAP_IS_MISSING ]; then
240
echo setupcon: Warning: the unicode map ${f##*/} does not exist! >&2
246
for f in $LOADFONTS; do
249
&& [ "${f%/*}" != /etc/console-setup ]
252
if [ "$fdec" = "$f" ]; then
253
cp "$f" /etc/console-setup/
255
gunzip -c "$f" >"/etc/console-setup/${fdec##*/}"
257
rm -f "/etc/console-setup/${fdec##*/}.gz"
260
for f in $LOADFONT_MAP; do
263
&& [ "${f%/*}" != /etc/console-setup ]
265
cp "$f" /etc/console-setup/
269
# Due to bug in splashy and usplash: do not load fonts (#540314)
271
pidof splashy > /dev/null \
272
|| pidof usplash > /dev/null
277
if [ "$save_only" != yes ] && [ "$LOADFONTS" ]; then
278
for console in $ACTIVE_CONSOLES; do
279
[ -w $console ] || continue
280
if which consolechars >/dev/null; then
281
if [ "$bigfont" = yes ]; then
282
echo "setupcon: The consolechars utility from the console-setup font can load only fonts with 8 pixel width matrix. Please install the setfont utility from the kbd package." >&2
284
if [ "$LOADFONT_MAP" ]; then
285
eval consolechars -v --tty=$console -f $LOADFONTS -u "$LOADFONT_MAP" $verbose
287
eval consolechars -v --tty=$console -f $LOADFONTS $verbose
289
elif which setfont >/dev/null; then
290
if [ "$LOADFONT_MAP" ]; then
291
eval setfont -v -C $console $LOADFONTS -u "$LOADFONT_MAP" $verbose
293
eval setfont -v -C $console $LOADFONTS $verbose
300
if [ ! -f "$CONSOLE_MAP" ]; then
302
/usr/local/share/consoletrans \
303
/usr/share/consoletrans \
306
if [ -f "$dir/$CHARMAP.acm.gz" ]; then
307
CONSOLE_MAP="$dir/$CHARMAP.acm.gz"
309
elif [ -f "$dir/$CHARMAP.acm" ]; then
310
ACM="$dir/$CHARMAP.acm"
315
if [ -f "$CONSOLE_MAP" ]; then
318
&& [ "${CONSOLE_MAP%/*}" != /etc/console-setup ]
320
console_map_dec="${CONSOLE_MAP%.gz}"
321
if [ "$console_map_dec" = "$CONSOLE_MAP" ]; then
322
cp "$CONSOLE_MAP" /etc/console-setup/
324
gunzip -c "$CONSOLE_MAP" >"/etc/console-setup/${console_map_dec##*/}"
326
rm -f "/etc/console-setup/${console_map_dec##*/}.gz"
329
CONSOLE_MAP="$CHARMAP.acm.gz"
332
[ "$save_only" != yes ] && [ "$CHARMAP" != UTF-8 ] && [ "$LOADFONTS" ]
334
for console in $ACTIVE_CONSOLES; do
335
[ -w $console ] || continue
336
if which consolechars >/dev/null; then
337
eval consolechars -v --tty=$console --acm "$CONSOLE_MAP" $verbose
338
elif which setfont >/dev/null; then
339
eval setfont -v -C $console -m "$CONSOLE_MAP" $verbose
608
RES=`findfile $fontdir $f`
609
if [ -z "$RES" ]; then
611
RES=`findfile $fontdir $fdec`
613
FONTFILES="$FONTFILES $RES"
616
FONTFILES=`echo $FONTFILES` # remove extra spaces
617
if [ -n "$FONTFACE" -a -z "$FONTFILES" ]; then
620
# the following will fail if FONTFACE=guess ($stdfont will
622
FONTFILES=`findfile $fontdir $stdfont`
623
[ "$FONTFILES" ] || FONTFILES=`findfile $fontdir $stdfontfallback`
625
*[0-9]x[1-9]*.psf.gz)
626
if which consolechars >/dev/null; then
628
The consolechars utility from the \"console-tools\" package can load only fonts
629
with 8 pixel width matrix. Please install the setfont utility from the package
630
\"kbd\" or reconfigure the font size." >&2
636
FONTFILES=`findfile $fontdir $stdfont16`
637
[ "$FONTFILES" ] || FONTFILES=`findfile $fontdir $stdfontfallback16`
638
font=`findfile $fontdir $stdfont14`
639
[ "$font" ] || font=`findfile $fontdir $stdfontfallback14`
640
[ -z "$font" ] || FONTFILES="$FONTFILES $font"
641
font=`findfile $fontdir $stdfont8`
642
[ "$font" ] || font=`findfile $fontdir $stdfontfallback8`
643
[ -z "$font" ] || FONTFILES="$FONTFILES $font"
646
if [ -n "$do_font" -a -z "$FONTFILES" ]; then
647
echo Unable to find the required font. No font will be configured. >&2
654
if [ "$kernel" = linux -a -n "$FONT_MAP" ]; then
655
FONTMAPFILE=`findfile share/consoletrans "$FONT_MAP"`
659
if [ -n "$do_kbd$do_save$savekbdfile$setupdir" -a "$XKBMODEL" = unknown ]; then
660
echo The keyboard model is unknown. Keyboard will not be configured. >&2
663
[ -n "$XKBMODEL" -o -z "$savekbdfile" ] || exit 1
665
# Backwards-compatibility with Ubuntu-specific preseeding
666
if [ "$XKBMODEL" = SKIP ]; then
671
[ "$XKBMODEL" ] || do_kbd=''
672
if [ "$do_kbd" ]; then
675
if which loadkeys >/dev/null; then
678
echo loadkeys is not accessible. Keyboard will not be configured.>&2
683
if which kbdcontrol >/dev/null; then
686
echo kbdcontrol is not accessible. Keyboard will not be configured.>&2
694
if [ "$CHARMAP" != UTF-8 ]; then
695
acm_option="-charmap $CHARMAP"
696
elif [ "$kernel" = freebsd ]; then
697
acm_option='-charmap ISO-8859-1'
703
if [ "$XKBRULES" ]; then
704
rules_option="-rules $XKBRULES"
711
linux) backspace='del' ;;
712
freebsd) backspace='bs' ;;
716
| egrep '(^| )erase *=' \
717
| sed -e 's/.* erase *= *//' -e 's/^erase *= *//' -e 's/[; ].*//') \
720
^\?) backspace='del' ;;
721
^h|^H) backspace='bs' ;;
724
del) backspace='del' ;;
725
bs) backspace='bs' ;;
728
del) report BackSpace is ^? ;;
729
bs) report BackSpace is ^h ;;
730
*) echo Wrong BackSpace option >&2 ;;
736
cached=/etc/console-setup/cached$VARIANT.kmap.gz
739
cached=/etc/console-setup/cached$VARIANT.kbd
745
[ -z "$savekbdfile" -a -n "$do_save" ] \
746
&& [ ! -f "$cached" \
747
-o ! "$CONFIG" -ot "$cached" \
748
-o ! "$CONFIG2" -ot "$cached" ]
750
savekbdfile="$cached"
752
if [ -z "$savekbdfile" -a -n "$setupdir" ]; then
753
mkdir -p "$setupdir"/etc/console-setup
755
linux) savekbdfile="$setupdir"/etc/console-setup/cached.kmap.gz ;;
756
freebsd) savekbdfile="$setupdir"/etc/console-setup/cached.kbd ;;
759
[ "$XKBMODEL" ] || savekbdfile=''
760
if [ "$kernel" = linux ] && ! which gzip >/dev/null; then
762
echo gzip is not accessible. Will not save cached keyboard map. >&2
766
if [ -n "$KMAP" -a ! -f "$KMAP" ]; then
767
echo $KMAP does not exist. >&2
772
###########################################################################
773
### SAVE THE FILES IN /etc
774
###########################################################################
776
if [ -n "$do_save" ]; then
777
case "$CONSOLE_MAP" in
778
/etc/console-setup/*) ;;
780
console_map_dec="${CONSOLE_MAP%.gz}"
781
if [ "$console_map_dec" = "$CONSOLE_MAP" ]; then
782
cp "$CONSOLE_MAP" /etc/console-setup/
784
gunzip -c "$CONSOLE_MAP" >"/etc/console-setup/${console_map_dec##*/}"
786
rm -f "/etc/console-setup/${console_map_dec##*/}.gz"
789
for font in $FONTFILES; do
791
/etc/console-setup/*) ;;
792
?*) cp "$font" /etc/console-setup/ ;;
795
case "$FONTMAPFILE" in
796
/etc/console-setup/*) ;;
797
?*) cp "$FONTMAPFILE" /etc/console-setup/ ;;
801
if [ "$savekbdfile" ]; then
804
tempfile || { echo Can not create temporary file >&2; exit 1; }
806
$installdir/bin/ckbcomp -backspace "$backspace" $acm_option \
807
$rules_option -model "$XKBMODEL" \
808
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" >$TMPFILE \
809
&& gzip -9 <$TMPFILE >"$savekbdfile"
814
$installdir/bin/ckbcomp -freebsd -backspace "$backspace" \
815
$acm_option $rules_option -model "$XKBMODEL" \
816
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" >"$savekbdfile" \
823
###########################################################################
824
### ARE WE ON THE CONSOLE?
825
###########################################################################
827
if [ "$do_check" ]; then
828
if ! test_console; then
829
echo We are not on the console, the console is left unconfigured. >&2
835
###########################################################################
837
###########################################################################
840
if [ "$VIDEOMODE" ]; then
843
run in ECHO vidcontrol "$VIDEOMODE"
846
# this is a bit pointless as vesafb doesn't support changing mode
847
if which fbset >/dev/null; then
848
run plain ECHO fbset -a "$VIDEOMODE"
850
report fbset is not installed
856
# Setup unicode/non-unicode mode
858
# So far the FreeBSD kernel doesn't support changes of the mode from
859
# utf to 8-bit and vice versa (its a compile time option).
861
if [ "$unicode" ]; then
862
run '' ECHO utf_start
870
if [ "$FONTFILES" ]; then
873
if [ -z "$unicode" ]; then
874
for font in $FONTFILES; do
875
run plain ECHO vidcontrol -f $font
880
if [ "$FONTMAPFILE" ]; then
881
run '-C ' -v setfont $FONTFILES -u "$FONTMAPFILE"
883
run '-C ' -v setfont $FONTFILES
887
if [ "$FONTMAPFILE" ]; then
888
run --tty= -v consolechars -f ${FONTFILES%% *} -u "$FONTMAPFILE"
890
run --tty= -v consolechars -f ${FONTFILES%% *}
896
# Load the console map
897
if [ "$CONSOLE_MAP" ]; then
900
if [ -z "$unicode" ]; then
901
run plain ECHO vidcontrol -l "$CONSOLE_MAP"
905
run '-C ' -v setfont -m "$CONSOLE_MAP"
908
run --tty= -v consolechars --acm "$CONSOLE_MAP"
913
# Setup the terminal width and height
914
if [ "$do_font" ]; then
345
916
[ -z "$SCREEN_WIDTH" ] || STTY="$STTY cols $SCREEN_WIDTH"
346
917
[ -z "$SCREEN_HEIGHT" ] || STTY="$STTY rows $SCREEN_HEIGHT"
350
for console in $ACTIVE_CONSOLES; do
351
[ -r $console ] || continue
352
stty $STTY < $console
920
run in ECHO stty $STTY
357
#-----------------------#
359
#-----------------------#
361
if [ "$font_only" != yes ] && [ "$XKBMODEL" != unknown ] && \
362
[ "$ACTIVE_CONSOLES" ]; then
363
# On Mac PPC machines, we may need to set kernel vars first. We need
364
# to mount /proc to do that, but we need it set up before sulogin may
365
# be run in checkroot, which will need the keyboard to log in...
366
# This code was borrowed from the keymap.sh script of console-common
367
# Copyright © 2001 Yann Dirson
368
# Copyright © 2001 Alcove http://www.alcove.fr/
369
if [ "$save_only" != yes ] && \
370
[ -x /sbin/sysctl ] && [ -r /etc/sysctl.conf ]; then
925
###########################################################################
927
###########################################################################
929
# On Mac PPC machines, we may need to set kernel vars first. We need
930
# to mount /proc to do that, but we need it set up before sulogin may
931
# be run in checkroot, which will need the keyboard to log in...
932
# This code was borrowed from the keymap.sh script of console-common
933
# Copyright © 2001 Yann Dirson
934
# Copyright © 2001 Alcove http://www.alcove.fr/
935
if [ "$do_kbd" = linux ]; then
936
if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then
371
937
if grep -v '^\#' /etc/sysctl.conf | grep -q keycodes ; then
372
938
grep keycodes /etc/sysctl.conf | grep -v "^#" \
373
939
| while read d ; do
374
/sbin/sysctl -w $d 2> /dev/null || true
379
if [ "$save_only" != yes ]; then
380
for console in $ACTIVE_CONSOLES; do
381
[ -w $console ] || continue
382
if which kbd_mode >/dev/null; then
383
if [ "$CHARMAP" = UTF-8 ] || [ -z "$CONSOLE_MAP" ]; then
384
kbd_mode -u <$console
386
kbd_mode -a <$console
392
if which loadkeys >/dev/null && [ "$XKBMODEL" != SKIP ]; then
393
if [ "$CHARMAP" != UTF-8 ]; then
394
acm_option="-charmap $CHARMAP"
399
if [ "$XKBRULES" ]; then
400
rules_option="-rules $XKBRULES"
406
[ "$VARIANT" = '' ] \
407
&& which gzip >/dev/null \
408
&& [ -d /usr/share ] # /usr is mounted
411
[ ! -f /etc/console-setup/cached.kmap.gz ] \
412
|| [ /etc/console-setup/cached.kmap.gz \
413
-ot /etc/default/keyboard ] \
416
ckbcomp $acm_option $rules_option -model "$XKBMODEL" \
417
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" \
418
| gzip -9 2>/dev/null >/etc/console-setup/cached.kmap.gz
419
# avoid warnings when /etc is mounted read-only
423
if [ "$save_only" != yes ]; then
424
if [ "$KMAP" -a -f "$KMAP" ]; then
425
eval loadkeys "$KMAP" $verbose
428
[ "$VARIANT" = '' ] && [ "$CONFIG" != "$USER_CONFIG" ] \
429
&& [ -f /etc/console-setup/cached.kmap.gz ] \
430
&& [ ! /etc/console-setup/cached.kmap.gz \
431
-ot /etc/default/keyboard ]
433
eval loadkeys /etc/console-setup/cached.kmap.gz $verbose
435
if [ -d /usr/share ]; then
436
ckbcomp $acm_option $rules_option \
438
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" \
439
| eval loadkeys $verbose
440
elif [ -f /etc/console-setup/cached.kmap.gz ]; then
441
eval loadkeys /etc/console-setup/cached.kmap.gz $verbose
940
/sbin/sysctl -w $d 2> /dev/null || true
946
# Setup unicode/non-unicode mode
947
if [ "$do_kbd" = linux ]; then
948
if which kbd_mode >/dev/null; then
949
if [ "$unicode" ]; then
950
run in ECHO kbd_mode -u
952
run in ECHO kbd_mode -a
955
report kbd_mode is not accessible. Unable to setup unicode/non-unicode keyboard mode.
960
[ -z "$KMAP" -a -f "$cached" ] \
961
&& [ "$CONFIG" -ot "$cached" -a "$CONFIG2" -ot "$cached" ]
968
linux) run plain '' loadkeys "$KMAP" ;;
969
freebsd) run in ECHO kbdcontrol -l "$KMAP" ;;
972
tempfile || { echo Can not create temporary file >&2; exit 1; }
975
$installdir/bin/ckbcomp -backspace "$backspace" $acm_option \
976
$rules_option -model "$XKBMODEL" \
977
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" >$TMPFILE
978
run plain ECHO loadkeys $TMPFILE
981
$installdir/bin/ckbcomp -freebsd -backspace "$backspace" \
982
$acm_option $rules_option -model "$XKBMODEL" \
983
"$XKBLAYOUT" "$XKBVARIANT" "$XKBOPTIONS" >$TMPFILE
984
run in ECHO kbdcontrol -l $TMPFILE
985
run in ECHO kbdcontrol -f 70 "`printf '\033[3~'`"
992
###########################################################################
994
###########################################################################
998
if [ "$setupdir" ]; then
1002
*.kmap.gz|*.kbd|*/tmpkbd.*)
1003
echo -n "/etc/console-setup/${savekbdfile##*/} "
1006
if [ -e "$1" ]; then
1007
if [ ! -e "$setupdir/etc/console-setup/${1##*/}" ]; then
1008
cp -a "$1" "$setupdir/etc/console-setup/${1##*/}"
1010
echo -n "/etc/console-setup/${1##*/} "
1021
mkdir -p "$setupdir"/bin
1023
echo '#!/bin/sh' >"$setupdir"/bin/setupcon
1024
echo '# A micro-version of setupcon with static configuration.' >>"$setupdir"/bin/setupcon
1025
chmod +x "$setupdir"/bin/setupcon
1026
tempfile || { echo Can not create temporary file >&2; exit 1; }
1028
while read cmd args; do
1029
case "$cmd $args" in
1031
echo -n printf \'\\\\'033%%G'\'' >' # not for FreeBSD
1032
filearg "${args%% *}"
1036
echo -n printf \'\\\\'033%%@'\'' >' # not for FreeBSD
1037
filearg "${args%% *}"
1041
echo kbdcontrol -f 70 \"\`printf \'\\\\033[3~\'\`\"
1044
which "$cmd" >>$TMPFILE || true
1046
for arg in $args; do
1052
done >>"$setupdir"/bin/setupcon
1053
echo exit 0 >>"$setupdir"/bin/setupcon
1054
sort $TMPFILE | uniq >"$setupdir"/morefiles