Annotation of /trunk/mkinitrd-magellan/busybox/examples/var_service/dhcp_if/convert2ipconf
Parent Directory | Revision Log
Revision 984 -
(hide annotations)
(download)
Sun May 30 11:32:42 2010 UTC (14 years ago) by niro
File size: 968 byte(s)
Sun May 30 11:32:42 2010 UTC (14 years ago) by niro
File size: 968 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 | niro | 984 | #!/bin/sh |
2 | # convert: | ||
3 | |||
4 | # dhcptype=5 | ||
5 | # serverid=172.16.42.102 | ||
6 | # lease=97200 | ||
7 | # interface=eth0 | ||
8 | # ip=172.16.42.177 | ||
9 | # subnet=255.255.255.0 | ||
10 | # mask=24 | ||
11 | # broadcast=172.16.22.255 | ||
12 | # router=172.16.42.98 | ||
13 | # dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27 | ||
14 | # domain=lab.example.com example.com | ||
15 | # ntpsrv=10.34.32.125 10.34.255.7 | ||
16 | |||
17 | # into: | ||
18 | |||
19 | #let cfg=cfg+1 | ||
20 | #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=... | ||
21 | |||
22 | exec >/dev/null | ||
23 | #exec >"$0.out" # debug | ||
24 | exec 2>&1 | ||
25 | |||
26 | test "$interface" || exit 1 | ||
27 | test "$ip" || exit 1 | ||
28 | |||
29 | { | ||
30 | echo "let cfg=cfg+1" | ||
31 | test "$interface" && echo "if[\$cfg]='$interface'" | ||
32 | test "$ip" && echo "ip[\$cfg]='$ip'" | ||
33 | test "$ip" && test "$mask" \ | ||
34 | && echo "ipmask[\$cfg]='$ip/$mask'" | ||
35 | test "$router" && echo "gw[\$cfg]='$router'" | ||
36 | test "$dns" && echo "dns[\$cfg]='$dns'" | ||
37 | # TODO: I never saw a dhcp server which correctly announces | ||
38 | # which subnet(s) is/are available thru advertised router | ||
39 | # Assume 0/0 | ||
40 | echo "net[\$cfg]='0/0'" | ||
41 | } >"$1" |
Properties
Name | Value |
---|---|
svn:executable | * |