diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-02-26 21:28:23 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-02-26 21:28:23 +0100 |
commit | a44e96a7df3e117b544e26e30df21a26d61ff17a (patch) | |
tree | 540a1065fe88b883afff6c310a86879ca533cd5b | |
parent | c7dbcffcd5ec6ee405ba1cf063f7b244d4a7359e (diff) |
ui function to set keymap and font + partial procedure for it
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/core/libs/lib-ui.sh | 35 | ||||
-rw-r--r-- | src/core/procedures/partial-keymap | 6 |
3 files changed, 41 insertions, 1 deletions
@@ -3,6 +3,7 @@ See also the FIXME's and TODO's in the code. CURRENT ISSUES: * grub sedding sometimes does, and sometimes doesn't work. default config remains (eg /dev/hda3) +* select timezone -> it hangs :? * when invoking /arch/aif -p interactive on a "normal" pc, it always wants to abort * check everywhere that if users cancels something, we return 1, empty string behavior etc * core/interactive: fix workaround needed for installpkg exitcode diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index aa1171c..53ff8ea 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -9,6 +9,8 @@ ANSWER=$RUNTIME_DIR/aif-dialog-answer DIA_MENU_TEXT="Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." DIA_SUCCESSIVE_ITEMS=$RUNTIME_DIR/aif-dia-successive-items +var_KEYMAP=`sed -n '/^KEYMAP/p' /etc/rc.conf | sed 's/KEYMAP=//' | sed 's/"//g'` #default keymap as configured on install CD. can be overridden +var_CONSOLEFONT=`sed -n '/^CONSOLEFONT/p' /etc/rc.conf | sed 's/KEYMAP=//' | sed 's/"//g'` #default consolefont as configured on install CD. can be overridden ### Functions that your code can use. Cli/dialog mode is fully transparant. This library takes care of it ### @@ -400,7 +402,7 @@ _dia_ask_timezone () for i in $(grep ^[A-Z] /usr/share/zoneinfo/zone.tab | cut -f 3 | sed -e 's#/.*##g'| sort -u); do REGIONS="$REGIONS $i -" done - while ! [ "$SET_ZONE" = "1" ]; do + while [ "$SET_ZONE" != "1" ]; do SET_REGION="" ask_option no "Please select a region" '' $REGIONS region=ANSWER_OPTION @@ -610,3 +612,34 @@ _cli_follow_progress () tail -f $2 #TODO: don't block anymore when it's done } + +set_keymap () +{ + KBDDIR="/usr/share/kbd" + + KEYMAPS= + for i in $(find $KBDDIR/keymaps -name "*.gz" | sort); do + KEYMAPS="$KEYMAPS ${i##$KBDDIR/keymaps/} -" + done + ask_option "$var_KEYMAP" "Select A Keymap" '' $KEYMAPS && { + loadkeys -q $KBDDIR/keymaps/$ANSWER_OPTION + var_KEYMAP=$ANSWER_OPTION + } + + FONTS= + # skip .cp.gz and partialfonts files for now see bug #6112, #6111 + for i in $(find $KBDDIR/consolefonts -maxdepth 1 ! -name '*.cp.gz' -name "*.gz" | sed 's|^.*/||g' | sort); do + FONTS="$FONTS $i -" + done + ask_option "$var_CONSOLEFONT" "Select A Console Font" '' $FONTS && { + var_CONSOLEFONT=$ANSWER_OPTION + for i in 1 2 3 4 + do + if [ -d /dev/vc ]; then + setfont $KBDDIR/consolefonts/$var_CONSOLEFONT -C /dev/vc/$i + else + setfont $KBDDIR/consolefonts/$var_CONSOLEFONT -C /dev/tty$i + fi + done + } +} diff --git a/src/core/procedures/partial-keymap b/src/core/procedures/partial-keymap new file mode 100644 index 0000000..9bb8581 --- /dev/null +++ b/src/core/procedures/partial-keymap @@ -0,0 +1,6 @@ +#!/bin/bash + +start_process () +{ + set_keymap +} |