#!/bin/sh -e # udhcpc client script to be used by Debian Installer # Copyright (C) 2009, 2010 Otavio Salvador comma_separate() { echo "$1" | sed 's/ /,/g' } do_resolv_conf() { if [ -n "$domain$search$dns" ]; then { [ ! "$domain" ] || echo domain $domain [ ! "$search" ] || echo search $search for i in $dns ; do echo nameserver $i done } > /etc/resolv.conf fi } do_hostname() { local current=$(cat /proc/sys/kernel/hostname) if [ -z "$current" ] || [ "$current" = "(none)" ]; then echo "$hostname" > /proc/sys/kernel/hostname fi } do_leases() { local file="/var/lib/udhcp/udhcpc.leases" mkdir -p /var/lib/udhcp cat >> $file < /tmp/domain_name if [ -n "$ntpsrv" ]; then printf "$ntpsrv" > /tmp/dhcp-ntp-servers fi logger -t udhcpc "Got IP $ip (using $interface) and routing through $router" do_leases ;; *) echo "udhcpc: has been called with an unknown param: $1" ;; esac exit 0