summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-01-08 15:31:56 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2021-01-08 15:31:56 +0100
commite5c17c7326676a78a09295baccabd83b10a69e33 (patch)
tree51d2063fa4561b04aef4ed1cb203277d7bae0704
parent55e3061bfd713c4197e568e07bc0542f30a39970 (diff)
downloadalpine-conf-e5c17c7326676a78a09295baccabd83b10a69e33.zip
setup-keymap: code clean. use ask
-rw-r--r--setup-keymap.in19
1 files changed, 8 insertions, 11 deletions
diff --git a/setup-keymap.in b/setup-keymap.in
index 21ba2ac..4a57fde 100644
--- a/setup-keymap.in
+++ b/setup-keymap.in
@@ -29,21 +29,18 @@ show_variants() {
select_layout() {
while true; do
- if [ -z "$layout" ]; then
+ if [ -z "$layout" ] || ! [ -d "$MAPDIR/$layout" ]; then
layout=none
fi
echo "Available keyboard layouts:"
show_layouts
- echon "Select keyboard layout [$layout]: "
- default_read layout "$layout"
- if [ "$layout" = "abort" ] || [ "$layout" = "none" ] ; then
+ ask "Select keyboard layout:" "$layout"
+ if [ "$resp" = "abort" ] || [ "$resp" = "none" ] ; then
goodbye 0
fi
- set -- $layout
- if [ $# -eq 2 ]; then
- layout="$1"
- variant="$2"
- fi
+ set -- $resp
+ layout="$1"
+ variant="$2"
if [ -d "$MAPDIR/$layout" ] ; then
return 0
fi
@@ -72,8 +69,8 @@ select_variant() {
if [ ! -f "$MAPDIR/$layout/$variant.bmap" ] ; then
variant=""
fi
- echon "Select variant [$variant]: "
- default_read variant "$variant"
+ ask "Select variant (or 'abort'):" "$variant"
+ variant="$resp"
if [ "$variant" = "abort" ] || [ "$variant" = "none" ]; then
break;
fi