__acl: replace sed -r where possible or make it portable without -r

This commit is contained in:
ander 2019-04-19 12:56:55 +03:00
parent f5d3196dd4
commit 0809d89836
2 changed files with 4 additions and 5 deletions

View File

@ -27,6 +27,5 @@ then
fi
getfacl "/$__object_id" 2>/dev/null \
| grep -E '^(default:)?(user|group|(mask|other):):[^:]' \
| sed -r 's/\s*#.+$//' \
| grep -Eo '^(default:)?(user|group|(mask|other):):[^:][[:graph:]]+' \
|| true

View File

@ -37,7 +37,7 @@ do
while read -r acl
do
if echo "$acl" | sed -r 's/(.*)://' | grep -Fq 'X'
if echo "$acl" | awk -F: '{ print $NF }' | grep -Fq 'X'
then
if [ "$is_dir" = '1' ]
then
@ -46,7 +46,7 @@ do
rep=-
fi
acl="$( echo "$acl" | sed -r "s/(.*)X/\1$rep/" )"
acl="$( echo "$acl" | sed "s/\(.*\)X/\1$rep/" )"
fi
if echo "$parameter" | grep -Eq '(mask|other)'
@ -98,7 +98,7 @@ then
then continue
fi
no_bits="$( echo "$acl" | sed -r 's/:[rwx-]+$//' )"
no_bits="$( echo "$acl" | sed 's/:...$//' )"
echo "$setfacl_exec -x \"$no_bits\" \"$acl_path\""
done