diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-08-13 17:38:07 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-08-13 17:38:07 +0300 |
commit | e06db1477dde001f47f0cc3d08afe3a568055ffc (patch) | |
tree | de3a05887576b640574ec2d8376a5e8336d036bc | |
parent | 67a636f351d049eef694cd07aa82cd75b2339f98 (diff) |
Add notebook hardware detection
-rw-r--r-- | include/consts | 1 | ||||
-rw-r--r-- | include/functions | 21 | ||||
-rwxr-xr-x | lynis | 3 |
3 files changed, 23 insertions, 2 deletions
diff --git a/include/consts b/include/consts index 7f07aa8a..3cbf02f7 100644 --- a/include/consts +++ b/include/consts @@ -198,6 +198,7 @@ unset LANG SSL_CERTIFICATE_PATHS="" SYSLOGNGBINARY="" SYSTEMCTLBINARY="" + SYSTEM_IS_NOTEBOOK=255 TEMP_FILE="" TEMP_FILES="" TEST_SKIP_ALWAYS="" diff --git a/include/functions b/include/functions index f68c84fc..748dd77a 100644 --- a/include/functions +++ b/include/functions @@ -53,8 +53,9 @@ # IsDebug Check if --debug is used # IsDeveloperMode Check if --developer is used # IsDeveloperVersion Check if program is a developer release -# IsRunning Check if a process is running +# IsNotebook System detection # IsOwnedByRoot Determine if file or directory is owned by root +# IsRunning Check if a process is running # IsVerbose Check if --verbose is used # IsVirtualMachine Check if this system is a virtual machine # IsWorldExecutable Check if a file is world executable @@ -1118,6 +1119,24 @@ ################################################################################ + # Name : IsNotebook + # Description : Check if file or directory is owned by root + # Returns : 0 (true), 1 (false), or 255 (unknown) + ################################################################################ + + IsNotebook() { + FIND=$(which laptop-detect 2> /dev/null) + if [ ! -z "${FIND}" ]; then + Debug "Testing if we are a notebook" + laptop-detect + if [ $? -eq 0 ]; then SYSTEM_IS_NOTEBOOK=1; Debug "System is a notebook according to laptop-detect" + elif [ $? -eq 1 ]; then SYSTEM_IS_NOTEBOOK=0; Debug "System is a NOT a notebook according to laptop-detect"; fi + Report "notebook=${SYSTEM_IS_NOTEBOOK}" + fi + } + + + ################################################################################ # Name : IsOwnedByRoot # Description : Check if file or directory is owned by root # Returns : 0 (true), 1 (false), or 255 (unknown) @@ -747,8 +747,9 @@ ${NORMAL} # ################################################################################# # - # Check if this is a virtual machine (after the appropriate binaries are found) + # Use hardware detection capabilities IsVirtualMachine + IsNotebook # ################################################################################# # |