Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2016-06-11 15:34:21 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-06-11 15:34:21 +0300
commitf8b134f3c3c9571f173835c3437f4e023d23e605 (patch)
tree56a4ff1781b7715df7407986f97a5a5f7420c400
parent18c3984b206f9863ecf4293fc15ffbe1ec5f1fdb (diff)
Add automatic detection of used language
-rw-r--r--include/consts1
-rw-r--r--include/profiles1
-rwxr-xr-xlynis13
3 files changed, 10 insertions, 5 deletions
diff --git a/include/consts b/include/consts
index 590077a1..787688b2 100644
--- a/include/consts
+++ b/include/consts
@@ -93,7 +93,6 @@ unset LANG
HOSTID=""
IDS_IPS_TOOL_FOUND=0
IPTABLESBINARY=""
- LANGUAGE="en-US"
LINUX_VERSION=""
LINUXCONFIGFILE=""
LMDBINARY=""
diff --git a/include/profiles b/include/profiles
index 693d3b1d..95b57ff4 100644
--- a/include/profiles
+++ b/include/profiles
@@ -128,6 +128,7 @@
# Language
language | lang)
+ LogText "Language set via profile to ${VALUE}"
LANGUAGE="${VALUE}"
;;
diff --git a/lynis b/lynis
index 96617058..2b2c9d5e 100755
--- a/lynis
+++ b/lynis
@@ -91,12 +91,15 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta
done
# Import translations. First import English to prefill all texts
- if [ ! -f ${DBDIR}/languages/en-US ]; then
- echo "Could not find languages directory (file: ${DBDIR}/languages/en-US)"
+ if [ ! -f ${DBDIR}/languages/en ]; then
+ echo "Could not find languages directory (file: ${DBDIR}/languages/en)"
exit 1
else
- . ${DBDIR}/languages/en-US
+ . ${DBDIR}/languages/en
fi
+
+ # Auto detection of language based on locale (first two characters)
+ LANGUAGE=$(locale | egrep "^LANGUAGE=" | cut -d= -f2 | cut -d_ -f1)
#
#################################################################################
#
@@ -549,7 +552,8 @@ ${NORMAL}
. ${INCLUDEDIR}/profiles
# Import a different language when configured
- if [ ! "${LANGUAGE}" = "en-US" ]; then
+ if [ ! "${LANGUAGE}" = "en" ]; then
+ LogText "Language is set to ${LANGUAGE}"
if [ ! -f ${DBDIR}/languages/${LANGUAGE} ]; then
Display "Warning: could not find languages directory (file: ${DBDIR}/languages/${LANGUAGE})"
else
@@ -557,6 +561,7 @@ ${NORMAL}
. ${DBDIR}/languages/${LANGUAGE}
fi
fi
+ LogTextBreak
#
#################################################################################
#