__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 fi
getfacl "/$__object_id" 2>/dev/null \ getfacl "/$__object_id" 2>/dev/null \
| grep -E '^(default:)?(user|group|(mask|other):):[^:]' \ | grep -Eo '^(default:)?(user|group|(mask|other):):[^:][[:graph:]]+' \
| sed -r 's/\s*#.+$//' \
|| true || true

View File

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