source: branches/whiterussian/openwrt/package/base-files/default/usr/share/udhcpc/default.script @ 1912

Last change on this file since 1912 was 1912, checked in by wbx, 11 years ago

add the possibility to use a script, idea by fulup

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1#!/bin/sh
2# udhcpc script edited by Tim Riker <Tim@Rikers.org>
3# (slightly modified for OpenWrt)
4
5[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
6
7RESOLV_CONF="/tmp/resolv.conf"
8
9case "$1" in
10        deconfig)
11                ifconfig $interface 0.0.0.0
12                ;;
13
14        renew|bound)
15                ifconfig $interface $ip \
16                netmask ${subnet:-255.255.255.0} \
17                broadcast ${broadcast:-+}
18
19                if [ -n "$router" ] ; then
20                        echo "deleting routers"
21                        while route del default gw 0.0.0.0 dev $interface ; do
22                                :
23                        done
24
25                        for i in $router ; do
26                                route add default gw $i dev $interface
27                        done
28                fi
29
30                echo -n > $RESOLV_CONF
31                ${domain:+echo search $domain} >> $RESOLV_CONF
32                for i in $dns ; do
33                        echo adding dns $i
34                        echo nameserver $i >> $RESOLV_CONF
35
36                # user rules
37                [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user
38
39                done
40                ;;
41esac
42exit 0
Note: See TracBrowser for help on using the repository browser.