diff options
author | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:19:12 (GMT) |
---|---|---|
committer | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:19:12 (GMT) |
commit | 0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch) | |
tree | c0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core-testing/linhes-live/bin/km | |
download | linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2 |
initial import
Diffstat (limited to 'abs/core-testing/linhes-live/bin/km')
-rwxr-xr-x | abs/core-testing/linhes-live/bin/km | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/abs/core-testing/linhes-live/bin/km b/abs/core-testing/linhes-live/bin/km new file mode 100755 index 0000000..386d966 --- /dev/null +++ b/abs/core-testing/linhes-live/bin/km @@ -0,0 +1,76 @@ +#!/bin/sh +# $Id: km,v 1.2 2005/12/13 04:14:53 judd Exp $ +# Modified by gradgrind to deal only with i386 keymaps +# and BASEDIR changed +# - also saves results to /etc/rc.conf + +# test if the script is started by root user. If not, exit +if [ $UID -ne 0 ]; then + echo "This should be run as root"; exit 1 +fi + +ANSWER="/tmp/.km" +BASEDIR="/usr/share/kbd" + +domenu() +{ + menutype=$1 ; shift + text=$1 ; shift + height=$1 ; shift + width=$1 ; shift + mheight=$1 ; shift + + dialog --cancel-label "Skip" --$menutype "$text" $height $width $mheight $* +} + +if [ ! -d $BASEDIR/keymaps ]; then + echo "Cannot load keymaps, as none were found in $BASEDIR/keymaps" >&2 + exit 1 +else + echo "Scanning for keymaps..." + KEYMAPS= + for t in qwerty qwertz azerty dvorak; do + for i in `find $BASEDIR/keymaps/i386/$t -follow -name "*.gz"`; do + fn=`echo $i | sed "s|$BASEDIR/keymaps/i386/||"` + KEYMAPS="$KEYMAPS $fn -" + done + done + domenu menu "Select A Keymap" 22 60 16 $KEYMAPS 2>$ANSWER + keymap=`cat $ANSWER` +fi + +if [ ! -d $BASEDIR/consolefonts ]; then + echo "Cannot load consolefonts, as none were found in $BASEDIR/consolefonts" >&2 +else + echo "Scanning for fonts..." + FONTS= + for i in `find $BASEDIR/consolefonts -follow -name "*.gz"`; do + fn=`echo $i | sed "s|$BASEDIR/consolefonts/||"` + FONTS="$FONTS $fn -" + done + domenu menu "Select A Console Font" 22 60 16 $FONTS 2>$ANSWER + font=`cat $ANSWER` +fi + +if [ "$keymap" ]; then + echo "Loading keymap: $keymap" + loadkeys -q $BASEDIR/keymaps/i386/$keymap + sed -i "s|^KEYMAP=.*|KEYMAP=\"$( echo $keymap | \ + cut -d'.' -f1 )\"|" /etc/rc.conf +fi + +if [ "$font" ]; then + echo "Loading font: $font" + for i in `seq 1 4`; do + if [ -d /dev/vc ]; then + setfont $BASEDIR/consolefonts/$font -C /dev/vc/${i} + else + setfont $BASEDIR/consolefonts/$font -C /dev/tty${i} + fi + done + sed -i "s|^CONSOLEFONT=.*|CONSOLEFONT=\"$( echo $font | \ + cut -d'.' -f1 )\"|" /etc/rc.conf +fi + +exit 0 + |