aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/cobbler/snippets/preseed_pre_install_network_config')
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_pre_install_network_config150
1 files changed, 75 insertions, 75 deletions
diff --git a/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config b/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
index ef210a0b..2ea74799 100644
--- a/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
+++ b/deploy/adapters/cobbler/snippets/preseed_pre_install_network_config
@@ -1,75 +1,75 @@
-#if $getVar("system_name","") != ""
- #if $getVar('management_nic', '') == ""
- #set $management_nic=''
- #end if
-echo "generate pre network config" > /tmp/network_log
-# Start pre_install_network_config generated code
-#raw
-# generic functions to be used later for discovering NICs
-mac_exists() {
- if type ip; then
- ip -o link | grep -i "$1" 2>/dev/null >/dev/null
- return $?
- elif type esxcfg-nics; then
- esxcfg-nics -l | grep -i "$1" 2>/dev/null >/dev/null
- return $?
- else
- ifconfig -a | grep -i "$1" 2>/dev/null >/dev/null
- return $?
- fi
-}
-get_ifname() {
- if type ip; then
- IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
- elif type esxcfg-nics; then
- IFNAME=$(esxcfg-nics -l | grep -i "$1" | cut -d " " -f 1)
- else
- IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
- if [ -z "$IFNAME" ]; then
- IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
- fi
- fi
-}
-#end raw
- #set ikeys = $interfaces.keys()
- #for $iname in $ikeys
- #set $idata = $interfaces[$iname]
- #set $management = $idata["management"]
- #if $management
- #set $management_nic = $iname
- #end if
- #end for
- #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 $management_nic != ''
- #if $iname != $management_nic
- #continue
- #end if
- #end if
- #if $mac == ""
- #continue
- #end if
-# Configuring $iname ($mac)
-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
+#if $getVar("system_name","") != ""
+ #if $getVar('management_nic', '') == ""
+ #set $management_nic=''
+ #end if
+echo "generate pre network config" > /tmp/network_log
+# Start pre_install_network_config generated code
+#raw
+# generic functions to be used later for discovering NICs
+mac_exists() {
+ if type ip; then
+ ip -o link | grep -i "$1" 2>/dev/null >/dev/null
+ return $?
+ elif type esxcfg-nics; then
+ esxcfg-nics -l | grep -i "$1" 2>/dev/null >/dev/null
+ return $?
+ else
+ ifconfig -a | grep -i "$1" 2>/dev/null >/dev/null
+ return $?
+ fi
+}
+get_ifname() {
+ if type ip; then
+ IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
+ elif type esxcfg-nics; then
+ IFNAME=$(esxcfg-nics -l | grep -i "$1" | cut -d " " -f 1)
+ else
+ IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
+ if [ -z "$IFNAME" ]; then
+ IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
+ fi
+ fi
+}
+#end raw
+ #set ikeys = $interfaces.keys()
+ #for $iname in $ikeys
+ #set $idata = $interfaces[$iname]
+ #set $management = $idata["management"]
+ #if $management
+ #set $management_nic = $iname
+ #end if
+ #end for
+ #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 $management_nic != ''
+ #if $iname != $management_nic
+ #continue
+ #end if
+ #end if
+ #if $mac == ""
+ #continue
+ #end if
+# Configuring $iname ($mac)
+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