From a50ee553aa5d370870c84a95009c702c561e56383cd0a3fab113c18ac08be99d Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 21 May 2014 10:06:32 +0000 Subject: [PATCH 1/2] - Start hyper-v helpers manually with helper script in inst-sys OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=93 --- hyper-v.changes | 5 +++++ hyper-v.spec | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/hyper-v.changes b/hyper-v.changes index 9acea3f..aea2585 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed May 21 12:05:31 CEST 2014 - ohering@suse.de + +- Start hyper-v helpers manually with helper script in inst-sys + ------------------------------------------------------------------- Thu Apr 10 19:19:04 CEST 2014 - ohering@suse.de diff --git a/hyper-v.spec b/hyper-v.spec index 3570bfe..9849226 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -195,6 +195,32 @@ EOF # head -n 42 ${d}/*.rules # +helper=inst_sys.sh +cat > $RPM_BUILD_ROOT${bindir}/${helper} < Date: Mon, 26 May 2014 13:51:55 +0000 Subject: [PATCH 2/2] - copy mask2pfxlen from /etc/sysconfig/network/scripts/functions to hv_set_ifconfig (bnc#879256) OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=94 --- hyper-v.changes | 6 +++++ hyper-v.tools.hv.hv_set_ifconfig.sh | 39 +++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/hyper-v.changes b/hyper-v.changes index aea2585..d5faa2d 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 26 15:50:21 CEST 2014 - ohering@suse.de + +- copy mask2pfxlen from /etc/sysconfig/network/scripts/functions + to hv_set_ifconfig (bnc#879256) + ------------------------------------------------------------------- Wed May 21 12:05:31 CEST 2014 - ohering@suse.de diff --git a/hyper-v.tools.hv.hv_set_ifconfig.sh b/hyper-v.tools.hv.hv_set_ifconfig.sh index e3ccd56..ae861d3 100644 --- a/hyper-v.tools.hv.hv_set_ifconfig.sh +++ b/hyper-v.tools.hv.hv_set_ifconfig.sh @@ -44,14 +44,37 @@ then fi # send subshell output to syslog ( -f=/etc/sysconfig/network/scripts/functions -if test -f ${f} -then - . ${f} -else - echo "MISSING ${f}" - exit 1 -fi +# copied from /etc/sysconfig/network/scripts/functions +mask2pfxlen() { + local i octet width=0 mask=(${1//./ }) + test ${#mask[@]} -eq 4 || return 1 + for octet in 0 1 2 3 + do + test "${mask[octet]}" -ge 0 -a "${mask[octet]}" -le 255 || return 1 + for i in 128 192 224 240 248 252 254 255 + do + test ${mask[octet]} -ge $i && ((width++)) + done + done + echo $width + return 0 +} + +pfxlen2mask() { + test -n "$1" || return 1 + local o i n=0 adr=() len=$(($1)) + for o in 0 1 2 3 + do + adr[$o]=0 + for i in 128 64 32 16 8 4 2 1 + do + ((n++ < len)) && ((adr[$o] = ${adr[$o]} + $i)) + done + done + echo ${adr[0]}.${adr[1]}.${adr[2]}.${adr[3]} + return 0 +} + # remove known config variables from environment unset HWADDR unset BOOTPROTO