fixed indentation
This commit is contained in:
@@ -35,69 +35,69 @@ conf_network()
|
||||
# First configure IPv4 ifaces
|
||||
local iface=
|
||||
for iface in $IPV4_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
|
||||
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 [[ $(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_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_$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
|
||||
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) == 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)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
done
|
||||
|
||||
for iface in $IPV6_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
|
||||
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 [[ $(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_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_$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
|
||||
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) == 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)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
done
|
||||
|
||||
unset iface if_file
|
||||
@@ -108,80 +108,80 @@ precheck_conf_network()
|
||||
{
|
||||
file_must_exists interfaces.head
|
||||
if [[ -z $IPV4_IFACES ]]; then
|
||||
prnt W "No IPv4 interfaces to configure."
|
||||
prnt W "No IPv4 interfaces to configure."
|
||||
else
|
||||
for iface in $IPV4_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv4 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET4_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET4_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET4_IP_$iface) ]]; then
|
||||
prnt E "No IPv4 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET4_IP_$iface) static IPv4 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCP."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv4 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET4_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
for iface in $IPV4_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv4 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET4_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET4_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET4_IP_$iface) ]]; then
|
||||
prnt E "No IPv4 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET4_IP_$iface) static IPv4 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCP."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv4 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET4_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ -z $IPV6_IFACES ]]; then
|
||||
prnt W "No IPv6 interfaces to configure."
|
||||
prnt W "No IPv6 interfaces to configure."
|
||||
else
|
||||
for iface in $IPV6_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv6 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET6_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET6_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET6_IP_$iface) ]]; then
|
||||
prnt E "No IPv6 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET6_IP_$iface) static IPv6 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCPv6."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv6 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET6_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
for iface in $IPV6_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv6 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET6_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET6_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET6_IP_$iface) ]]; then
|
||||
prnt E "No IPv6 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET6_IP_$iface) static IPv6 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCPv6."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv6 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET6_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user