From 6430537f55b10e4dcf6901446776623623c651ba Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sat, 20 Feb 2021 15:01:18 +0100 Subject: [PATCH] Small optimization to guard against including the common script unnecessarily --- scripts/core/sxmo_common.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/core/sxmo_common.sh b/scripts/core/sxmo_common.sh index 291f46c..30e2469 100644 --- a/scripts/core/sxmo_common.sh +++ b/scripts/core/sxmo_common.sh @@ -3,6 +3,9 @@ # This script is meant to be sourced by various sxmo scripts # and defines some common settings +# Small optimization to guard against including the script unnecessarily +[ "$SXMO_COMMON_INCLUDED" -eq 1 ] && return 0; + # we disable shellcheck SC2034 (variable not used) # for all the variables we define here @@ -13,6 +16,8 @@ export CACHEDIR="$XDG_CACHE_HOME"/sxmo # shellcheck disable=SC2034 export LOGDIR="$XDG_DATA_HOME"/sxmo/modem +command -v "$KEYBOARD" || export KEYBOARD=svkbd-mobile-intl + # This script ensures all sxmo scripts are using the busybox version of # certain coreutils rather than any other version that may be installed on the # user's computer @@ -22,7 +27,9 @@ alias pkill="busybox pkill" alias pgrep="busybox pgrep" alias xargs="busybox xargs" -[ "$SXMO_NO_ICONS" -eq 1 ] && return; +SXMO_COMMON_INCLUDED=1 + +[ "$SXMO_NO_ICONS" -eq 1 ] && return 0; #this script is meant to be sourced #the glyphs are often in the private use area and