X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=acl.sh;h=d232ea0138d4f5614ef4c61fc7d97548c0e85d4b;hb=fb2b12ba32dc26c47e6620f2155c6d63e7b592a6;hp=74fc8dc38419f9c556ff98e3882631ca709f6d8b;hpb=048d632f308bf93536f35fcebbe56d82671e0a14;p=shellwiki diff --git a/acl.sh b/acl.sh index 74fc8dc..d232ea0 100755 --- a/acl.sh +++ b/acl.sh @@ -1,7 +1,7 @@ #!/bin/sh # ACL_OVERRIDE="${ACL_OVERRIDE:-Admin:read,write}" -ACL_DEFAULT="${ACL_DEFAULT:-All:read${BR}Known:read,write}" +ACL_DEFAULT="${ACL_DEFAULT:-Known:read,write${BR}All:read}" acl_cachepath='' acl_collection='' @@ -34,16 +34,21 @@ acl_collect(){ continue fi - n=20; while read -r head acl; do - if [ "$head" = "%acl" ]; then - acl_collection="${acl%${CR}}${BR}" - printf "%s\n" "${acl%${CR}}" - n=$((n+1)) - fi + acl="$(sed -En ' + s;\r$;;; + /^%acl([\t ]+.*)?$/bACL; + 20q; + b; - n="$((n - 1))" - [ "$n" -eq 0 ] && break - done <"$pagefile" + :ACL + s;(%(acl)?)?[\t ]*;; + p; n; s;\r$;;; + /^(%[ \t]+|%acl[ \t]+|[ \t]+)[^ \t\r]+$/bACL; + /^(%[ \t]*|%acl[ \t]*)$/bACL; + ' <"$pagefile")" + + printf %s\\n "${acl}" + acl_collection="${acl_collection}${acl}${BR}" done printf '%s\n' "$ACL_DEFAULT"