forked from pool/hyper-v
- update hv_kvp_daemon (merge 0783d72fa from v3.9-rc1)
Fix how ifcfg-* file is created OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=59
This commit is contained in:
@@ -10,18 +10,19 @@
|
||||
# Here is the format of the ip configuration file:
|
||||
#
|
||||
# HWADDR=macaddr
|
||||
# IF_NAME=interface name
|
||||
# DHCP=yes (This is optional; if yes, DHCP is configured)
|
||||
# DEVICE=interface name
|
||||
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
|
||||
# or "none" if no boot-time protocol should be used)
|
||||
#
|
||||
# IPADDR=ipaddr1
|
||||
# IPADDR_1=ipaddr2
|
||||
# IPADDR_x=ipaddry (where y = x + 1)
|
||||
# IPADDR0=ipaddr1
|
||||
# IPADDR1=ipaddr2
|
||||
# IPADDRx=ipaddry (where y = x + 1)
|
||||
#
|
||||
# NETMASK=netmask1
|
||||
# NETMASK_x=netmasky (where y = x + 1)
|
||||
# NETMASK0=netmask1
|
||||
# NETMASKx=netmasky (where y = x + 1)
|
||||
#
|
||||
# GATEWAY=ipaddr1
|
||||
# GATEWAY_x=ipaddry (where y = x + 1)
|
||||
# GATEWAYx=ipaddry (where y = x + 1)
|
||||
#
|
||||
# DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
|
||||
#
|
||||
@@ -53,8 +54,8 @@ else
|
||||
fi
|
||||
# remove known config variables from environment
|
||||
unset HWADDR
|
||||
unset DHCP
|
||||
unset IF_NAME
|
||||
unset BOOTPROTO
|
||||
unset DEVICE
|
||||
unset ${!IPADDR*}
|
||||
unset ${!NETMASK*}
|
||||
unset ${!GATEWAY*}
|
||||
@@ -64,9 +65,9 @@ unset ${!IPV6_DEFAULTGW*}
|
||||
unset ${!DNS*}
|
||||
. "$1"
|
||||
#
|
||||
if test -z "${IF_NAME}"
|
||||
if test -z "${DEVICE}"
|
||||
then
|
||||
echo "Missing IF_NAME= in ${cfg}"
|
||||
echo "Missing DEVICE= in ${cfg}"
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
@@ -91,7 +92,7 @@ fi
|
||||
: # ignore HWADDR, it just repeats the existing MAC value
|
||||
fi
|
||||
#
|
||||
if test "${DHCP}" = "yes"
|
||||
if test "${BOOTPROTO}" = "dhcp"
|
||||
then
|
||||
echo "BOOTPROTO=dhcp"
|
||||
fi
|
||||
@@ -145,11 +146,11 @@ fi
|
||||
(
|
||||
if test -n "${GATEWAY}"
|
||||
then
|
||||
echo "default $GATEWAY - $IF_NAME"
|
||||
echo "default $GATEWAY - $DEVICE"
|
||||
fi
|
||||
if test -n "${IPV6_DEFAULTGW}"
|
||||
then
|
||||
echo "default $IPV6_DEFAULTGW - $IF_NAME"
|
||||
echo "default $IPV6_DEFAULTGW - $DEVICE"
|
||||
fi
|
||||
) >> "${t_ifroute}"
|
||||
# Only a single default gateway is supported
|
||||
@@ -172,14 +173,14 @@ do
|
||||
fi
|
||||
done
|
||||
#
|
||||
echo "$0: working on network interface ifcfg-${IF_NAME}"
|
||||
cp -fb ${t_ifcfg} "/etc/sysconfig/network/ifcfg-${IF_NAME}"
|
||||
cp -fb ${t_ifroute} "/etc/sysconfig/network/ifroute-${IF_NAME}"
|
||||
echo "$0: working on network interface ifcfg-${DEVICE}"
|
||||
cp -fb ${t_ifcfg} "/etc/sysconfig/network/ifcfg-${DEVICE}"
|
||||
cp -fb ${t_ifroute} "/etc/sysconfig/network/ifroute-${DEVICE}"
|
||||
if test -w /etc/sysconfig/network/config
|
||||
then
|
||||
sed -i "s@^NETCONFIG_DNS_STATIC_SERVERS=.*@NETCONFIG_DNS_STATIC_SERVERS='$_DNS_'@" /etc/sysconfig/network/config
|
||||
netconfig update -m dns
|
||||
fi
|
||||
ifdown "${IF_NAME}"
|
||||
ifup "${IF_NAME}"
|
||||
ifdown "${DEVICE}"
|
||||
ifup "${DEVICE}"
|
||||
) 2>&1 | logger -t "${0##*/}[$PPID / $$]"
|
||||
|
Reference in New Issue
Block a user