mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-24 14:31:24 +01:00
parent
2d6550fb13
commit
449c695415
13
lib/utils.sh
13
lib/utils.sh
@ -391,6 +391,12 @@ is_kernel_option_enabled() {
|
|||||||
is_a_partition() {
|
is_a_partition() {
|
||||||
local PARTITION=$1
|
local PARTITION=$1
|
||||||
FNRET=128
|
FNRET=128
|
||||||
|
if [ ! -f /etc/fstab ] || [ -n "$(sed '/^#/d' /etc/fstab)" ]; then
|
||||||
|
debug "/etc/fstab not found or empty, searching mountpoint"
|
||||||
|
if mountpoint "$PARTITION" | grep -qE ".*is a mountpoint.*"; then
|
||||||
|
FNRET=0
|
||||||
|
fi
|
||||||
|
else
|
||||||
if grep "[[:space:]]$1[[:space:]]" /etc/fstab | grep -vqE "^#"; then
|
if grep "[[:space:]]$1[[:space:]]" /etc/fstab | grep -vqE "^#"; then
|
||||||
debug "$PARTITION found in fstab"
|
debug "$PARTITION found in fstab"
|
||||||
FNRET=0
|
FNRET=0
|
||||||
@ -398,6 +404,8 @@ is_a_partition() {
|
|||||||
debug "Unable to find $PARTITION in fstab"
|
debug "Unable to find $PARTITION in fstab"
|
||||||
FNRET=1
|
FNRET=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify that $1 is mounted at runtime
|
# Verify that $1 is mounted at runtime
|
||||||
@ -416,6 +424,10 @@ is_mounted() {
|
|||||||
has_mount_option() {
|
has_mount_option() {
|
||||||
local PARTITION=$1
|
local PARTITION=$1
|
||||||
local OPTION=$2
|
local OPTION=$2
|
||||||
|
if [ ! -f /etc/fstab ] || [ -n "$(sed '/^#/d' /etc/fstab)" ]; then
|
||||||
|
debug "/etc/fstab not found or empty, readin current mount options"
|
||||||
|
has_mounted_option "$PARTITION" "$OPTION"
|
||||||
|
else
|
||||||
if grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk '{print $4}' | grep -q "bind"; then
|
if grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk '{print $4}' | grep -q "bind"; then
|
||||||
local actual_partition
|
local actual_partition
|
||||||
actual_partition="$(grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk '{print $1}')"
|
actual_partition="$(grep "[[:space:]]${PARTITION}[[:space:]]" /etc/fstab | grep -vE "^#" | awk '{print $1}')"
|
||||||
@ -429,6 +441,7 @@ has_mount_option() {
|
|||||||
debug "Unable to find $OPTION in fstab for partition $PARTITION"
|
debug "Unable to find $OPTION in fstab for partition $PARTITION"
|
||||||
FNRET=1
|
FNRET=1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify $1 has the proper option $2 at runtime
|
# Verify $1 has the proper option $2 at runtime
|
||||||
|
Loading…
Reference in New Issue
Block a user