aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/scripts/mtree-to-plist.awk44
1 files changed, 34 insertions, 10 deletions
diff --git a/release/scripts/mtree-to-plist.awk b/release/scripts/mtree-to-plist.awk
index 21dd7840af01..152b977f0204 100644
--- a/release/scripts/mtree-to-plist.awk
+++ b/release/scripts/mtree-to-plist.awk
@@ -1,15 +1,39 @@
#!/usr/bin/awk
/^[^#]/ {
gsub(/^\./,"", $1)
- tags=$NF
- gsub(/tags=/,"", tags)
- output=tags".plist"
- uname=$3
- gname=$4
- mode=$5
- gsub(/uname=/, "", uname);
- gsub(/gname=/, "", gname);
- gsub(/mode=/, "", mode);
+ uname=""
+ gname=""
+ mode=""
+ flags=""
+ tags=""
+ for (i=2; i<=NF; i++) {
+ if ($i ~ /^uname=/) {
+ uname=$i
+ gsub(/uname=/, "", uname);
+ } else if ($i ~ /^gname=/) {
+ gname=$i
+ gsub(/gname=/, "", gname);
+ } else if ($i ~ /^mode=/) {
+ mode=$i
+ gsub(/mode=/,"", mode);
+ } else if ($i ~ /^flags=/) {
+ flags=$i
+ gsub(/flags=/, "", flags);
+ } else if ($i ~ /^tags=/) {
+ tags=$i
+ gsub(/tags=/, "", tags);
+ }
+ }
+ if (length(tags) == 0)
+ next
+ if (tags ~ /package=/) {
+ gsub(/package=/,"",tags);
+ gsub(/,/, "-", tags);
+ pkg=tags
+ } else {
+ pkg=tags
+ }
+ output=pkg".plist"
- print "@("uname","gname","mode") " $1 > output
+ print "@("uname","gname","mode","flags") " $1 > output
}