PDA

View Full Version : Changing DHCP function in miniroot



maxim9
04-22-2008, 10:06 PM
I would like to change the DHCP function found in the initrd image "miniroot"

I attempted to do this on my own, however, it seems to cause problems with portmap for unknown reasons.

Here is my code that I use:
DHCP=""
# How many network cards should we probe for?
for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
ifconfig "eth$i" up >/dev/null 2>&1 || continue
echo "${CRE}${BLUE}DHCP Broadcasting for IP address (${MAGENTA}eth$i${BLUE})... ${NORMAL}"
(pump -i eth$i >/dev/null 2>&1 && (echo "eth$i" >/tmp/DHCP;echo "DHCP Successful!"))&
done

while [ -z "$(cat /tmp/DHCP 2>/dev/null)" ];do
# Waiting for DHCP Assignment
done

portmap >/dev/null 2>&1;PORTMAPEXIT=$? && echo "${CRE} ${GREEN}Portmapper started.${NORMAL}"

This seems to work and do what I like. The ultimate goal is to not wait for the interfaces to go through one by one, but to ask for addresses on all simultaneously. Once an address is assigned, the script can continue. However, using this code, portmap returns "Segmentation fault", and the mount command also returns a segmentation fault and fails to mount the knoppix image which is located on an NFS share. Using the original code, and commenting out my routine, the image boots fine, it's only when this code is used that the Segmentation fault is encountered. I'm unaware if portmap is needed, but I can only assume that it is because the mount command fails immediately afterwards as well.