Skip to content

Commit

Permalink
update configeth to support nic extra params for RHEL9, pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrichert committed May 29, 2024
1 parent d4fef44 commit 2ba8bdc
Showing 1 changed file with 118 additions and 119 deletions.
237 changes: 118 additions & 119 deletions xCAT/postscripts/configeth
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ function configipv4(){
if [ "$str_nic_mtu" != "$str_default_token" ]; then
echo "MTU=${str_nic_mtu}" >> $str_conf_file
fi
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
else
echo "IPADDR_${num_v4num}=${str_v4ip}" >> $str_conf_file
echo "NETMASK_${num_v4num}=${str_v4mask}" >> $str_conf_file
Expand All @@ -91,21 +91,21 @@ function configipv4(){
if [ "$str_nic_mtu" != "$str_default_token" ]; then
echo "MTU_${num_v4num}=${str_nic_mtu}" >> $str_conf_file
fi
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
fi

if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then
Expand All @@ -127,21 +127,21 @@ function configipv4(){
if [ "$str_nic_mtu" != "$str_default_token" ]; then
echo " mtu ${str_nic_mtu}" >> $str_conf_file
fi
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
if [[ ${str_if_name} == [a-zA-Z0-9]*.[0-9]* ]]; then
parent_device=`echo ${str_if_name} | sed -e 's/\([a-zA-Z0-9]*\)\.[0-9]*/\1/g'`
echo " vlan-raw-device ${parent_device}" >> $str_conf_file
Expand Down Expand Up @@ -268,20 +268,20 @@ configipv6(){
fi

#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
elif [ "$str_os_type" = "debian" ];then
#debian or ubuntu
str_conf_file="/etc/network/interfaces.d/${str_if_name}"
Expand All @@ -298,20 +298,20 @@ configipv6(){
fi

#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
else
echo " post-up /sbin/ifconfig ${str_if_name} inet6 add ${str_v6ip}/${str_v6prefix}" >> $str_conf_file
echo " pre-down /sbin/ifconfig ${str_if_name} inet6 del ${str_v6ip}/${str_v6prefix}" >> $str_conf_file
Expand All @@ -336,20 +336,20 @@ configipv6(){
fi

#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
fi
}

Expand Down Expand Up @@ -651,21 +651,21 @@ elif [ "$1" = "-s" ];then
if [ -n "$str_inst_gateway" ];then
echo " gateway $str_inst_gateway" >> $str_conf_file
fi
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name} ${value}/i" $str_conf_file
else
echo "${name} ${value}" >> $str_conf_file
fi
i=$((i+1))
done
hostname $NODE
echo $NODE > /etc/hostname
elif [ "$str_os_type" = "sles" ];then
Expand All @@ -688,21 +688,21 @@ elif [ "$1" = "-s" ];then
fi
fi

#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo " $i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
else
echo "${name}=${value}" >> $str_conf_file
fi
i=$((i+1))
done
hostname $NODE
echo $NODE > /etc/HOSTNAME
else
Expand Down Expand Up @@ -778,17 +778,16 @@ elif [ "$1" = "-s" ];then
fi
fi
fi

#add extra params
i=0
while [ $i -lt ${#array_extra_param_names[@]} ]
do
name="${array_extra_param_names[$i]}"
value="${array_extra_param_values[$i]}"
echo "$i: name=$name value=$value"
if [[ "$OSVER" =~ rhels9 ]]; then
nmcli con modify $con_name $name $value
else
echo "$i: name=$name value=$value"
grep -i "${name}" $str_conf_file
if [ $? -eq 0 ];then
sed -i "s/.*${name}.*/${name}=${value}/i" $str_conf_file
Expand Down

0 comments on commit 2ba8bdc

Please sign in to comment.