mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-29 00:34:14 +02:00
Check for available parameter when using profile or plugindir
This commit is contained in:
parent
9f7aeb3e21
commit
08ee8136d5
@ -279,22 +279,32 @@
|
|||||||
|
|
||||||
# Define a custom profile file
|
# Define a custom profile file
|
||||||
--profile)
|
--profile)
|
||||||
shift
|
if [ $# -gt 1 ]; then
|
||||||
SEARCH_PROFILES=$1
|
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
|
# Define a custom plugin directory
|
||||||
--plugindir | --plugin-dir | --plugins-dir)
|
--plugindir | --plugin-dir | --plugins-dir)
|
||||||
shift
|
if [ $# -gt 1 ]; then
|
||||||
PLUGINDIR=$1
|
shift
|
||||||
LASTCHAR=$(echo $1 | awk '{ print substr($0, length($0))}')
|
PLUGINDIR=$1
|
||||||
if [ "${LASTCHAR}" = "/" ]; then
|
LASTCHAR=$(echo $1 | awk '{ print substr($0, length($0))}')
|
||||||
echo "${RED}Error:${WHITE} plugin directory path should not end with a slash${NORMAL}"
|
if [ "${LASTCHAR}" = "/" ]; then
|
||||||
ExitCustom 65
|
echo "${RED}Error:${WHITE} plugin directory path should not end with a slash${NORMAL}"
|
||||||
fi
|
ExitCustom 65
|
||||||
if [ ! -d ${PLUGINDIR} ]; then
|
fi
|
||||||
echo "${RED}Error:${WHITE} invalid plugin directory ${PLUGINDIR}${NORMAL}"
|
if [ ! -d ${PLUGINDIR} ]; then
|
||||||
ExitCustom 66
|
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
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user