[FILE-6430] initial import and changes

This commit is contained in:
Michael Boelen 2016-07-11 11:18:53 +02:00
parent d1c8cd3d05
commit 648d043b0a

View File

@ -645,39 +645,44 @@
################################################################################# #################################################################################
# #
# Test : FILE-6430 # Test : FILE-6430
# Description : Disable Mounting of some Filesystems : cramfs hfs hfsplus squashfs udf freevxfs jffs2 # Description : Disable mounting of some filesystems
# Rationale : Unless there is a specific reason to use a particular file system, disable it.
Register --test-no FILE-6430 --weight L --network NO --description "Disable Mounting of some filesystems" # Data : cramfs freevxfs hfs hfsplus jffs2 squashfs udf
Register --test-no FILE-6430 --weight L --network NO --description "Disable mounting of some filesystems"
if [ ${SKIPTEST} -eq 0 ]; then if [ ${SKIPTEST} -eq 0 ]; then
if [ ! "${LSMODBINARY}" = "" -a -f /proc/modules ]; then if [ ! "${LSMODBINARY}" = "" -a -f /proc/modules ]; then
Display --indent 2 --text "- Disable Mounting of some filesystems" Display --indent 2 --text "- Disable mounting of some filesystems"
LIST_FS_NOT_SUPPORTED="cramfs hfs hfsplus squashfs udf freevxfs jffs2" LIST_FS_NOT_SUPPORTED="cramfs freevxfs hfs hfsplus jffs2 squashfs udf"
for FS in ${LIST_FS_NOT_SUPPORTED}; do for FS in ${LIST_FS_NOT_SUPPORTED}; do
Display --indent 4 --text "- Disable Mounting of $FS Filesystems" Display --indent 4 --text "- Disable mounting of ${FS} filesystem"
LogText "Test: Checking if $FS is not present in loaded modules" LogText "Test: Checking if ${FS} is not present in loaded modules"
# Check if FS is present in lsmod output # Check if FS is present in lsmod output
FIND=`${LSMODBINARY} | grep $FS | wc -l` FIND=`${LSMODBINARY} | ${EGREPBINARY} "^${FS}"`
if [ "${FIND}" = "0" ]; then if [ -z "${FIND}" ]; then
LogText "Module $FS not loaded in the kernel" LogText "Result: module ${FS} not loaded in the kernel"
Display --indent 6 --text "- Module $FS not loaded in the kernel" --result OK --color GREEN Display --indent 6 --text "- Module ${FS} not loaded in the kernel" --result OK --color GREEN
AddHP 2 2
else else
LogText "Module $FS loaded in the kernel" LogText "Result: module ${FS} loaded in the kernel"
Display --indent 6 --text "- Module $FS loaded in the kernel" --result "REMOVE NEEDED" --color YELLOW Display --indent 6 --text "- Module $FS loaded in the kernel" --result "FOUND" --color YELLOW
AddHP 2 5
fi fi
# Check if FS is present in modprobe output # Check if FS is present in modprobe output
FIND=`${MODPROBEBINARY} -v -n $FS 2>/dev/null | tail -1` FIND=`${MODPROBEBINARY} -v -n $FS 2>/dev/null | ${EGREPBINARY} "/${FS}.ko" | tail -1`
if echo $FIND | ${EGREPBINARY} -q "insmod .*${FS}.ko"; then if [ ! -z "${FIND}" ]; then
Display --indent 6 --text "- Module $FS present in the kernel" --result "REMOVE NEEDED" --color YELLOW LogText "Result: found module support in kernel: ${FIND}"
Display --indent 6 --text "- Module ${FS} present in the kernel" --result "FOUND" --color YELLOW
AddHP 2 3
else else
Display --indent 6 --text "- Module $FS not present in the kernel" --result OK --color GREEN AddHP 2 2
ReportSuggestion ${TEST_NO} "The modprobe.d should contains a file with the entry 'install $FS /bin/true'" Display --indent 6 --text "- Module ${FS} not present in the kernel" --result OK --color GREEN
#ReportSuggestion ${TEST_NO} "The modprobe.d directory should contain a file with the entry 'install ${FS} /bin/true'"
fi fi
done done
else else
LogText "Test skipped lsmod binary not found or /proc/modules can not be opened" LogText "Test skipped lsmod binary not found or /proc/modules can not be opened"
fi fi
fi fi
# #
################################################################################# #################################################################################
# #