#!/usr/bin/sh #---------------------------------------------------------------------------- # Sample udhcpc bound script # # Creation: 2002-09-25 od # Last Update: $Id$ # # Copyright (c) 2001-2005 the eisfair team, team(at)eisfair(dot)org # Copyright (c) 2011-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- NAME=ip IP=/usr/sbin/${NAME} NETCALC='/usr/bin/netcalc' . /etc/config.d/dhcpc #RESOLV_CONF="/etc/resolv.conf" if [ -n "${broadcast}" ] then BROADCAST="broadcast ${broadcast}" fi if [ -n "${subnet}" ] then NETMASK="netmask ${subnet}" network=$(${NETCALC} network ${ip}:${subnet}) netmaskbits="/$(${NETCALC} netmaskbits ${network}:${subnet})" fi ${IP} addr add ${ip}${netmaskbits} brd + dev ${interface} ${IP} link set ${interface} up if [ -n "${router}" ] && [ "${DHCPC_SET_DEFAULT_ROUTE}" = "yes" ] then echo " - deleting routers" while ${IP} route show | grep -qE "^default.*$interface$" do ${IP} route del default via 0.0.0.0 dev ${interface} done for i in ${router} do ${IP} route add default via ${i} dev ${interface} done fi if [ "${DHCPC_USE_PEERDNS}" = "yes" ] then #include eisdate-time . /var/install/include/eistime { echo '# --------------------------------------------------------------------------' echo '# /etc/resolv.conf is a symlink to /run/netconfig/resolv.conf' echo '# autogenerated by netconfig!' echo '#' echo "# Last Update: ${EISDATE} ${EISTIME} by /var/install/config.d/dhcpc.sh" echo '# --------------------------------------------------------------------------' if [ -n "${domain}" ] then echo "search ${domain}" fi for i in ${dns} do echo "nameserver ${i}" done } >/run/netconfig/resolv.conf # # echo -n > ${RESOLV_CONF} # if [ -n "${domain}" ] # then # echo "domain ${domain}" >> ${RESOLV_CONF} # fi # # for i in ${dns} # do # echo " - adding dns ${i}" # echo "nameserver ${i}" >> ${RESOLV_CONF} # done fi # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------