source: MondoRescue/branches/2.2.9/mindi-busybox/examples/udhcp/simple.script@ 2887

Last change on this file since 2887 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 1.0 KB
RevLine 
[821]1#!/bin/sh
2# udhcpc script edited by Tim Riker <Tim@Rikers.org>
3
[2725]4RESOLV_CONF="/etc/resolv.conf"
[821]5
[2725]6[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
7
8NETMASK=""
9[ -n "$subnet" ] && NETMASK="netmask $subnet"
10BROADCAST="broadcast +"
[821]11[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
12
13case "$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"
[821]32 route add default gw $i dev $interface metric $((metric++))
33 done
34 fi
35
[2725]36 echo "Recreating $RESOLV_CONF"
37 echo -n > $RESOLV_CONF-$$
38 [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
[821]39 for i in $dns ; do
[2725]40 echo " Adding DNS server $i"
41 echo "nameserver $i" >> $RESOLV_CONF-$$
[821]42 done
[2725]43 mv $RESOLV_CONF-$$ $RESOLV_CONF
[821]44 ;;
45esac
46
47exit 0
Note: See TracBrowser for help on using the repository browser.