conf_network: fixes, cleanup and clarity
This commit is contained in:
@@ -20,39 +20,44 @@
|
||||
# * NET{4,6}_MANUAL_FILE_$iface: filename for manual configuration of $iface
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
export VER_conf_syslog="0.0.3"
|
||||
export VER_conf_syslog="0.0.4"
|
||||
|
||||
conf_network()
|
||||
{
|
||||
local if_file="/etc/network/interfaces"
|
||||
backup_dist $if_file
|
||||
backupdist $if_file
|
||||
|
||||
# The interfaces header contain loopback interface declaration
|
||||
install_file interfaces.head $if_file
|
||||
tagfine $if_file
|
||||
installfile interfaces.head $if_file
|
||||
tagfile $if_file
|
||||
|
||||
# First configure IPv4 ifaces
|
||||
local iface=
|
||||
for iface in $IPV4_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
if [[ $(eval echo \$NET4_MODE_$iface) == manual ]]; then
|
||||
if [[ $(eval echo \$NET4_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET4_IP_$iface)" >> $if_file
|
||||
|
||||
if [[ -n $(eval echo \$NET4_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET4_GW_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET4_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET4_NS_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET4_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET4_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet dhcp" >> $if_file
|
||||
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
appendfile $fname $if_file
|
||||
@@ -62,24 +67,29 @@ conf_network()
|
||||
|
||||
for iface in $IPV6_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
if [[ $(eval echo \$NET6_MODE_$iface) == manual ]]; then
|
||||
if [[ $(eval echo \$NET6_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET6_IP_$iface)" >> $if_file
|
||||
|
||||
if [[ -n $(eval echo \$NET6_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET6_GW_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET6_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET6_NS_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET6_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET6_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 dhcp" >> $if_file
|
||||
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
appendfile $fname $if_file
|
||||
|
||||
Reference in New Issue
Block a user