summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-09-26 19:11:48 +0200
committeranonym <anonym@riseup.net>2016-02-11 17:29:08 +0100
commit364a3c8d14ffb37ba23005177ccdb3d74f42c424 (patch)
tree1848ec9b139b4b0eecb4b29407b852d1318cc365 /config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
parentbbc2d6ca07d90caa9a8a3ecd09cc5393159c09fc (diff)
Avoid set -u issue when testing if variable is set or not.
Whenever there's a risk that we will reference a shell variable in a script run with `set -u` (including libraries that we sources from such scripts) we must reference the variable in a way so it gets a default value, i.e. `${VAR:-}` to give it the empty string as the default (which is what generally makes sense). In particular, it's quite clear that in all cases where we do something like `[ -n "${VAR}" ]` or `[ -z "${VAR}" ]`, where an expected value is the empty string, which could mean that the variable is not initialized, we should give such a default (as the empty string).
Diffstat (limited to 'config/chroot_local-includes/usr/local/lib/tails-configure-keyboard')
-rwxr-xr-xconfig/chroot_local-includes/usr/local/lib/tails-configure-keyboard4
1 files changed, 2 insertions, 2 deletions
diff --git a/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard b/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
index c648133..8eb6edc 100755
--- a/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
+++ b/config/chroot_local-includes/usr/local/lib/tails-configure-keyboard
@@ -5,7 +5,7 @@ set -eu
# Get $XKBMODEL, $XKBLAYOUT, $XKBVARIANT and $XKBOPTIONS
. /var/lib/tails-user-session/keyboard
-if [ -z "$XKBVARIANT" ] ; then
+if [ -z "${XKBVARIANT:-}" ] ; then
XKBCONF="$XKBLAYOUT"
else
XKBCONF="$XKBLAYOUT+$XKBVARIANT"
@@ -51,7 +51,7 @@ esac
# Configure enabled input methods and their preferred order
dconf write /desktop/ibus/general/preload-engines "$PRELOAD"
dconf write /org/gnome/desktop/input-sources/sources "$SOURCES"
-if [ -n "$XKBOPTIONS" ] ; then
+if [ -n "${XKBOPTIONS:-}" ] ; then
dconf write /org/gnome/desktop/input-sources/xkb-options "$XKBOPTIONS"
fi