diff options
author | Daniel Romell <dromell@users.noreply.github.com> | 2017-06-21 15:17:49 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2017-06-21 15:17:49 +0300 |
commit | 5b12f17e3fc29e07862bd2e60d8680fdd07cba1d (patch) | |
tree | b86b3458dfd04eeee80ffd047ce83608cd5b2764 | |
parent | ac2c83870bdefd98ed4c54d53eaa0cb35c6dbfb9 (diff) |
Minor fixes for embedded Linux. (#406)
* Check if the "locale" binary is available before using it.
This is no functional change as it will still fall back to english
when the locale can't be determined. This fix gets rid of the
following error when running on systems without the locale binary:
./lynis: line 112: locale: command not found
Signed-off-by: Daniel Romell <daro@hms.se>
* tests_kernel: KRNL-5677: Fix invalid use of shell test.
This fixes an issue (syntax error) triggered on systems with no PAE or
NX extensions:
- Checking CPU support (NX/PAE)
/usr/libexec/lynis/include/tests_kernel: line 126: [: too many arguments
/usr/libexec/lynis/include/tests_kernel: line 132: [: too many arguments
No need to use [] when only looking at function return values.
Signed-off-by: Daniel Romell <daro@hms.se>
-rw-r--r-- | include/tests_kernel | 4 | ||||
-rwxr-xr-x | lynis | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/tests_kernel b/include/tests_kernel index 494680a1..fb88a467 100644 --- a/include/tests_kernel +++ b/include/tests_kernel @@ -123,13 +123,13 @@ Report "cpu_nx=1" FOUND=1 else - if [ HasData "${FIND_PAE}" -a IsEmpty "${FIND_NX}" ]; then + if HasData "${FIND_PAE}" && IsEmpty "${FIND_NX}"; then Report "cpu_pae=1" LogText "Result: found PAE" CPU_PAE=1 FOUND=1 else - if [ HasData "${FIND_NX}" -a IsEmpty "${FIND_PAE}" ]; then + if HasData "${FIND_NX}" && IsEmpty "${FIND_PAE}"; then Report "cpu_nx=1" LogText "Result: found No eXecute" CPU_NX=1 @@ -109,7 +109,9 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta fi # Auto detection of language based on locale (first two characters). Set to English when nothing found. - LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$") + if [ -x "$(command -v locale)" ]; then + LANGUAGE=$(locale | egrep "^LANG=" | cut -d= -f2 | cut -d_ -f1 | egrep "^[a-z]{2}$") + fi if [ -z "${LANGUAGE}" ]; then #Debug "Result: no (valid) language found, setting to default language (en)" LANGUAGE="en" |