mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Simplify and clean awk script
Suggested by: dteske
This commit is contained in:
parent
ca0abefb74
commit
f1d1786e24
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/release-pkg/; revision=279608
@ -1,35 +1,31 @@
|
||||
#!/usr/bin/awk
|
||||
/^[^#]/ {
|
||||
gsub(/^\./,"", $1)
|
||||
uname=""
|
||||
gname=""
|
||||
mode=""
|
||||
flags=""
|
||||
tags=""
|
||||
uname = gname = mode = flags = tags = ""
|
||||
for (i=2; i<=NF; i++) {
|
||||
if ($i ~ /^uname=/) {
|
||||
uname=$i
|
||||
gsub(/uname=/, "", uname);
|
||||
gsub(/uname=/, "", uname)
|
||||
} else if ($i ~ /^gname=/) {
|
||||
gname=$i
|
||||
gsub(/gname=/, "", gname);
|
||||
gsub(/gname=/, "", gname)
|
||||
} else if ($i ~ /^mode=/) {
|
||||
mode=$i
|
||||
gsub(/mode=/,"", mode);
|
||||
gsub(/mode=/,"", mode)
|
||||
} else if ($i ~ /^flags=/) {
|
||||
flags=$i
|
||||
gsub(/flags=/, "", flags);
|
||||
gsub(/flags=/, "", flags)
|
||||
} else if ($i ~ /^tags=/) {
|
||||
tags=$i
|
||||
gsub(/tags=/, "", tags);
|
||||
gsub(/tags=/, "", tags)
|
||||
}
|
||||
}
|
||||
if (length(tags) == 0)
|
||||
next
|
||||
if (tags ~ /package=/) {
|
||||
gsub(/package=/,"",tags);
|
||||
gsub(/,/, "-", tags);
|
||||
gsub(/runtime-/, "", tags);
|
||||
gsub(/package=/,"",tags)
|
||||
gsub(/,/, "-", tags)
|
||||
gsub(/runtime-/, "", tags)
|
||||
pkg=tags
|
||||
} else {
|
||||
pkg=tags
|
||||
|
Loading…
Reference in New Issue
Block a user