- update hv_set_ifconfig to work with our ifcfg
OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=34
This commit is contained in:
parent
4410720fee
commit
516b417205
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 26 17:13:40 CEST 2012 - ohering@suse.de
|
||||
|
||||
- update hv_set_ifconfig to work with our ifcfg
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 13 11:40:30 CEST 2012 - ohering@suse.de
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This example script activates an interface based on the specified
|
||||
# configuration.
|
||||
#
|
||||
# In the interest of keeping the KVP daemon code free of distro specific
|
||||
# information; the kvp daemon code invokes this external script to configure
|
||||
@ -10,13 +7,6 @@
|
||||
# The only argument to this script is the configuration file that is to
|
||||
# be used to configure the interface.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for configuring the
|
||||
# interface.
|
||||
#
|
||||
# This example script is based on a RHEL environment.
|
||||
#
|
||||
# Here is the format of the ip configuration file:
|
||||
#
|
||||
# HWADDR=macaddr
|
||||
@ -45,24 +35,49 @@
|
||||
# is expected to return the configuration that is set via the SET
|
||||
# call.
|
||||
#
|
||||
|
||||
|
||||
|
||||
echo "IPV6INIT=yes" >> $1
|
||||
echo "NM_CONTROLLED=no" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
||||
dhcp=$(grep "DHCP" $1 2>/dev/null)
|
||||
if [ "$dhcp" != "" ];
|
||||
cfg=$1
|
||||
if ! test -f "${cfg}"
|
||||
then
|
||||
echo "BOOTPROTO=dhcp" >> $1;
|
||||
: expect configuration datafile as first argument
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
(
|
||||
unset DHCP
|
||||
unset IF_NAME
|
||||
. "$1"
|
||||
if test -z "${IF_NAME}"
|
||||
then
|
||||
echo "Missing IF_NAME= in ${cfg}"
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
t=`mktemp`
|
||||
if test -z "${t}"
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp $1 /etc/sysconfig/network-scripts/
|
||||
_exit() {
|
||||
rm -f "${t}"
|
||||
}
|
||||
trap _exit EXIT
|
||||
#
|
||||
cat >> "${t}" <<_EOF_
|
||||
# contents from $0 $*
|
||||
`cat "${cfg}"`
|
||||
#
|
||||
# additional options:
|
||||
STARTMODE=auto
|
||||
_EOF_
|
||||
|
||||
if test "${DHCP}" = "yes"
|
||||
then
|
||||
echo "BOOTPROTO=dhcp" >> ${t};
|
||||
fi
|
||||
|
||||
interface=$(echo $1 | awk -F - '{ print $2 }')
|
||||
|
||||
/sbin/ifdown $interface 2>/dev/null
|
||||
/sbin/ifup $interfac 2>/dev/null
|
||||
echo "$0: working on network interface ifcfg-${IF_NAME}"
|
||||
cp -b ${t} /etc/sysconfig/network/ifcfg-${IF_NAME}
|
||||
ifdown ${IF_NAME} -o hotplug
|
||||
ifup ${IF_NAME} -o hotplug
|
||||
) 2>&1 | logger -t "${0##*/}[$PPID / $$]"
|
||||
|
Loading…
x
Reference in New Issue
Block a user