aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Bilyk <jbilyk@gmail.com>2011-08-05 22:14:02 -0400
committerJeff Bilyk <jbilyk@gmail.com>2011-08-05 22:14:02 -0400
commit5e4f30db6bc90e55460a29f1f862ed73830d0727 (patch)
tree6cfcb75cc2675f2780eaffdbdf0ecffe349bb89a
parent9107a682412905f066c241b34cba7aa06fa1f945 (diff)
downloadalpine-conf-5e4f30db6bc90e55460a29f1f862ed73830d0727.tar.bz2
alpine-conf-5e4f30db6bc90e55460a29f1f862ed73830d0727.tar.xz
setup-keymap: add option for variant from command-line
-rwxr-xr-x[-rw-r--r--]setup-keymap.in24
1 files changed, 16 insertions, 8 deletions
diff --git a/setup-keymap.in b/setup-keymap.in
index 770af50..e3aefaa 100644..100755
--- a/setup-keymap.in
+++ b/setup-keymap.in
@@ -78,14 +78,14 @@ goodbye() {
exit $1
}
-apk_info -e bkeymaps
+apk_info -eq bkeymaps
was_installed=$?
pkg_inst bkeymaps
deflayout="$1"
+defvariant="$2"
while true; do
-
if [ -n "$deflayout" ]; then
layout="$deflayout"
unset deflayout
@@ -93,12 +93,20 @@ while true; do
select_layout
fi
- # if there is only one variant, just pick it
- count=$(ls $MAPDIR/$layout | wc -l)
- if [ $count -eq 1 ]; then
- setup_mapfile "$MAPDIR/$layout/$(ls $MAPDIR/$layout)"
- continue
+ if [ -n "$defvariant" ]; then
+ variant="$defvariant"
fi
- select_variant
+ # if variant is defined, this could match, otherwise we'll have to choose a variant
+ if [ -f "$MAPDIR/$layout/$variant.bmap" ]; then
+ setup_mapfile "$MAPDIR/$layout/$variant.bmap"
+ else
+ # if there is only one variant, just pick it
+ count=$(ls $MAPDIR/$layout | wc -l)
+ if [ $count -eq 1 ]; then
+ setup_mapfile "$MAPDIR/$layout/$(ls $MAPDIR/$layout)"
+ continue
+ fi
+ select_variant
+ fi
done