84 lines
1.7 KiB
Bash
Executable File
84 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script sets up the /etc/network/interface file for the new
|
|
# image.
|
|
#
|
|
# Steve
|
|
# --
|
|
# http://www.steve.org.uk/
|
|
|
|
|
|
prefix=$1
|
|
|
|
|
|
if [[ "${rpmstrap}" ]]; then
|
|
|
|
if [[ -e ${prefix}/etc/rc.d/rc.local ]]; then
|
|
echo "ifconfig eth0 ${ip} up" >> ${prefix}/etc/rc.d/rc.local
|
|
echo "route add default gw ${gateway}" >> ${prefix}/etc/rc.d/rc.local
|
|
exit
|
|
else
|
|
echo "TODO : Sort out networking for non-Debian distribution ${dist}."
|
|
exit;
|
|
|
|
fi
|
|
fi
|
|
|
|
|
|
#
|
|
# OK now we're in Debian-only land.
|
|
#
|
|
|
|
if [[ -z "${dhcp}" ]]; then
|
|
|
|
#
|
|
# 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).
|
|
|
|
# The loopback network interface
|
|
auto lo
|
|
iface lo inet loopback
|
|
|
|
# The primary network interface
|
|
auto eth0
|
|
iface eth0 inet static
|
|
address ${ip}
|
|
gateway ${gateway}
|
|
netmask ${netmask}
|
|
# post-up ethtool -K eth0 tx off
|
|
|
|
#
|
|
# The commented out line above will disable TCP checksumming which
|
|
# might resolve problems for some users. It is disabled by default
|
|
#
|
|
E_O_STATIC
|
|
|
|
else
|
|
|
|
#
|
|
# 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).
|
|
|
|
# The loopback network interface
|
|
auto lo
|
|
iface lo inet loopback
|
|
|
|
# The primary network interface
|
|
auto eth0
|
|
iface eth0 inet dhcp
|
|
# post-up ethtool -K eth0 tx off
|
|
|
|
#
|
|
# The commented out line above will disable TCP checksumming which
|
|
# might resolve problems for some users. It is disabled by default
|
|
#
|
|
E_O_DHCP
|
|
|
|
fi
|