Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / lib / dpkg / info / | server ip : 104.21.89.46 your ip : 172.70.80.31 H O M E |
Filename | /var/lib/dpkg/info/keyboard-configuration.postinst |
Size | 4.63 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 29-Jan-2014 21:39 |
Last accessed | 06-Jul-2025 22:04 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#!/bin/sh
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
# The same as /usr/bin/which - in order to make "which" available before
# /usr is mounted
which () {
local IFS
IFS=:
for i in $PATH; do
if [ -x "$i/$1" ]; then
echo "$i/$1"
return 0
fi
done
return 1
}
# In d-i the config script is not executed automatically
if [ -f /usr/share/console-setup-mini/keyboard-configuration.config ]; then
/usr/share/console-setup-mini/keyboard-configuration.config || exit $?
fi
keyboard_present () {
local kern kbdpattern class subclass protocol
kern=`uname -r`
case "$kern" in
1*|2.0*|2.1*|2.2*|2.3*|2.4*|2.5*)
# can't check keyboard presence
return 0;
;;
esac
[ -f /proc/bus/input/devices ] || return 0
kbdpattern="AT Set \|AT Translated Set\|AT Raw Set"
kbdpattern="$kbdpattern\|Atari Keyboard"
kbdpattern="$kbdpattern\|Amiga Keyboard"
kbdpattern="$kbdpattern\|HIL keyboard"
kbdpattern="$kbdpattern\|ADB keyboard"
kbdpattern="$kbdpattern\|Sun Type"
if grep -i "$kbdpattern" /proc/bus/input/devices >/dev/null; then
return 0
fi
[ -d /sys/bus/usb/devices ] || return 0
for d in /sys/bus/usb/devices/*:*; do
class=$(cat "$d/bInterfaceClass") # 03 = Human Interface Device
subclass=$(cat "$d/bInterfaceSubClass") # 01 = Boot Interface Subclass
protocol=$(cat "$d/bInterfaceProtocol") # 01 = Keyboard
case "$class:$subclass:$protocol" in
03:01:01)
return 0
;;
esac
done
return 1
}
# keyboard_present () {
# if there is a keyboard; then
# return 0
# else
# return 1
# fi
# }
CONFIGFILE=/etc/default/keyboard
if [ "$1" = "configure" ]; then
db_get keyboard-configuration/modelcode
model="$RET"
db_get keyboard-configuration/layoutcode
layout="$RET"
db_get keyboard-configuration/variantcode
variant="$RET"
db_get keyboard-configuration/optionscode
options="$RET"
if [ ! -e $CONFIGFILE ]; then
cat /usr/share/console-setup/keyboard \
/usr/share/console-setup-mini/keyboard \
2>/dev/null >$CONFIGFILE || true
fi
# Ensure we do not mess up the config file's ownership and permissions.
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
# If the admin deleted or commented some variables but then set
# them via debconf, (re-)add them to the conffile.
for var in XKBMODEL XKBLAYOUT XKBVARIANT XKBOPTIONS; do
if ! grep "^ *${var}=" $CONFIGFILE >/dev/null; then
echo "${var}=" >>$CONFIGFILE
fi
done
sed \
-e "s|^ *XKBMODEL=.*|XKBMODEL=\"$model\"|" \
-e "s|^ *XKBLAYOUT=.*|XKBLAYOUT=\"$layout\"|" \
-e "s|^ *XKBVARIANT=.*|XKBVARIANT=\"$variant\"|" \
-e "s|^ *XKBOPTIONS=.*|XKBOPTIONS=\"$options\"|" \
<$CONFIGFILE >$CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
db_set keyboard-configuration/store_defaults_in_debconf_db true
fi
if type plymouth >/dev/null && plymouth --ping; then
# setting the keymap breaks with plymouth in raw mode, and setting the
# font will currently also break if on vgacon
if type setupcon >/dev/null 2>&1; then
setupcon --save-only
fi
elif keyboard_present; then
if [ "$DISPLAY" ] && which setxkbmap >/dev/null; then
setxkbmap -option '' -model "$model" "$layout" "$variant" "$options" || true
# setting the font corrupts X
if type setupcon >/dev/null 2>&1; then
setupcon --save-only
setupcon --force -k
cat >&2 <<EOF
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
EOF
fi
else
if type setupcon >/dev/null 2>&1; then
setupcon --force --save
fi
fi
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/console-setup" ]; then
if [ ! -e "/etc/init/console-setup.conf" ]; then
update-rc.d console-setup start 49 S . >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f console-setup remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installudev
if [ "$1" = configure ]; then
if [ -e "/etc/udev/rules.d/85_keyboard-configuration.rules" ]; then
echo "Preserving user changes to /etc/udev/rules.d/85-keyboard-configuration.rules ..."
if [ -e "/etc/udev/rules.d/85-keyboard-configuration.rules" ]; then
mv -f "/etc/udev/rules.d/85-keyboard-configuration.rules" "/etc/udev/rules.d/85-keyboard-configuration.rules.dpkg-new"
fi
mv -f "/etc/udev/rules.d/85_keyboard-configuration.rules" "/etc/udev/rules.d/85-keyboard-configuration.rules"
fi
fi
# End automatically added section
if type update-initramfs >/dev/null 2>&1; then
update-initramfs -u
fi
exit 0
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
# The same as /usr/bin/which - in order to make "which" available before
# /usr is mounted
which () {
local IFS
IFS=:
for i in $PATH; do
if [ -x "$i/$1" ]; then
echo "$i/$1"
return 0
fi
done
return 1
}
# In d-i the config script is not executed automatically
if [ -f /usr/share/console-setup-mini/keyboard-configuration.config ]; then
/usr/share/console-setup-mini/keyboard-configuration.config || exit $?
fi
keyboard_present () {
local kern kbdpattern class subclass protocol
kern=`uname -r`
case "$kern" in
1*|2.0*|2.1*|2.2*|2.3*|2.4*|2.5*)
# can't check keyboard presence
return 0;
;;
esac
[ -f /proc/bus/input/devices ] || return 0
kbdpattern="AT Set \|AT Translated Set\|AT Raw Set"
kbdpattern="$kbdpattern\|Atari Keyboard"
kbdpattern="$kbdpattern\|Amiga Keyboard"
kbdpattern="$kbdpattern\|HIL keyboard"
kbdpattern="$kbdpattern\|ADB keyboard"
kbdpattern="$kbdpattern\|Sun Type"
if grep -i "$kbdpattern" /proc/bus/input/devices >/dev/null; then
return 0
fi
[ -d /sys/bus/usb/devices ] || return 0
for d in /sys/bus/usb/devices/*:*; do
class=$(cat "$d/bInterfaceClass") # 03 = Human Interface Device
subclass=$(cat "$d/bInterfaceSubClass") # 01 = Boot Interface Subclass
protocol=$(cat "$d/bInterfaceProtocol") # 01 = Keyboard
case "$class:$subclass:$protocol" in
03:01:01)
return 0
;;
esac
done
return 1
}
# keyboard_present () {
# if there is a keyboard; then
# return 0
# else
# return 1
# fi
# }
CONFIGFILE=/etc/default/keyboard
if [ "$1" = "configure" ]; then
db_get keyboard-configuration/modelcode
model="$RET"
db_get keyboard-configuration/layoutcode
layout="$RET"
db_get keyboard-configuration/variantcode
variant="$RET"
db_get keyboard-configuration/optionscode
options="$RET"
if [ ! -e $CONFIGFILE ]; then
cat /usr/share/console-setup/keyboard \
/usr/share/console-setup-mini/keyboard \
2>/dev/null >$CONFIGFILE || true
fi
# Ensure we do not mess up the config file's ownership and permissions.
cp -a -f $CONFIGFILE $CONFIGFILE.tmp
# If the admin deleted or commented some variables but then set
# them via debconf, (re-)add them to the conffile.
for var in XKBMODEL XKBLAYOUT XKBVARIANT XKBOPTIONS; do
if ! grep "^ *${var}=" $CONFIGFILE >/dev/null; then
echo "${var}=" >>$CONFIGFILE
fi
done
sed \
-e "s|^ *XKBMODEL=.*|XKBMODEL=\"$model\"|" \
-e "s|^ *XKBLAYOUT=.*|XKBLAYOUT=\"$layout\"|" \
-e "s|^ *XKBVARIANT=.*|XKBVARIANT=\"$variant\"|" \
-e "s|^ *XKBOPTIONS=.*|XKBOPTIONS=\"$options\"|" \
<$CONFIGFILE >$CONFIGFILE.tmp
mv -f $CONFIGFILE.tmp $CONFIGFILE
db_set keyboard-configuration/store_defaults_in_debconf_db true
fi
if type plymouth >/dev/null && plymouth --ping; then
# setting the keymap breaks with plymouth in raw mode, and setting the
# font will currently also break if on vgacon
if type setupcon >/dev/null 2>&1; then
setupcon --save-only
fi
elif keyboard_present; then
if [ "$DISPLAY" ] && which setxkbmap >/dev/null; then
setxkbmap -option '' -model "$model" "$layout" "$variant" "$options" || true
# setting the font corrupts X
if type setupcon >/dev/null 2>&1; then
setupcon --save-only
setupcon --force -k
cat >&2 <<EOF
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
EOF
fi
else
if type setupcon >/dev/null 2>&1; then
setupcon --force --save
fi
fi
fi
# Automatically added by dh_installinit
if [ -x "/etc/init.d/console-setup" ]; then
if [ ! -e "/etc/init/console-setup.conf" ]; then
update-rc.d console-setup start 49 S . >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f console-setup remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_installudev
if [ "$1" = configure ]; then
if [ -e "/etc/udev/rules.d/85_keyboard-configuration.rules" ]; then
echo "Preserving user changes to /etc/udev/rules.d/85-keyboard-configuration.rules ..."
if [ -e "/etc/udev/rules.d/85-keyboard-configuration.rules" ]; then
mv -f "/etc/udev/rules.d/85-keyboard-configuration.rules" "/etc/udev/rules.d/85-keyboard-configuration.rules.dpkg-new"
fi
mv -f "/etc/udev/rules.d/85_keyboard-configuration.rules" "/etc/udev/rules.d/85-keyboard-configuration.rules"
fi
fi
# End automatically added section
if type update-initramfs >/dev/null 2>&1; then
update-initramfs -u
fi
exit 0