Check if Linux config file is set, before executing other tests

This commit is contained in:
mboelen 2014-10-30 18:09:47 +01:00
parent c8189d05e8
commit 9f1f006005
1 changed files with 20 additions and 18 deletions

View File

@ -64,26 +64,28 @@
# If we have a kernel configuration file, use it for testing # If we have a kernel configuration file, use it for testing
# Do not perform test if we already found it in kernel module list, to avoid triggered it in the upcoming # Do not perform test if we already found it in kernel module list, to avoid triggered it in the upcoming
# tests, when using iptables --list # tests, when using iptables --list
if [ ! "${LINUXCONFIGFILE}" = "" -a -f ${LINUXCONFIGFILE} -a ${IPTABLES_MODULE_ACTIVE} -eq 0 ]; then if [ ! "${LINUXCONFIGFILE}" = "" ]; then
logtext "Result: found kernel configuration file (${LINUXCONFIGFILE})" if [ -f ${LINUXCONFIGFILE} -a ${IPTABLES_MODULE_ACTIVE} -eq 0 ]; then
FIND=`${tCATCMD} ${LINUXCONFIGFILE} | grep -v '^#' | grep "CONFIG_IP_NF_IPTABLES" | head -n 1` logtext "Result: found kernel configuration file (${LINUXCONFIGFILE})"
if [ ! "${FIND}" = "" ]; then FIND=`${tCATCMD} ${LINUXCONFIGFILE} | grep -v '^#' | grep "CONFIG_IP_NF_IPTABLES" | head -n 1`
HAVEMOD=`echo ${FIND} | cut -d '=' -f2` if [ ! "${FIND}" = "" ]; then
# Do not use iptables if it's compiled as a module (=m), since we already tested for it in the HAVEMOD=`echo ${FIND} | cut -d '=' -f2`
# active list. # Do not use iptables if it's compiled as a module (=m), since we already tested for it in the
if [ "${HAVEMOD}" = "y" ]; then # active list.
logtext "Result: iptables available as a module in the configuration" if [ "${HAVEMOD}" = "y" ]; then
IPTABLES_ACTIVE=1 logtext "Result: iptables available as a module in the configuration"
IPTABLES_INKERNEL_ACTIVE=1 IPTABLES_ACTIVE=1
FIREWALL_ACTIVE=1 IPTABLES_INKERNEL_ACTIVE=1
FIREWALL_SOFTWARE="iptables" FIREWALL_ACTIVE=1
Display --indent 2 --text "- Checking iptables in config file" --result FOUND --color GREEN FIREWALL_SOFTWARE="iptables"
Display --indent 2 --text "- Checking iptables in config file" --result FOUND --color GREEN
else
logtext "Result: no iptables found in Linux kernel config file"
fi
else else
logtext "Result: no iptables found in Linux kernel config file" logtext "Result: no Linux configuration file found"
Display --indent 2 --text "- Checking iptables in config file" --result "NOT FOUND" --color WHITE
fi fi
else
logtext "Result: no Linux configuration file found"
Display --indent 2 --text "- Checking iptables in config file" --result "NOT FOUND" --color WHITE
fi fi
fi fi
fi fi