2011-04-21 14:25:31 +02:00
|
|
|
#
|
|
|
|
# spec file for package hyper-v
|
|
|
|
#
|
2013-03-22 16:49:02 +01:00
|
|
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2011-04-21 14:25:31 +02:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2011-06-17 10:34:43 +02:00
|
|
|
%define hv_kvp_daemon hv_kvp_daemon
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
Name: hyper-v
|
|
|
|
ExclusiveArch: %ix86 x86_64
|
2011-04-21 17:35:05 +02:00
|
|
|
PreReq: %insserv_prereq
|
2013-03-22 16:49:02 +01:00
|
|
|
Requires(pre): coreutils
|
2011-06-17 11:12:20 +02:00
|
|
|
Summary: Microsoft Hyper-V tools
|
2012-05-02 12:13:59 +02:00
|
|
|
License: GPL-2.0
|
|
|
|
Group: System/Kernel
|
2011-11-19 15:02:35 +01:00
|
|
|
Supplements: modalias(dmi*:svn*MicrosoftCorporation*:pn*VirtualMachine*:rn*VirtualMachine*)
|
|
|
|
Supplements: modalias(pci:v00001414d00005353sv*sd*bc*sc*i*)
|
2011-04-21 14:25:31 +02:00
|
|
|
Url: http://www.kernel.org
|
2012-10-04 15:33:40 +02:00
|
|
|
Version: 4
|
2011-06-17 11:10:44 +02:00
|
|
|
Release: 0
|
2012-03-27 08:51:38 +02:00
|
|
|
Source5: hyper-v.kvptest.ps1.txt
|
2012-03-26 19:08:24 +02:00
|
|
|
Source9: hyper-v.include.linux.hyperv.h
|
|
|
|
Source10: hyper-v.tools.hv.hv_kvp_daemon.c
|
2011-04-21 17:35:05 +02:00
|
|
|
Source11: hyper-v.init.sh
|
2012-10-04 15:33:40 +02:00
|
|
|
Source20: hyper-v.tools.hv.hv_get_dhcp_info.sh
|
|
|
|
Source21: hyper-v.tools.hv.hv_get_dns_info.sh
|
|
|
|
Source22: hyper-v.tools.hv.hv_set_ifconfig.sh
|
|
|
|
|
2011-04-21 14:25:31 +02:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
|
|
|
|
%description
|
2011-06-17 11:12:20 +02:00
|
|
|
This package contains the Microsoft Hyper-V tools.
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -Tc
|
2012-03-27 08:51:38 +02:00
|
|
|
cp -avL %{S:5} kvptest.ps1.txt
|
2012-03-26 19:08:24 +02:00
|
|
|
cp -vL %{S:9} %{hv_kvp_daemon}.h
|
|
|
|
cp -vL %{S:10} %{hv_kvp_daemon}.c
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
%build
|
2012-05-16 20:45:41 +02:00
|
|
|
sed -i~ '/#include <linux.hyperv.h>/d' %{hv_kvp_daemon}.c
|
2012-03-26 19:08:24 +02:00
|
|
|
gcc \
|
|
|
|
$RPM_OPT_FLAGS \
|
2012-05-16 20:45:41 +02:00
|
|
|
-Wno-unused-variable \
|
|
|
|
-Wno-pointer-sign \
|
2013-03-22 16:58:18 +01:00
|
|
|
-D_GNU_SOURCE \
|
2012-03-26 19:08:24 +02:00
|
|
|
-g \
|
|
|
|
%{hv_kvp_daemon}.c \
|
|
|
|
-include %{hv_kvp_daemon}.h \
|
|
|
|
-DCN_KVP_IDX=0x9 \
|
|
|
|
-DCN_KVP_VAL=0x1 \
|
|
|
|
-o %{hv_kvp_daemon}
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
%install
|
2011-04-21 17:35:05 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
2011-06-17 10:34:43 +02:00
|
|
|
install -m755 %{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin
|
2012-10-04 15:33:40 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/%{name}/bin
|
|
|
|
cp -avL %{S:20} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_get_dhcp_info
|
|
|
|
cp -avL %{S:21} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_get_dns_info
|
|
|
|
cp -avL %{S:22} $RPM_BUILD_ROOT/usr/lib/%{name}/bin/hv_set_ifconfig
|
|
|
|
chmod 755 $RPM_BUILD_ROOT/usr/lib/%{name}/bin/*
|
2011-04-21 17:35:05 +02:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
2011-06-17 10:34:43 +02:00
|
|
|
install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon}
|
|
|
|
ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_daemon}
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr (-,root,root)
|
2012-03-27 08:51:38 +02:00
|
|
|
%doc kvptest.ps1.txt
|
2011-06-17 10:34:43 +02:00
|
|
|
/etc/init.d/%{hv_kvp_daemon}
|
|
|
|
/usr/sbin/rc%{hv_kvp_daemon}
|
|
|
|
/usr/sbin/%{hv_kvp_daemon}
|
2012-10-04 15:33:40 +02:00
|
|
|
/usr/lib/%{name}
|
2011-04-21 17:35:05 +02:00
|
|
|
|
2013-03-22 16:49:02 +01:00
|
|
|
%pre
|
|
|
|
# hv_kvp_daemon in SLES11 SP2 stored temporary state files in /var/opt
|
|
|
|
# move them to /var/lib and remove old directory, if possible.
|
|
|
|
if test -d /var/opt/hyperv
|
|
|
|
then
|
|
|
|
if mkdir -p -v -m 0755 /var/lib/hyperv && pushd /var/lib/hyperv > /dev/null
|
|
|
|
then
|
|
|
|
for oldfile in /var/opt/hyperv/ifcfg-* /var/opt/hyperv/.kvp_pool_*
|
|
|
|
do
|
|
|
|
if test -e "${oldfile}"
|
|
|
|
then
|
|
|
|
mv -vfb "${oldfile}" . || :
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
fi
|
|
|
|
rmdir -v /var/opt/hyperv || :
|
|
|
|
fi
|
|
|
|
|
2011-04-21 17:35:05 +02:00
|
|
|
%post
|
2011-06-17 08:10:53 +02:00
|
|
|
board_vendor=
|
|
|
|
product_name=
|
|
|
|
if pushd /sys/class/dmi/id > /dev/null 2>/dev/null
|
2011-06-16 11:14:38 +02:00
|
|
|
then
|
|
|
|
if test -r board_vendor
|
|
|
|
then
|
|
|
|
board_vendor="`cat board_vendor`"
|
|
|
|
fi
|
2011-06-17 08:10:53 +02:00
|
|
|
if test -r product_name
|
2011-06-16 11:14:38 +02:00
|
|
|
then
|
2011-06-17 08:10:53 +02:00
|
|
|
product_name="`cat product_name`"
|
2011-06-16 11:14:38 +02:00
|
|
|
fi
|
2011-06-17 08:10:53 +02:00
|
|
|
popd > /dev/null
|
|
|
|
fi
|
2011-06-17 10:56:56 +02:00
|
|
|
if test "${board_vendor}" = "Microsoft Corporation" -a "${product_name}" = "Virtual Machine"
|
2011-06-17 08:10:53 +02:00
|
|
|
then
|
2011-06-17 10:34:43 +02:00
|
|
|
echo "Enabling %{hv_kvp_daemon} on '${product_name}' from '${board_vendor}'"
|
2012-05-02 12:13:59 +02:00
|
|
|
%{insserv_force_if_yast %{hv_kvp_daemon}}
|
2011-06-16 11:14:38 +02:00
|
|
|
fi
|
2011-04-21 17:35:05 +02:00
|
|
|
|
|
|
|
%preun
|
2011-06-17 15:42:13 +02:00
|
|
|
%stop_on_removal %{hv_kvp_daemon}
|
2011-04-21 17:35:05 +02:00
|
|
|
|
|
|
|
%postun
|
2012-09-04 14:57:10 +02:00
|
|
|
# no restart on update because the daemon can not be restarted
|
2011-04-21 17:35:05 +02:00
|
|
|
%insserv_cleanup
|
2011-04-21 14:25:31 +02:00
|
|
|
|
|
|
|
%changelog
|