From 6ad6d7707e893016e82eeb75f4f08131d12700e7 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Mon, 4 Oct 2010 17:42:02 +0200 Subject: remove uClibc stuff - part I --- src/initramfs/scripts/bin/dhcpmkconfig | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 src/initramfs/scripts/bin/dhcpmkconfig (limited to 'src/initramfs/scripts/bin/dhcpmkconfig') diff --git a/src/initramfs/scripts/bin/dhcpmkconfig b/src/initramfs/scripts/bin/dhcpmkconfig new file mode 100755 index 00000000..fa01db75 --- /dev/null +++ b/src/initramfs/scripts/bin/dhcpmkconfig @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright (c) 2003..2006 - RZ Uni Freiburg +# Copyright (c) 2006..2010 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Universal (distro independent) IP configuration writer for busybox udhcpc +# applet used within OpenSLX initramfs. The result is written to the +# /etc/initramfs-setup file + +# script started twice by udhcpc, quit fast if no ip configuration present +[ -z "$ip" ] && exit 0 + +# heavy debugging output in level 3 and above ... and on 13 +#FIXME: DEBUGLEVEL is not propagated to this file (at least for Ubuntu) +[ -z "$DEBUGLEVEL" ] && DEBUGLEVEL=0 +[ $DEBUGLEVEL -gt 3 -a $DEBUGLEVEL -lt 8 -o $DEBUGLEVEL -eq 13 ] && \ + set -x + +echo -e "# network configuration written by $0:" >/tmp/confviadhcp +unset HOME IFS KCMDLINE DEBUGLEVEL MODPRV TERM BOOTIF BOOT_IMAGE \ + infomsg mask lease interface cfgmsg cfgfile boot_file no_bootsplash +# set the broadcast address if not delivered by dhcp +[ -z "$broadcast" ] && \ + broadcast=$(ipcalc -b $ip/$subnet|sed s/.*=//) +set | sed \ + -e "s,^P.*,,;s,ntpsrv,ntp_servers,;s,ip,clientip," \ + -e "s,serverid,serverip,;s,subnet,subnet_mask," \ + -e "s,router,gateway,;s,hostname,host_name," \ + -e "s,domain,domain_name,;s,dns,domain_name_servers," \ + -e "s,broadcast,broadcast_address,;s,dhc.*,,;/^$/d" \ + -e "s,nissrv,nis_servers,;s,nisdomain_name,nis_domain," \ + -e "s,wins,netbios_name_servers,;/OPTIND.*/d" >>/tmp/confviadhcp + +# generate a local /etc/resolv.conf (might overwrite the version from preboot) +[ -n "$domain" ] && echo -e "search $domain\n" >/etc/resolv.conf +test -n "$dns" && { + for name in $dns; do + echo nameserver $name >>/etc/resolv.conf; + done; } + -- cgit v1.2.3-55-g7522