opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

perms.awk (388B)


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