diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2019-07-16 14:20:30 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2019-07-16 14:20:30 +0300 |
commit | fa8bad20db100d95cf089b0b2d897c339327215c (patch) | |
tree | 2f80f2e015d26056cd741137dc4fdd069a6c4c5d /include/tests_filesystems | |
parent | 2777caf6d218aeb40c2ebd8af2564be8201eeff1 (diff) |
Use -n instead of ! -z
Diffstat (limited to 'include/tests_filesystems')
-rw-r--r-- | include/tests_filesystems | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/include/tests_filesystems b/include/tests_filesystems index 4e52ea5e..ac0c1d3c 100644 --- a/include/tests_filesystems +++ b/include/tests_filesystems @@ -89,7 +89,7 @@ ReportException "${TEST_NO}:1" "Don't know this specific operating system yet, while volume group manager was found" ;; esac - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: found one or more volume groups" for I in ${FIND}; do LogText "Found LVM volume group: ${I}" @@ -152,7 +152,7 @@ if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: Checking for Linux EXT file systems" FIND=$(${MOUNTBINARY} -t ext2,ext3,ext4 | ${AWKBINARY} '{ print $3","$5 }') - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: found one or more EXT file systems" for I in ${FIND}; do FILESYSTEM=$(echo ${I} | ${CUTBINARY} -d ',' -f1) @@ -173,7 +173,7 @@ if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: Checking for Linux XFS file systems" FIND=$(${MOUNTBINARY} -t xfs | ${AWKBINARY} '{ print $3","$5 }') - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: found one or more XFS file systems" for I in ${FIND}; do FILESYSTEM=$(echo ${I} | ${CUTBINARY} -d ',' -f1) @@ -272,12 +272,12 @@ # Test for UUID usage (e.g. UUID=uuid --> /dev/disk/by-uuid/<uuid>) HAS_UUID=$(echo ${I} | ${GREPBINARY} "^UUID=") - if [ ! -z "${HAS_UUID}" ]; then + if [ -n "${HAS_UUID}" ]; then UUID=$(echo ${HAS_UUID} | ${AWKBINARY} -F= '{ print $2 }') LogText "Result: Using ${UUID} as UUID" - if [ ! -z "${BLKIDBINARY}" ]; then + if [ -n "${BLKIDBINARY}" ]; then FIND2=$(${BLKIDBINARY} | ${AWKBINARY} '{ if ($2=="UUID=\"${UUID}\"") print $1 }' | ${SEDBINARY} 's/:$//') - if [ ! -z "${FIND2}" ]; then + if [ -n "${FIND2}" ]; then REAL="${FIND2}" fi else @@ -286,7 +286,7 @@ if [ -L /dev/disk/by-uuid/${UUID} ]; then LogText "Result: found disk via /dev/disk/by-uuid listing" ShowSymlinkPath /dev/disk/by-uuid/${UUID} - if [ ! -z "${sFILE}" ]; then + if [ -n "${sFILE}" ]; then REAL="${sFILE}" LogText "Result: disk is ${REAL}" fi @@ -342,7 +342,7 @@ if [ "${OS}" = "Linux" -a -f ${ROOTDIR}proc/version ]; then LINUX_KERNEL_MAJOR=$(echo $OS_KERNELVERSION | ${AWKBINARY} -F. '{print $1}') LINUX_KERNEL_MINOR=$(echo $OS_KERNELVERSION | ${AWKBINARY} -F. '{print $2}') - if [ ! -z "${LINUX_KERNEL_MAJOR}" -a ! -z "${LINUX_KERNEL_MINOR}" ]; then + if [ -n "${LINUX_KERNEL_MAJOR}" -a -n "${LINUX_KERNEL_MINOR}" ]; then if [ ${LINUX_KERNEL_MAJOR} -ge 3 -a ${LINUX_KERNEL_MINOR} -ge 3 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi else PREQS_MET="NO"; @@ -464,7 +464,7 @@ FOUND=0 LogText "Test: Checking acl option on ext[2-4] root file system" FIND=$(${MOUNTBINARY} | ${AWKBINARY} '{ if ($3=="/" && $5~/ext[2-4]/) { print $6 } }' | ${GREPBINARY} acl) - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: found ACL option" FOUND=1 else @@ -480,11 +480,11 @@ FIND1=$(${MOUNTBINARY} -t ext2,ext3,ext4 | ${GREPBINARY} "on / " | ${AWKBINARY} '{ print $1 }') fi # Trying to determine default mount options from EXT2/EXT3/EXT4 file systems - if [ ! -z "${FIND1}" ]; then + if [ -n "${FIND1}" ]; then LogText "Result: found ${FIND1}" LogText "Test: Checking default options on ${FIND1}" FIND2=$(${TUNE2FSBINARY} -l ${FIND1} 2> /dev/null | ${GREPBINARY} "^Default mount options" | ${GREPBINARY} "acl") - if [ ! -z "${FIND2}" ]; then + if [ -n "${FIND2}" ]; then LogText "Result: found ACL option in default mount options" FOUND=1 else @@ -528,7 +528,7 @@ NOEXEC=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "noexec") { print "YES" } else { print "NO" } }') NOSUID=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "nosuid") { print "YES" } else { print "NO" } }') - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: mount system / is configured with options: ${FIND}" if [ "${FIND}" = "defaults" ]; then Display --indent 2 --text "- Mount options of /" --result "${STATUS_OK}" --color GREEN @@ -577,7 +577,7 @@ FS_FSTAB="" fi fi - if [ ! -z "${FS_FSTAB}" ]; then + if [ -n "${FS_FSTAB}" ]; then FOUND_FLAGS=$(${AWKBINARY} -v fs=${FILESYSTEM} '{ if ($2==fs) { print $4 } }' ${ROOTDIR}etc/fstab | ${SEDBINARY} 's/,/ /g' | ${TRBINARY} '\n' ' ') LogText "File system: ${FILESYSTEM}" LogText "Expected flags: ${EXPECTED_FLAGS}" @@ -629,7 +629,7 @@ if [ -f ${ROOTDIR}etc/fstab ]; then FIND=$(${AWKBINARY} '{ if ($2=="/var/tmp") { print $4 } }' ${ROOTDIR}etc/fstab) BIND=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "bind") { print "YES" } else { print "NO" } }') - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: mount system /var/tmp is configured with options: ${FIND}" if [ "${BIND}" = "YES" ]; then Display --indent 2 --text "- /var/tmp is bound to /tmp" --result "${STATUS_OK}" --color GREEN @@ -760,7 +760,7 @@ # Data : cramfs freevxfs hfs hfsplus jffs2 squashfs udf Register --test-no FILE-6430 --weight L --network NO --category security --description "Disable mounting of some filesystems" if [ ${SKIPTEST} -eq 0 ]; then - if [ ! -z "${LSMODBINARY}" -a -f /proc/modules ]; then + if [ -n "${LSMODBINARY}" -a -f /proc/modules ]; then Display --indent 2 --text "- Disable kernel support of some filesystems" LIST_FS_NOT_SUPPORTED="cramfs freevxfs hfs hfsplus jffs2 squashfs udf" FOUND=0 @@ -769,7 +769,7 @@ for FS in ${LIST_FS_NOT_SUPPORTED}; do # Check if filesystem is present in modprobe output FIND=$(${MODPROBEBINARY} -v -n $FS 2>/dev/null | ${EGREPBINARY} "/${FS}.ko" | tail -1) - if [ ! -z "${FIND}" ]; then + if [ -n "${FIND}" ]; then LogText "Result: found module support in kernel: ${FIND}" Debug "Module ${FS} present in the kernel" LogText "Test: Checking if ${FS} is active" |