aboutsummaryrefslogtreecommitdiffstats
path: root/gotrc-examples/loadkeys
diff options
context:
space:
mode:
Diffstat (limited to 'gotrc-examples/loadkeys')
-rw-r--r--gotrc-examples/loadkeys34
1 files changed, 16 insertions, 18 deletions
diff --git a/gotrc-examples/loadkeys b/gotrc-examples/loadkeys
index b3b2352..f755656 100644
--- a/gotrc-examples/loadkeys
+++ b/gotrc-examples/loadkeys
@@ -2,7 +2,7 @@
# gates-of-tartaros – Minimal replacement for agetty with SSH support
#
-# Copyright © 2013, 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+# Copyright © 2013, 2014, 2015 Mattias Andrée (m@maandree.se)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,22 +26,20 @@
login_function_loadkeys=$login_function
login_function=_login_loadkeys
-_login_loadkeys ()
-{
- if [ "${user}" = "" ]; then
- printf '%s' 'Keyboard layout: '
- $read_function
- if [ ! "${user}" = "" ]; then
- user_="$(printf "%s" "${user}" | sed 's:/::g')"
- if [ "${user}" = "${user_}" ]; then
- loadkeys -C $(tty) -- ${user} || sleep 2
- else
- echo 'Sorry, only installed keymaps!'
- sleep 2
- fi
+_login_loadkeys () {
+ if test -z "${user}"; then
+ printf 'Keyboard layout: '
+ $read_function
+ if test -n "${user}"; then
+ user_="$(printf "%s" "${user}" | tr -d /)"
+ if test "${user}" = "${user_}"; then
+ loadkeys -C $(tty) -- ${user} || sleep 2
+ else
+ printf 'Sorry, only installed keymaps!\n'
+ sleep 2
+ fi
+ fi
+ else
+ $login_function_loadkeys
fi
- else
- $login_function_loadkeys
- fi
}
-