convert2ipconf 440 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # convert:
  3. #interface=eth1
  4. #ip=169.254.x.y
  5. # into:
  6. #let cfg=cfg+1
  7. #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=...
  8. exec >/dev/null
  9. #exec >"$0.out" # debug
  10. exec 2>&1
  11. test "$interface" || exit 1
  12. test "$ip" || exit 1
  13. {
  14. echo "let cfg=cfg+1"
  15. test "$interface" && echo "if[\$cfg]='$interface'"
  16. test "$ip" && echo "ip[\$cfg]='$ip'"
  17. test "$ip" && echo "ipmask[\$cfg]='$ip/16'"
  18. } >"$1"