New parameter to suppress the list of file/directory with wrong permissions.

This commit is contained in:
Christoph Niethammer 2012-07-05 07:41:51 +00:00
parent af3a65e94f
commit 326fc006a3

View file

@ -71,6 +71,12 @@ for arg in $@; do
PRINT_FILES=1 PRINT_FILES=1
PRINT_DIRS=1 PRINT_DIRS=1
;; ;;
--no-print-files)
PRINT_FILES=0
;;
--no-print-dirs)
PRINT_DIRS=0
;;
*) *)
if [[ ! -d $arg ]]; then if [[ ! -d $arg ]]; then
echo "# Skipped $arg" echo "# Skipped $arg"
@ -88,7 +94,7 @@ echo "# Searching for files which do not match at least '$FILE_PERMS' ..."
WRONG_FILES=(`find $SEARCH_DIRS -type f ! -perm -$FILE_PERMS -print`) WRONG_FILES=(`find $SEARCH_DIRS -type f ! -perm -$FILE_PERMS -print`)
if [[ $PRINT_FILES -eq 1 ]]; then if [[ $PRINT_DIRS -eq 1 ]]; then
echo "# ** directories with wrong permissions:" echo "# ** directories with wrong permissions:"
for dir in ${WRONG_DIRS[@]}; do for dir in ${WRONG_DIRS[@]}; do
if [[ $FIX_PERMISSIONS -eq 1 ]]; then if [[ $FIX_PERMISSIONS -eq 1 ]]; then
@ -103,7 +109,9 @@ for dir in ${WRONG_DIRS[@]}; do
echo -e "$dir\t\t$(stat -c "%a" $dir)" echo -e "$dir\t\t$(stat -c "%a" $dir)"
fi fi
done done
fi
if [[ $PRINT_FILES -eq 1 ]]; then
echo "# ** files with wrong permissions:" echo "# ** files with wrong permissions:"
for file in ${WRONG_FILES[@]}; do for file in ${WRONG_FILES[@]}; do
if [[ $FIX_PERMISSIONS -eq 1 ]]; then if [[ $FIX_PERMISSIONS -eq 1 ]]; then