2015-02-08 18:06:36 +00:00
|
|
|
#!/usr/bin/awk
|
|
|
|
/^[^#]/ {
|
|
|
|
gsub(/^\./,"", $1)
|
2015-03-05 11:43:12 +00:00
|
|
|
uname = gname = mode = flags = tags = type = ""
|
2015-03-04 23:45:39 +00:00
|
|
|
for (i=2; i<=NF; i++) {
|
|
|
|
if ($i ~ /^uname=/) {
|
|
|
|
uname=$i
|
2015-03-05 00:18:32 +00:00
|
|
|
gsub(/uname=/, "", uname)
|
2015-03-04 23:45:39 +00:00
|
|
|
} else if ($i ~ /^gname=/) {
|
|
|
|
gname=$i
|
2015-03-05 00:18:32 +00:00
|
|
|
gsub(/gname=/, "", gname)
|
2015-03-04 23:45:39 +00:00
|
|
|
} else if ($i ~ /^mode=/) {
|
|
|
|
mode=$i
|
2015-03-05 00:18:32 +00:00
|
|
|
gsub(/mode=/,"", mode)
|
2015-03-04 23:45:39 +00:00
|
|
|
} else if ($i ~ /^flags=/) {
|
|
|
|
flags=$i
|
2015-03-05 00:18:32 +00:00
|
|
|
gsub(/flags=/, "", flags)
|
2015-03-04 23:45:39 +00:00
|
|
|
} else if ($i ~ /^tags=/) {
|
|
|
|
tags=$i
|
2015-03-05 00:18:32 +00:00
|
|
|
gsub(/tags=/, "", tags)
|
2015-03-05 11:43:12 +00:00
|
|
|
} else if ($i ~ /^type=dir/) {
|
|
|
|
type="dir"
|
2015-03-04 23:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
2016-01-27 21:10:03 +00:00
|
|
|
if (kernel != "") {
|
|
|
|
tags="package=kernel"
|
|
|
|
if (_kernconf != "") {
|
|
|
|
tags=tags""_kernconf
|
|
|
|
}
|
|
|
|
}
|
2015-03-04 23:45:39 +00:00
|
|
|
if (length(tags) == 0)
|
|
|
|
next
|
|
|
|
if (tags ~ /package=/) {
|
2015-03-18 11:27:11 +00:00
|
|
|
ext = pkgname = pkgend = ""
|
2015-03-05 16:20:53 +00:00
|
|
|
split(tags, a, ",");
|
|
|
|
for (i in a) {
|
|
|
|
if (a[i] ~ /^package=/) {
|
|
|
|
pkgname=a[i]
|
|
|
|
gsub(/package=/, "", pkgname)
|
|
|
|
} else if (a[i] == "config") {
|
|
|
|
type="config"
|
2016-03-08 18:31:26 +00:00
|
|
|
} else if (a[i] == "development" || a[i] == "profile" || a[i] == "debug" || a[i] == "docs") {
|
2015-03-18 11:27:11 +00:00
|
|
|
pkgend=a[i]
|
2015-03-05 16:20:53 +00:00
|
|
|
} else {
|
2015-03-18 11:27:11 +00:00
|
|
|
if (ext != "")
|
|
|
|
ext=ext"-"a[i]
|
|
|
|
else
|
|
|
|
ext=a[i]
|
2015-03-05 16:20:53 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-18 11:27:11 +00:00
|
|
|
if (ext != "") {
|
2016-03-08 18:31:26 +00:00
|
|
|
pkgname=pkgname"-"ext
|
2015-03-05 16:20:53 +00:00
|
|
|
}
|
2015-03-18 11:27:11 +00:00
|
|
|
if (pkgend != "") {
|
2016-03-08 18:31:26 +00:00
|
|
|
if (pkgend == "docs") {
|
2015-03-18 11:27:11 +00:00
|
|
|
pkgname=pkgend
|
|
|
|
} else {
|
|
|
|
pkgname=pkgname"-"pkgend
|
|
|
|
}
|
|
|
|
}
|
2015-03-04 23:45:39 +00:00
|
|
|
} else {
|
2016-01-27 21:10:03 +00:00
|
|
|
print "No packages specified in line: $0"
|
2015-03-05 16:20:53 +00:00
|
|
|
next
|
2015-03-04 23:45:39 +00:00
|
|
|
}
|
2016-01-27 21:10:03 +00:00
|
|
|
if (kernel != "") {
|
|
|
|
output="kernel"
|
|
|
|
if (_kernconf != "") {
|
|
|
|
output=output"."_kernconf
|
|
|
|
}
|
|
|
|
if ($1 ~ /^\/usr\/lib\/debug\/boot/) {
|
|
|
|
output=output"-debug.plist"
|
|
|
|
} else {
|
2016-03-08 19:35:30 +00:00
|
|
|
output=output".plist"
|
2016-01-27 21:10:03 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
output=pkgname".plist"
|
|
|
|
}
|
2015-02-08 18:06:36 +00:00
|
|
|
|
2015-03-05 11:43:12 +00:00
|
|
|
print "@"type"("uname","gname","mode","flags") " $1 > output
|
2015-02-08 18:06:36 +00:00
|
|
|
}
|