mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-25 23:05:01 +02:00
Only test if we have locale command, which is not always available (like Alpine in Docker container)
This commit is contained in:
parent
e7d6aaa44d
commit
c1c23a4cca
8
lynis
8
lynis
@ -213,14 +213,14 @@
|
|||||||
#
|
#
|
||||||
# Auto detection of language based on shell LANG variable. This is required by the Display() function to deal with multi-bytes characters.
|
# Auto detection of language based on shell LANG variable. This is required by the Display() function to deal with multi-bytes characters.
|
||||||
DISPLAY_LANG="${LANG:-}"
|
DISPLAY_LANG="${LANG:-}"
|
||||||
# Try locale command if shell variable had no value
|
|
||||||
if [ -z "${DISPLAY_LANG}" ]; then
|
|
||||||
DISPLAY_LANG=$(locale | egrep "^LANG=" | cut -d= -f2)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the short notation of the language (first two characters).
|
# Extract the short notation of the language (first two characters).
|
||||||
if [ -x "$(command -v locale 2> /dev/null)" ]; then
|
if [ -x "$(command -v locale 2> /dev/null)" ]; then
|
||||||
LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$")
|
LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$")
|
||||||
|
# Try locale command if shell variable had no value
|
||||||
|
if [ -z "${DISPLAY_LANG}" ]; then
|
||||||
|
DISPLAY_LANG=$(locale | egrep "^LANG=" | cut -d= -f2)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set default language: 'en' (English) if no value is set
|
# Set default language: 'en' (English) if no value is set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user