mkconfig: only generate MAC address if cfg_eth_ext_soft_mac is set.

This commit is contained in:
Ricardo Martins 2014-01-07 18:25:29 +00:00
parent 87ba2c2876
commit c53a963048

View File

@ -88,14 +88,15 @@ if ! [ -f "architectures/$cfg_architecture.cfg" ]; then
fi fi
source "architectures/$cfg_architecture.cfg" source "architectures/$cfg_architecture.cfg"
# Creating the mac address if not set in configuration file we create one derivated from the IP address: # Create a MAC address based on the IP address if cfg_eth_ext_soft_mac
if [ -n $cfg_eth_ext_ip ]; then # is set.
ips=(`echo $cfg_eth_ext_ip | sed -e 's/\./\n/g'`) if [ -n "$cfg_eth_ext_ip" ] && [ -n "$cfg_eth_ext_soft_mac" ]; then
for i in "${ips[@]}" ips=(`echo $cfg_eth_ext_ip | sed -e 's/\./\n/g'`)
do for i in "${ips[@]}"
hip=("${hip[@]}" `printf '%x' $i`) do
done hip=("${hip[@]}" `printf '%x' $i`)
cfg_eth_ext_mac="80:c1:${hip[0]}:${hip[1]}:${hip[2]}:${hip[3]}" done
cfg_eth_ext_mac="80:c1:${hip[0]}:${hip[1]}:${hip[2]}:${hip[3]}"
fi fi
# Config: system name. # Config: system name.