Utilize dhcp information in the kernel environment if we don't have
hostname and DNS information already. Submitted by: Danny Braniss <danny@cs.huji.ac.il>
This commit is contained in:
parent
96ab7da385
commit
c1ab4f157d
@ -92,6 +92,12 @@ for i in ${iflist} ; do
|
|||||||
done
|
done
|
||||||
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
||||||
|
|
||||||
|
if [ -z "`hostname -s`" ]; then
|
||||||
|
hostname=`kenv dhcp.host-name`
|
||||||
|
hostname $hostname
|
||||||
|
echo "Hostname is $hostname"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d /conf/default/etc ]; then
|
if [ -d /conf/default/etc ]; then
|
||||||
mount_md 4096 /etc 0
|
mount_md 4096 /etc 0
|
||||||
chkerr $? "MFS mount on /etc"
|
chkerr $? "MFS mount on /etc"
|
||||||
@ -109,12 +115,25 @@ fi
|
|||||||
# This way we have some flexibility to handle clusters of machines on
|
# This way we have some flexibility to handle clusters of machines on
|
||||||
# separate subnets.
|
# separate subnets.
|
||||||
|
|
||||||
for i in ${bootp_ipbca} ${bootp_ipa} ; do
|
for i in ${bootp_ipbca} ${bootp_ipa} ${hostname} ; do
|
||||||
if [ -d /conf/${i}/etc ]; then
|
if [ -d /conf/${i}/etc ]; then
|
||||||
cp -Rp /conf/${i}/etc/* /etc
|
cp -Rp /conf/${i}/etc/* /etc
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# if the info is available via dhcp/kenv
|
||||||
|
# build the resolv.conf
|
||||||
|
#
|
||||||
|
if [ ! -e /etc/resolv.conf ]; then
|
||||||
|
echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
|
||||||
|
|
||||||
|
set `kenv dhcp.domain-name-servers`
|
||||||
|
for ns in `IFS=','; echo $*`; do
|
||||||
|
echo nameserver $ns >> /etc/resolv.conf;
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Tell /etc/rc to run the specified script after it does its mounts but
|
# Tell /etc/rc to run the specified script after it does its mounts but
|
||||||
# before it does anything else.
|
# before it does anything else.
|
||||||
#
|
#
|
||||||
|
@ -92,6 +92,12 @@ for i in ${iflist} ; do
|
|||||||
done
|
done
|
||||||
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
||||||
|
|
||||||
|
if [ -z "`hostname -s`" ]; then
|
||||||
|
hostname=`kenv dhcp.host-name`
|
||||||
|
hostname $hostname
|
||||||
|
echo "Hostname is $hostname"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d /conf/default/etc ]; then
|
if [ -d /conf/default/etc ]; then
|
||||||
mount_md 4096 /etc 0
|
mount_md 4096 /etc 0
|
||||||
chkerr $? "MFS mount on /etc"
|
chkerr $? "MFS mount on /etc"
|
||||||
@ -109,12 +115,25 @@ fi
|
|||||||
# This way we have some flexibility to handle clusters of machines on
|
# This way we have some flexibility to handle clusters of machines on
|
||||||
# separate subnets.
|
# separate subnets.
|
||||||
|
|
||||||
for i in ${bootp_ipbca} ${bootp_ipa} ; do
|
for i in ${bootp_ipbca} ${bootp_ipa} ${hostname} ; do
|
||||||
if [ -d /conf/${i}/etc ]; then
|
if [ -d /conf/${i}/etc ]; then
|
||||||
cp -Rp /conf/${i}/etc/* /etc
|
cp -Rp /conf/${i}/etc/* /etc
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# if the info is available via dhcp/kenv
|
||||||
|
# build the resolv.conf
|
||||||
|
#
|
||||||
|
if [ ! -e /etc/resolv.conf ]; then
|
||||||
|
echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
|
||||||
|
|
||||||
|
set `kenv dhcp.domain-name-servers`
|
||||||
|
for ns in `IFS=','; echo $*`; do
|
||||||
|
echo nameserver $ns >> /etc/resolv.conf;
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Tell /etc/rc to run the specified script after it does its mounts but
|
# Tell /etc/rc to run the specified script after it does its mounts but
|
||||||
# before it does anything else.
|
# before it does anything else.
|
||||||
#
|
#
|
||||||
|
@ -92,6 +92,12 @@ for i in ${iflist} ; do
|
|||||||
done
|
done
|
||||||
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
|
||||||
|
|
||||||
|
if [ -z "`hostname -s`" ]; then
|
||||||
|
hostname=`kenv dhcp.host-name`
|
||||||
|
hostname $hostname
|
||||||
|
echo "Hostname is $hostname"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d /conf/default/etc ]; then
|
if [ -d /conf/default/etc ]; then
|
||||||
mount_md 4096 /etc 0
|
mount_md 4096 /etc 0
|
||||||
chkerr $? "MFS mount on /etc"
|
chkerr $? "MFS mount on /etc"
|
||||||
@ -109,12 +115,25 @@ fi
|
|||||||
# This way we have some flexibility to handle clusters of machines on
|
# This way we have some flexibility to handle clusters of machines on
|
||||||
# separate subnets.
|
# separate subnets.
|
||||||
|
|
||||||
for i in ${bootp_ipbca} ${bootp_ipa} ; do
|
for i in ${bootp_ipbca} ${bootp_ipa} ${hostname} ; do
|
||||||
if [ -d /conf/${i}/etc ]; then
|
if [ -d /conf/${i}/etc ]; then
|
||||||
cp -Rp /conf/${i}/etc/* /etc
|
cp -Rp /conf/${i}/etc/* /etc
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# if the info is available via dhcp/kenv
|
||||||
|
# build the resolv.conf
|
||||||
|
#
|
||||||
|
if [ ! -e /etc/resolv.conf ]; then
|
||||||
|
echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
|
||||||
|
|
||||||
|
set `kenv dhcp.domain-name-servers`
|
||||||
|
for ns in `IFS=','; echo $*`; do
|
||||||
|
echo nameserver $ns >> /etc/resolv.conf;
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Tell /etc/rc to run the specified script after it does its mounts but
|
# Tell /etc/rc to run the specified script after it does its mounts but
|
||||||
# before it does anything else.
|
# before it does anything else.
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user