diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2016-05-15 14:41:03 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2016-05-15 14:41:03 +0300 |
commit | 26c67e4ec677980b169b2056dff0e5315c2735d1 (patch) | |
tree | 2b1723c0128202a9f8afba7c7435d0ebce5587d0 /lynis | |
parent | 098f7685fc35ce8149b3107efd466b9e61b7dc4b (diff) |
Use full paths when local directory is used for includedir or dbdir
Diffstat (limited to 'lynis')
-rwxr-xr-x | lynis | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -56,11 +56,20 @@ # ################################################################################# # + # Work directory + WORKDIR=`pwd` + # Test from which directories we can use all functions and tests INCLUDEDIR="" # Set default include directory to none tINCLUDE_TARGETS="/usr/local/include/lynis /usr/local/lynis/include /usr/share/lynis/include ./include" # Default paths to check (CWD as last option, in case we run from standalone) - for I in ${tINCLUDE_TARGETS}; do if [ -d ${I} ]; then INCLUDEDIR=${I}; fi; done + for I in ${tINCLUDE_TARGETS}; do + if [ "${I}" = "./include" ]; then + if [ -d ${WORKDIR}/include ]; then INCLUDEDIR="${WORKDIR}/include"; fi + elif [ -d ${I} ]; then + INCLUDEDIR=${I} + fi + done # Drop out if our include directory can't be found if [ "${INCLUDEDIR}" = "" ]; then @@ -73,7 +82,13 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta # Test for database directory DBDIR=""; tDB_TARGETS="/usr/local/share/lynis/db /usr/local/lynis/db /usr/share/lynis/db ./db" - for I in ${tDB_TARGETS}; do if [ -d ${I} ]; then DBDIR=${I}; fi; done + for I in ${tDB_TARGETS}; do + if [ "${I}" = "./db" ]; then + if [ -d ${WORKDIR}/db ]; then DBDIR="${WORKDIR}/db"; fi + elif [ -d ${I} ]; then + DBDIR="${I}" + fi + done # ################################################################################# # @@ -88,13 +103,7 @@ Make sure to execute ${PROGRAM_NAME} from untarred directory or check your insta # ################################################################################# # - WORKDIR=`pwd` -# -################################################################################# -# - -# Consts -# (bin paths, text strings, colors) +# Consts (bin paths, text strings, colors) # ################################################################################# # |