5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 source /usr/lib/installmedia-lib.sh
20 if [ -e /tmp/cloud_configs/network_config ];then
21 warn "net_config_get_iso: Creating local network configurations, to download boot.iso."
22 source /tmp/cloud_configs/network_config
25 warn "net_config_get_iso: Configuring VLAN network"
26 ip link add link $DEV name ${DEV}.${VLAN} type vlan id $VLAN
27 ip a a $IP dev ${DEV}.${VLAN}
28 ip link set up dev ${DEV}.${VLAN}
29 ip link set up dev ${DEV}
30 ip r a default via ${DGW} dev ${DEV}.${VLAN}
31 EXT_DEV="${DEV}.${VLAN}"
33 warn "net_config_get_iso: Configuring non-VLAN network"
35 ip link set up dev ${DEV}
36 ip r a default via ${DGW} dev ${DEV}
41 ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
46 if [[ $wait_count == 10 ]]; then
47 warn "net_config_get_iso: Link on ${EXT_DEV} did not come-up. Cannot proceed!"
50 warn "net_config_get_iso: Waiting for link to come-up on ${EXT_DEV}..."
51 ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
54 warn "net_config_get_iso: Link on ${EXT_DEV} came-up. Proceeding."
56 if [ ${NAMESERVER} ]; then
57 echo "nameserver ${NAMESERVER}" > /etc/resolv.conf
60 # Check if DGW is pinging. If not exit. User may want to cross-check his network_config file and network and fix it.
61 warn "net_config_get_iso: Checking if DGW ${DGW} is pinging."
64 while [ ${gw_ping_status} != 0 ]
67 if [[ ${ping_wait_count} == 120 ]]; then
68 warn "net_config_get_iso: Provided default gateway ${DGW} is not pinging. Exiting installation."
71 if [[ ${DGW} = *:* ]]; then
72 ping -6 -c 1 -w 1 ${DGW} > /dev/null 2>&1
74 ping -c 1 -w 1 ${DGW} > /dev/null 2>&1
79 warn "Downloading Full ISO from URL: ${ISO_URL}"
80 if ! wget --connect-timeout 5 --read-timeout 100 --no-check-certificate ${ISO_URL} --progress=dot:giga -O $BOOTCD_LOCATION; then
81 warn "net_config_get_iso: Failed to download ISO from URL: ${ISO_URL}. Exiting installation."