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 _CONFIGS_DIR="/tmp/cloud_configs"
21 if [ -e ${_CONFIGS_DIR}/network_config ];then
22 warn "net_config_get_iso: Creating local network configurations, to download boot.iso."
23 source ${_CONFIGS_DIR}/network_config
26 warn "net_config_get_iso: Configuring VLAN network"
27 ip link add link $DEV name ${DEV}.${VLAN} type vlan id $VLAN
28 ip a a $IP dev ${DEV}.${VLAN}
29 ip link set up dev ${DEV}.${VLAN}
30 ip link set up dev ${DEV}
31 ip r a default via ${DGW} dev ${DEV}.${VLAN}
32 EXT_DEV="${DEV}.${VLAN}"
34 warn "net_config_get_iso: Configuring non-VLAN network"
36 ip link set up dev ${DEV}
37 ip r a default via ${DGW} dev ${DEV}
42 ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
47 if [[ $wait_count == 10 ]]; then
48 warn "net_config_get_iso: Link on ${EXT_DEV} did not come-up. Cannot proceed!"
51 warn "net_config_get_iso: Waiting for link to come-up on ${EXT_DEV}..."
52 ip link show ${EXT_DEV} | grep "LOWER_UP" > /dev/null 2>&1
55 warn "net_config_get_iso: Link on ${EXT_DEV} came-up. Proceeding."
57 if [ ${NAMESERVER} ]; then
58 echo "nameserver ${NAMESERVER}" > /etc/resolv.conf
61 # Check if DGW is pinging. If not exit. User may want to cross-check his network_config file and network and fix it.
62 warn "net_config_get_iso: Checking if DGW ${DGW} is pinging."
65 while [ ${gw_ping_status} != 0 ]
68 if [[ ${ping_wait_count} == 120 ]]; then
69 warn "net_config_get_iso: Provided default gateway ${DGW} is not pinging. Exiting installation."
72 if [[ ${DGW} = *:* ]]; then
73 ping -6 -c 1 -w 1 ${DGW} > /dev/null 2>&1
75 ping -c 1 -w 1 ${DGW} > /dev/null 2>&1
81 if [ -f ${_CONFIGS_DIR}/clientcert.pem ]; then
82 CERT_ARGS="--certificate ${_CONFIGS_DIR}/clientcert.pem --private-key ${_CONFIGS_DIR}/clientkey.pem --ca-certificate ${_CONFIGS_DIR}/cacert.pem --no-check-certificate"
84 warn "Downloading Full ISO from URL: ${ISO_URL}"
85 if ! wget --connect-timeout 5 --read-timeout 100 ${CERT_ARGS} --no-check-certificate ${ISO_URL} --progress=dot:giga -O $BOOTCD_LOCATION; then
86 warn "net_config_get_iso: Failed to download ISO from URL: ${ISO_URL}. Exiting installation."