2006-05-24 19:25:55 by steve
Fixed networking.
This commit is contained in:
@@ -9,68 +9,21 @@
|
||||
|
||||
|
||||
prefix=$1
|
||||
dist=$1
|
||||
|
||||
|
||||
##
|
||||
# ##
|
||||
# RPMStrap installation. #
|
||||
# ##
|
||||
##
|
||||
if [[ "${rpmstrap}" ]]; then
|
||||
|
||||
if [ -d ${prefix}/etc/sysconfig/network-scripts ]; then
|
||||
|
||||
#
|
||||
# Test for static vs. DHCP
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
cat <<E_O_STATIC >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
DEVICE=eth0
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=static
|
||||
IPADDR=${ip}
|
||||
NETMASK=${netmask}
|
||||
GATEWAY=${gateway}
|
||||
E_O_STATIC
|
||||
else
|
||||
cat <<E_O_DHCP >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
ONBOOT=yes
|
||||
E_O_DHCP
|
||||
fi
|
||||
|
||||
#
|
||||
# Don't forget to setup the default route.
|
||||
#
|
||||
cat <<EOF >${prefix}/etc/sysconfig/network
|
||||
NETWORKING=yes
|
||||
GATEWAY=${gateway}
|
||||
HOSTNAME=${hostname}
|
||||
EOF
|
||||
else
|
||||
echo "TODO : Sort out networking for non-Debian distribution ${dist}."
|
||||
exit;
|
||||
|
||||
fi
|
||||
fi
|
||||
dist=$2
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Sets up the networking installation for Debian GNU/Linux.
|
||||
#
|
||||
function setupDebian
|
||||
{
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
|
||||
##
|
||||
# ##
|
||||
# Debian installation. #
|
||||
# ##
|
||||
##
|
||||
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
|
||||
#
|
||||
# We have a static IP address
|
||||
#
|
||||
cat <<E_O_STATIC >${prefix}/etc/network/interfaces
|
||||
#
|
||||
# We have a static IP address
|
||||
#
|
||||
cat <<E_O_STATIC >${prefix}/etc/network/interfaces
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
@@ -92,12 +45,12 @@ iface eth0 inet static
|
||||
#
|
||||
E_O_STATIC
|
||||
|
||||
else
|
||||
else
|
||||
|
||||
#
|
||||
# The host is using DHCP.
|
||||
#
|
||||
cat <<E_O_DHCP > ${prefix}/etc/network/interfaces
|
||||
#
|
||||
# The host is using DHCP.
|
||||
#
|
||||
cat <<E_O_DHCP > ${prefix}/etc/network/interfaces
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
@@ -116,4 +69,68 @@ iface eth0 inet dhcp
|
||||
#
|
||||
E_O_DHCP
|
||||
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Setup networking for CentOS4
|
||||
#
|
||||
function setupCentOS4
|
||||
{
|
||||
|
||||
#
|
||||
# Test for static vs. DHCP
|
||||
#
|
||||
if [[ -z "${dhcp}" ]]; then
|
||||
cat <<E_O_STATIC >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
DEVICE=eth0
|
||||
ONBOOT=yes
|
||||
BOOTPROTO=static
|
||||
IPADDR=${ip}
|
||||
NETMASK=${netmask}
|
||||
GATEWAY=${gateway}
|
||||
E_O_STATIC
|
||||
else
|
||||
|
||||
cat <<E_O_DHCP >${prefix}/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
ONBOOT=yes
|
||||
E_O_DHCP
|
||||
fi
|
||||
|
||||
#
|
||||
# Don't forget to setup the default route.
|
||||
#
|
||||
cat <<EOF >${prefix}/etc/sysconfig/network
|
||||
NETWORKING=yes
|
||||
GATEWAY=${gateway}
|
||||
HOSTNAME=${hostname}
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Entry point to the script.
|
||||
#
|
||||
case "${dist}" in
|
||||
sarge|etch|sid)
|
||||
setupDebian
|
||||
;;
|
||||
centos4)
|
||||
setupCentOS4
|
||||
;;
|
||||
*)
|
||||
echo "Unknown distribution '${dist}'. Fixme";
|
||||
exit;
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user