4.2.4_logs_permissions

This commit is contained in:
Thibault Ayanides
2020-10-05 13:17:44 +02:00
parent 922f28c200
commit d6e5803252
3 changed files with 87 additions and 1 deletions

View File

@ -88,13 +88,27 @@ has_file_correct_permissions() {
local FILE=$1
local PERMISSIONS=$2
if [ $($SUDO_CMD stat -L -c "%a" $1) = "$PERMISSIONS" ]; then
if [ $($SUDO_CMD stat -L -c "%a" $FILE) = "$PERMISSIONS" ]; then
FNRET=0
else
FNRET=1
fi
}
have_files_in_dir_correct_permissions(){
local DIR=$1
local PERMISSIONS=$2
FNRET=0
for perm in $($SUDO_CMD find "$DIR" -type f -exec stat -L -c "%a" {} \;);
do
if [ "$perm" != "$PERMISSIONS" ]; then
FNRET=1
break
fi
done
}
does_pattern_exist_in_file_nocase() {
_does_pattern_exist_in_file "-Ei" $*
}