This file is indexed.

/usr/sbin/install-keymap is in console-common 0.7.88.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/sh

# Copyright (c) 1999-2001 Yann Dirson <dirson@debian.org>


CONFDIR=/etc/console
CONFFILEROOT=boottime
KMAPEXT=kmap

# Set up i18n if possible
TEXTDOMAIN=install-keymap
export TEXTDOMAIN

if which gettext >/dev/null
then
   GETTEXT="gettext -e -s"
else
   GETTEXT="echo -e"
fi

if [ $# != 1 ]
then
    $GETTEXT >&2 "Usage: install-keymap [ keymap_file | NONE | KERNEL ]"
    exit 1
fi

if [ "$1" =  "--help" ]
then
    $GETTEXT "Usage: install-keymap [ keymap_file | NONE | KERNEL ]"
    exit 0
fi
if [ "$1" = "--version" ]
then
   VERSION=`dpkg -l console-common | tail -n 1 | awk '{print $3}' `
   #  This string can not be localized, and it is not worth trying to
   echo "install-keymap: (console-common) " $VERSION
   exit 0
fi

keymap="$1"
if [ "$keymap" = NONE ]
then
    exit 0
fi

CONSOLE_TYPE=`fgconsole 2>/dev/null`
if  [ "$?" != "0" ]
then
   $GETTEXT >&2 "Deferring virtual terminal setup until console accessible."
   exit 0
fi

check_if_serial_console()
{
	if [ $CONSOLE_TYPE = "serial" ] 
	then
	   $GETTEXT >&2 "Warning: cannot install keymap on a serial console.\n deferring until non-serial console present."
	   exit 0
	fi
}

if ! which loadkeys >/dev/null
then
  $GETTEXT >&2 "Warning: no console utilities installed yet.\n deferring keymap setting until either console-tools or kbd is installed."
  exit 0
fi

do_preserving_keymap()
# execute shell command-line preserving the keymap
{
    # save keymap
    TMP=`tempfile`
    if ! dumpkeys >${TMP}; then
    	check_if_serial_console
	$GETTEXT >&2 "Failed to dump keymap!"
	$GETTEXT >&2 "This might be because your console cannot be opened.  Perhaps you don't have\na video card, are connected via the serial console or ssh.\nNot loading keymap!"

         rm -f ${TMP}
         exit 0
    fi

    if ! (eval "$*" && loadkeys -q ${TMP}); then
    	 check_if_serial_console
         $GETTEXT >&2 "Failed to preserve keymap!"
         rm -f ${TMP}
         exit 0
    fi

    rm -f ${TMP}
}

 # Be extra safe
mkdir -p ${CONFDIR}

NEW=`tempfile --suffix .gz`
CONFFILE=${CONFDIR}/${CONFFILEROOT}.${KMAPEXT}.gz
OLD_CONFFILE=${CONFDIR}/${CONFFILEROOT}.old.${KMAPEXT}.gz


backup()
{
    # If symlink, then don't overwrite, just provide new one
    if [ -h ${CONFFILE} ]
    then
	mv $NEW ${CONFFILE}.dpkg
	$GETTEXT >&2 "conffile ${CONFFILE} is a symlink : not overwriting"
	$GETTEXT >&2 "It is recommended that ${CONFFILE} is not a symlink; instead\nedit /etc/console-tools/remap to include any local changes."
	$GETTEXT >&2 "The new keymap has been placed in ${CONFFILE}.dpkg ;\nPlease move it as required."
    fi
    
    # Keep a backup if no backup already exists
    [ -f ${CONFFILE} -a ! -f ${OLD_CONFFILE} ] && 
	mv ${CONFFILE} ${OLD_CONFFILE}
    # Also backup this one, although it should probably not exist
    [ -f ${CONFFILE}%.gz} -a ! -r ${OLD_CONFFILE%.gz} ] && 
	mv ${CONFFILE%.gz} ${OLD_CONFFILE%.gz}
    
    if [ "$keymap" != KERNEL -a -f ${NEW} ]
    then
	mv $NEW $CONFFILE
    fi
    # Make sure perms are correct 
    [ -f ${CONFFILE} ] && chmod -f 644 ${CONFFILE} || true
    [ -f ${OLD_CONFFILE} ] && chmod -f 644 ${OLD_CONFFILE} || true
}

if [ "$keymap" = KERNEL ]
then
    backup
    rm -f ${CONFFILE}
else
    if [ "`dpkg --print-architecture`" = "arm" ] && 
	grep -i '^Hardware.*: \(Acorn-\|RiscStation-\)' /proc/cpuinfo >/dev/null &&
	find /usr/share/keymaps/i386/ -type f -name ${keymap} -o \
		    -name ${keymap}.gz -o -name ${keymap}.kmap.gz
    then
	# we're pretty sure now we were asked to load a PC keymap on a RiscPC
	$GETTEXT >&2 "Notice: doing keycode translation to use PC keymap on RiscPC"
	TRANSLATOR=/usr/share/console/ps2-to-riscpc
    else
	TRANSLATOR=cat
    fi

    # Running the translator at this point is the best way to look for problems, but
    # running it prior to "loadkeys" (where it would belong really) is mostly not possible
    # because of include files and include-like directives.
    # It may turn out that we really need to do keymap-file expansion differently because
    # of this.  Sigh.
    do_preserving_keymap "loadkeys -q $keymap ; dumpkeys | $TRANSLATOR | gzip -9n > $NEW"

    # if diff is available, use it to install only if needed
    if [ -r $CONFFILE ] && which diff >/dev/null
    then
	if diff -q $CONFFILE $NEW >/dev/null
	then
	    rm $NEW
	else
	    backup
	fi
    else
	backup
    fi

    if ! loadkeys -q $CONFFILE; then
        $GETTEXT >&2 "Failed to load keymap!"
    fi
    # Store md5sum. debconf code uses this to track keymaps it has installed,
    # so it doesn't change ones installeed by user. Its compressed, so we
    # don't want to use the usual conffiles mechanism.
    . /usr/share/debconf/confmodule
    MD=`md5sum $CONFFILE | cut -f1 -d' ' `
    db_set console-data/bootmap-md5sum $MD
fi