convert2ntpconf 547 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # convert:
  3. # dhcptype=5
  4. # serverid=172.16.42.102
  5. # lease=97200
  6. # interface=eth0
  7. # ip=172.16.42.177
  8. # subnet=255.255.255.0
  9. # mask=24
  10. # broadcast=172.16.22.255
  11. # router=172.16.42.98
  12. # dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27
  13. # domain=lab.example.com example.com
  14. # ntpsrv=10.34.32.125 10.34.255.7
  15. # into:
  16. #let cfg=cfg+1
  17. #ntpip[$cfg]=...
  18. exec >/dev/null
  19. #exec >"$0.out" # debug
  20. exec 2>&1
  21. test "$interface" || exit 1
  22. test "$ip" || exit 1
  23. {
  24. for n in $ntpsrv; do
  25. echo "let cfg=cfg+1"
  26. echo "ntpip[\$cfg]='$n'";
  27. done
  28. } >"$1"