diff --git a/include/helper_show b/include/helper_show index 5e580f28..6cc9d0c3 100644 --- a/include/helper_show +++ b/include/helper_show @@ -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" ;; diff --git a/lynis b/lynis index da12f6d8..8fc594b9 100755 --- a/lynis +++ b/lynis @@ -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) # ################################################################################# #