logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

perms.awk (388B)


  1. BEGIN {
  2. RS = ""
  3. sort = "sort -k 2"
  4. }
  5. function mode() {
  6. for (i = 2; i <= NF; ++i) {
  7. if ($i ~ /^mode=/)
  8. return substr($i, 6)
  9. }
  10. printf "file '%s' is missing mode attribute\n", $1 >"/proc/self/fd/2"
  11. exit(1)
  12. }
  13. /type=dir/ {
  14. printf "04%s %s\n", mode(), substr($1, 2) |sort
  15. }
  16. /type=reg/ {
  17. m = mode()
  18. if (m != "0644" && m != "0755")
  19. printf "10%s %s\n", m, substr($1, 2) |sort
  20. }