Last change
on this file since 3650 was 3621, checked in by Bruno Cornec, 8 years ago |
New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[821] | 1 | #!/bin/sh
|
---|
| 2 | # udhcpc script edited by Tim Riker <Tim@Rikers.org>
|
---|
| 3 |
|
---|
[2725] | 4 | RESOLV_CONF="/etc/resolv.conf"
|
---|
[821] | 5 |
|
---|
[2725] | 6 | [ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
|
---|
| 7 |
|
---|
| 8 | NETMASK=""
|
---|
| 9 | [ -n "$subnet" ] && NETMASK="netmask $subnet"
|
---|
| 10 | BROADCAST="broadcast +"
|
---|
[821] | 11 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
|
---|
| 12 |
|
---|
| 13 | case "$1" in
|
---|
| 14 | deconfig)
|
---|
[2725] | 15 | echo "Setting IP address 0.0.0.0 on $interface"
|
---|
| 16 | ifconfig $interface 0.0.0.0
|
---|
[821] | 17 | ;;
|
---|
| 18 |
|
---|
| 19 | renew|bound)
|
---|
[2725] | 20 | echo "Setting IP address $ip on $interface"
|
---|
| 21 | ifconfig $interface $ip $NETMASK $BROADCAST
|
---|
[821] | 22 |
|
---|
| 23 | if [ -n "$router" ] ; then
|
---|
[2725] | 24 | echo "Deleting routers"
|
---|
[821] | 25 | while route del default gw 0.0.0.0 dev $interface ; do
|
---|
| 26 | :
|
---|
| 27 | done
|
---|
| 28 |
|
---|
| 29 | metric=0
|
---|
| 30 | for i in $router ; do
|
---|
[2725] | 31 | echo "Adding router $i"
|
---|
[3621] | 32 | route add default gw $i dev $interface metric $metric
|
---|
| 33 | : $(( metric += 1 ))
|
---|
[821] | 34 | done
|
---|
| 35 | fi
|
---|
| 36 |
|
---|
[2725] | 37 | echo "Recreating $RESOLV_CONF"
|
---|
[3621] | 38 | # If the file is a symlink somewhere (like /etc/resolv.conf
|
---|
| 39 | # pointing to /run/resolv.conf), make sure things work.
|
---|
| 40 | realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF")
|
---|
| 41 | tmpfile="$realconf-$$"
|
---|
| 42 | > "$tmpfile"
|
---|
| 43 | [ -n "$domain" ] && echo "search $domain" >> "$tmpfile"
|
---|
[821] | 44 | for i in $dns ; do
|
---|
[2725] | 45 | echo " Adding DNS server $i"
|
---|
[3621] | 46 | echo "nameserver $i" >> "$tmpfile"
|
---|
[821] | 47 | done
|
---|
[3621] | 48 | mv "$tmpfile" "$realconf"
|
---|
[821] | 49 | ;;
|
---|
| 50 | esac
|
---|
| 51 |
|
---|
| 52 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.