pakur.sh 918 B

123456789101112131415161718192021222324252627282930
  1. install -d ${PKG}/etc/
  2. install -Dm644 protocol-numbers.xml ${PKG}/usr/share/iana-etc/protocol-numbers.iana
  3. install -Dm644 service-names-port-numbers.xml ${PKG}/usr/share/iana-etc/port-numbers.iana
  4. awk -F"[<>]" '
  5. BEGIN {
  6. print "# See the full IANA XML file at: /usr/share/iana-etc/protocol-numbers.iana\n"
  7. }
  8. {
  9. if (/<record/) { v=n=0 }
  10. if (/<value/) v=$3
  11. if (/<name/ && !($3~/ /)) n=$3
  12. if (/<\/record/ && (v || n=="HOPOPT") && n) printf "%-12s %3i %s\n", tolower(n),v,n
  13. }
  14. ' protocol-numbers.xml > ${PKG}/etc/protocols
  15. awk -F"[<>]" '
  16. BEGIN {
  17. print "# See the full IANA XML file at: /usr/share/iana-etc/port-numbers.iana\n"
  18. }
  19. {
  20. if (/<record/) { n=u=p=c=0 }
  21. if (/<name/ && !/\(/) n=$3
  22. if (/<number/) u=$3
  23. if (/<protocol/) p=$3
  24. if (/Unassigned/ || /Reserved/ || /historic/) c=1
  25. if (/<\/record/ && n && u && p && !c) printf "%-15s %5i/%s\n", n,u,p # services
  26. }
  27. ' service-names-port-numbers.xml > ${PKG}/etc/services