Use full paths when local directory is used for includedir or dbdir

This commit is contained in:
Michael Boelen 2016-05-15 13:41:03 +02:00
parent 098f7685fc
commit 26c67e4ec6
2 changed files with 20 additions and 19 deletions

View File

@ -132,11 +132,7 @@ if [ $# -gt 0 ]; then
fi
;;
"dbdir")
SHOW_DBDIR="${DBDIR}"
if [ "${DBDIR}" = "./db" ]; then
if [ -d ${WORKDIR}/db ]; then SHOW_DBDIR="${WORKDIR}/db"; fi
fi
${ECHOCMD} "${SHOW_DBDIR}"
${ECHOCMD} "${DBDIR}"
;;
"help")
if [ $# -eq 1 ]; then
@ -163,11 +159,7 @@ if [ $# -gt 0 ]; then
fi
;;
"includedir")
SHOW_INCLUDEDIR="${INCLUDEDIR}"
if [ "${INCLUDEDIR}" = "./include" ]; then
if [ -d ${WORKDIR}/include ]; then SHOW_INCLUDEDIR="${WORKDIR}/include"; fi
fi
${ECHOCMD} "${SHOW_INCLUDEDIR}"
${ECHOCMD} "${INCLUDEDIR}"
;;
"license") ${ECHOCMD} "${PROGRAM_LICENSE}" ;;
"man") ${ECHOCMD} "Use ./lynis --man or man lynis" ;;

27
lynis
View File

@ -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)
#
#################################################################################
#