diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2018-05-02 13:48:05 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2018-05-02 13:48:05 +0300 |
commit | 08ee8136d57a4499c0545e48c83c4ffe71c6acd5 (patch) | |
tree | 125d1f6fa3953628f1d7bab9e8ecafeadb233aca /include/parameters | |
parent | 9f7aeb3e21f76cdd8d1726386bc1c00213023c40 (diff) |
Check for available parameter when using profile or plugindir
Diffstat (limited to 'include/parameters')
-rw-r--r-- | include/parameters | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/include/parameters b/include/parameters index a7f3f4af..e665c6cb 100644 --- a/include/parameters +++ b/include/parameters @@ -279,22 +279,32 @@ # Define a custom profile file --profile) - shift - SEARCH_PROFILES=$1 + if [ $# -gt 1 ]; then + shift + SEARCH_PROFILES=$1 + else + echo "Specify the profile (lynis audit system --profile /home/michael/myprofile.prf)" + exit 1 + fi ;; # Define a custom plugin directory --plugindir | --plugin-dir | --plugins-dir) - shift - PLUGINDIR=$1 - LASTCHAR=$(echo $1 | awk '{ print substr($0, length($0))}') - if [ "${LASTCHAR}" = "/" ]; then - echo "${RED}Error:${WHITE} plugin directory path should not end with a slash${NORMAL}" - ExitCustom 65 - fi - if [ ! -d ${PLUGINDIR} ]; then - echo "${RED}Error:${WHITE} invalid plugin directory ${PLUGINDIR}${NORMAL}" - ExitCustom 66 + if [ $# -gt 1 ]; then + shift + PLUGINDIR=$1 + LASTCHAR=$(echo $1 | awk '{ print substr($0, length($0))}') + if [ "${LASTCHAR}" = "/" ]; then + echo "${RED}Error:${WHITE} plugin directory path should not end with a slash${NORMAL}" + ExitCustom 65 + fi + if [ ! -d ${PLUGINDIR} ]; then + echo "${RED}Error:${WHITE} invalid plugin directory ${PLUGINDIR}${NORMAL}" + ExitCustom 66 + fi + else + echo "Specify the plugin directory (lynis audit system --plugindir /home/michael/plugins)" + exit 1 fi ;; |