diff options
-rw-r--r-- | default.prf | 3 | ||||
-rw-r--r-- | include/consts | 1 | ||||
-rw-r--r-- | include/profiles | 5 | ||||
-rwxr-xr-x | lynis | 24 |
4 files changed, 30 insertions, 3 deletions
diff --git a/default.prf b/default.prf index dd5b939e..d688c2f4 100644 --- a/default.prf +++ b/default.prf @@ -388,6 +388,9 @@ config:compliance_standards:cis,hipaa,iso27001,pci-dss: # Show non-zero exit code when warnings are found (default: no) #error-on-warnings=yes +# Set output to a different language +#language=es + # Enable quick mode (no waiting for keypresses, same as --quick option) #quick=yes diff --git a/include/consts b/include/consts index 787688b2..590077a1 100644 --- a/include/consts +++ b/include/consts @@ -93,6 +93,7 @@ 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 fe44b060..693d3b1d 100644 --- a/include/profiles +++ b/include/profiles @@ -126,6 +126,11 @@ GROUP_NAME="${VALUE}" ;; + # Language + language | lang) + LANGUAGE="${VALUE}" + ;; + # Lynis Enterprise license key license_key | license-key) LICENSE_KEY="${VALUE}" @@ -89,6 +89,14 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta DBDIR="${I}" fi 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)" + exit 1 + else + . ${DBDIR}/languages/en-US + fi # ################################################################################# # @@ -432,7 +440,7 @@ ${YELLOW}Note: ${WHITE}Cancelling the program can leave temporary files behind${ echo " ${RED}Error${NORMAL}: ${WHITE}Invalid option '${WRONGOPTION_value}'${NORMAL}" else if [ ${VIEWHELP} -eq 0 ]; then - echo " ${RED}No command specified.${WHITE} Exiting..${NORMAL}" + echo " ${RED}No command provided.${WHITE} Exiting..${NORMAL}" echo "" fi fi @@ -533,12 +541,22 @@ ${NORMAL} # ################################################################################# # -# Read profile/template/plugins +# Read profile/language # ################################################################################# # SafePerms ${INCLUDEDIR}/profiles . ${INCLUDEDIR}/profiles + + # Import a different language when configured + if [ ! "${LANGUAGE}" = "en-US" ]; then + if [ ! -f ${DBDIR}/languages/${LANGUAGE} ]; then + Display "Warning: could not find languages directory (file: ${DBDIR}/languages/${LANGUAGE})" + else + LogText "Importing language file (${DBDIR}/languages/${LANGUAGE})" + . ${DBDIR}/languages/${LANGUAGE} + fi + fi # ################################################################################# # @@ -767,7 +785,7 @@ ${NORMAL} PLUGIN_PHASE=$1 if [ ${PLUGIN_PHASE} -eq 0 -o ${PLUGIN_PHASE} -gt 2 ]; then echo "Incorrect phase number when calling RunPlugins"; ExitFatal; fi LogTextBreak - InsertPluginSection "Plugins (phase ${PLUGIN_PHASE})" + InsertPluginSection "Plugins (${GEN_PHASE} ${PLUGIN_PHASE})" if [ ${PLUGIN_PHASE} -eq 1 ]; then Display --text "Note: plugins have more extensive tests, which may take a few minutes to complete" Display --text " " |