diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-05-12 11:07:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-05-12 11:07:12 +0200 |
commit | b9c2108b26ad1fe4634c250850a4abadff26c76e (patch) | |
tree | e0458bdcf5238a57138a9b71bb9c7f0fa59e9149 | |
parent | 1099a27696cd733041db97f99da4e22ecd2424e5 (diff) | |
download | busybox-w32-b9c2108b26ad1fe4634c250850a4abadff26c76e.tar.gz busybox-w32-b9c2108b26ad1fe4634c250850a4abadff26c76e.tar.bz2 busybox-w32-b9c2108b26ad1fe4634c250850a4abadff26c76e.zip |
examples/var_service/dhcp_if: make helper scripts more talkative
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | examples/var_service/dhcp_if/convert2ipconf | 16 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/convert2ntpconf | 2 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/dhcp_handler | 6 | ||||
-rwxr-xr-x | examples/var_service/dhcp_if/finish | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/examples/var_service/dhcp_if/convert2ipconf b/examples/var_service/dhcp_if/convert2ipconf index 31e3c7fde..98f6546bf 100755 --- a/examples/var_service/dhcp_if/convert2ipconf +++ b/examples/var_service/dhcp_if/convert2ipconf | |||
@@ -19,7 +19,7 @@ | |||
19 | #let cfg=cfg+1 | 19 | #let cfg=cfg+1 |
20 | #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=... | 20 | #if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=... |
21 | 21 | ||
22 | exec >/dev/null | 22 | #exec >/dev/null |
23 | #exec >"$0.out" # debug | 23 | #exec >"$0.out" # debug |
24 | exec 2>&1 | 24 | exec 2>&1 |
25 | 25 | ||
@@ -31,23 +31,31 @@ test "$ip" || exit 1 | |||
31 | if ! test "$mask"; then | 31 | if ! test "$mask"; then |
32 | case "$ip" in | 32 | case "$ip" in |
33 | 10.*) | 33 | 10.*) |
34 | echo "mask assumed 8 for ip=$ip" | ||
34 | mask=8;; | 35 | mask=8;; |
35 | 192.168.*) | ||
36 | mask=16;; | ||
37 | #172.16-31.x.x | 36 | #172.16-31.x.x |
38 | 172.1[6789].*) | 37 | 172.1[6789].*) |
38 | echo "mask assumed 12 for ip=$ip" | ||
39 | mask=12;; | 39 | mask=12;; |
40 | 172.2[0123456789].*) | 40 | 172.2[0123456789].*) |
41 | echo "mask assumed 12 for ip=$ip" | ||
41 | mask=12;; | 42 | mask=12;; |
42 | 172.3[01].*) | 43 | 172.3[01].*) |
44 | echo "mask assumed 12 for ip=$ip" | ||
43 | mask=12;; | 45 | mask=12;; |
46 | 192.168.*) | ||
47 | echo "mask assumed 16 for ip=$ip" | ||
48 | mask=16;; | ||
44 | esac | 49 | esac |
45 | fi | 50 | fi |
46 | 51 | ||
47 | # some servers do not return router option. | 52 | # some servers do not return router option. |
48 | # assume DHCP server is the router. | 53 | # assume DHCP server is the router. |
49 | if ! test "$router"; then | 54 | if ! test "$router"; then |
50 | test "$serverid" && router="$serverid" | 55 | if test "$serverid"; then |
56 | router="$serverid" | ||
57 | echo "No 'router' from the server, assuming 'serverid' is the router: $serverid" | ||
58 | fi | ||
51 | fi | 59 | fi |
52 | 60 | ||
53 | { | 61 | { |
diff --git a/examples/var_service/dhcp_if/convert2ntpconf b/examples/var_service/dhcp_if/convert2ntpconf index e9d829308..f51740ba0 100755 --- a/examples/var_service/dhcp_if/convert2ntpconf +++ b/examples/var_service/dhcp_if/convert2ntpconf | |||
@@ -19,7 +19,7 @@ | |||
19 | #let cfg=cfg+1 | 19 | #let cfg=cfg+1 |
20 | #ntpip[$cfg]=... | 20 | #ntpip[$cfg]=... |
21 | 21 | ||
22 | exec >/dev/null | 22 | #exec >/dev/null |
23 | #exec >"$0.out" # debug | 23 | #exec >"$0.out" # debug |
24 | exec 2>&1 | 24 | exec 2>&1 |
25 | 25 | ||
diff --git a/examples/var_service/dhcp_if/dhcp_handler b/examples/var_service/dhcp_if/dhcp_handler index 6a97e8543..3e652621d 100755 --- a/examples/var_service/dhcp_if/dhcp_handler +++ b/examples/var_service/dhcp_if/dhcp_handler | |||
@@ -38,12 +38,10 @@ file_ntpconf="$service.ntpconf" | |||
38 | dir_ipconf="/var/run/service/fw" | 38 | dir_ipconf="/var/run/service/fw" |
39 | dir_ntpconf="/var/run/service/ntpd" | 39 | dir_ntpconf="/var/run/service/ntpd" |
40 | 40 | ||
41 | exec >/dev/null | 41 | #exec >/dev/null |
42 | #exec >>"$0.out" #debug | 42 | #exec >"$0.out" #debug |
43 | exec 2>&1 | 43 | exec 2>&1 |
44 | 44 | ||
45 | echo "`date`: Params: $*" | ||
46 | |||
47 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then | 45 | if test x"$1" != x"bound" && test x"$1" != x"renew" ; then |
48 | # Reconfigure network with this interface disabled | 46 | # Reconfigure network with this interface disabled |
49 | echo "Deconfiguring" | 47 | echo "Deconfiguring" |
diff --git a/examples/var_service/dhcp_if/finish b/examples/var_service/dhcp_if/finish index 8ce188336..50bfe67b5 100755 --- a/examples/var_service/dhcp_if/finish +++ b/examples/var_service/dhcp_if/finish | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # executed when service is taken down ("sv d .") | 2 | # executed when service is taken down ("svc -d .") |
3 | 3 | ||
4 | service=${PWD##*/} | 4 | service=${PWD##*/} |
5 | file_ipconf="$service.ipconf" | 5 | file_ipconf="$service.ipconf" |