42 lines
1.5 KiB
Plaintext
42 lines
1.5 KiB
Plaintext
#if $getVar("system_name","") != ""
|
|
mac_exists() { \
|
|
ip -o link | grep -i "$1" 2>/dev/null >/dev/null; \
|
|
return $?; \
|
|
}; \
|
|
get_ifname() { \
|
|
IFNAME=\$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//'); \
|
|
}; \
|
|
#set ikeys = $interfaces.keys()
|
|
#import re
|
|
#set $vlanpattern = $re.compile("[a-zA-Z0-9]+[\.:][0-9]+")
|
|
#set $routepattern = $re.compile("[0-9/.]+:[0-9.]+")
|
|
#for $iname in $ikeys
|
|
#set $idata = $interfaces[$iname]
|
|
#set $mac = $idata["mac_address"]
|
|
#set $static = $idata["static"]
|
|
#set $management = $idata["management"]
|
|
#set $ip = $idata["ip_address"]
|
|
#set $netmask = $idata["netmask"]
|
|
#set $iface_type = $idata["interface_type"]
|
|
#set $iface_master = $idata["interface_master"]
|
|
#set $static_routes = $idata["static_routes"]
|
|
#if not $management or $mac == ""
|
|
#continue
|
|
#end if
|
|
if mac_exists $mac; then \
|
|
get_ifname $mac; \
|
|
echo "d-i netcfg/choose_interface string \$IFNAME" >> /tmp/pre_install_network_config; \
|
|
#if $static and $ip != ""
|
|
echo "d-i netcfg/get_ipaddress string $ip" >> /tmp/pre_install_network_config; \
|
|
#if $netmask == ""
|
|
#set $netmask = "255.255.255.0"
|
|
#end if
|
|
echo "d-i netcfg/get_netmask string $netmask" >> /tmp/pre_install_network_config; \
|
|
#else
|
|
#continue
|
|
#end if
|
|
fi; \
|
|
#end for
|
|
#end if
|
|
debconf-set-selections /tmp/pre_install_network_config; \
|