f4cfec7
# Hyper-V KVP daemon binary name
8e8f9a7
%global hv_kvp_daemon hypervkvpd
f4cfec7
# Hyper-V VSS daemon binary name
8e8f9a7
%global hv_vss_daemon hypervvssd
f4cfec7
# Hyper-V FCOPY daemon binary name
29897df
%global hv_fcopy_daemon hypervfcopyd
8e8f9a7
# snapshot version
ad858a2
%global snapver .20170105git
8e8f9a7
# use hardened build
8e8f9a7
%global _hardened_build 1
333be5b
# udev rules prefix
333be5b
%global udev_prefix 70
8e8f9a7
8e8f9a7
Name:     hyperv-daemons
8e8f9a7
Version:  0
86fc8ab
Release:  0.22%{?snapver}%{?dist}
f4cfec7
Summary:  Hyper-V daemons suite
8e8f9a7
8e8f9a7
Group:    System Environment/Daemons
8e8f9a7
License:  GPLv2
8e8f9a7
URL:      http://www.kernel.org
8e8f9a7
ad858a2
# Source files obtained from kernel upstream 4.9 (69973b830859bc6529a7a0468ba0d80ee5117826)
6abf3a1
# git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
8e8f9a7
# The daemon and scripts are located in "master branch - /tools/hv"
ad858a2
# COPYING -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/COPYING?id=69973b830859bc6529a7a0468ba0d80ee5117826
8e8f9a7
Source0:  COPYING
8e8f9a7
8e8f9a7
# HYPERV KVP DAEMON
8e8f9a7
Source1:  hv_kvp_daemon.c
8e8f9a7
Source2:  hv_get_dhcp_info.sh
8e8f9a7
Source3:  hv_get_dns_info.sh
8e8f9a7
Source4:  hv_set_ifconfig.sh
8e8f9a7
Source5:  hypervkvpd.service
333be5b
Source6:  hypervkvp.rules
8e8f9a7
8e8f9a7
# HYPERV VSS DAEMON
8e8f9a7
Source100:  hv_vss_daemon.c
8e8f9a7
Source101:  hypervvssd.service
333be5b
Source102:  hypervvss.rules
8e8f9a7
29897df
# HYPERV FCOPY DAEMON
29897df
Source200:  hv_fcopy_daemon.c
29897df
Source201:  hypervfcopyd.service
333be5b
Source202:  hypervfcopy.rules
29897df
ad887a2
# HYPERV TOOLS
ad887a2
Source301:  lsvmbus
29897df
f4cfec7
# Hyper-V is available only on x86 architectures
ab595aa
# The base empty (a.k.a. virtual) package can not be noarch
ab595aa
# due to http://www.rpm.org/ticket/78
8e8f9a7
ExclusiveArch:  i686 x86_64
ab595aa
8e8f9a7
Requires:       hypervkvpd = %{version}-%{release}
8e8f9a7
Requires:       hypervvssd = %{version}-%{release}
29897df
Requires:       hypervfcopyd = %{version}-%{release}
8e8f9a7
8e8f9a7
%description
8e8f9a7
Suite of daemons that are needed when Linux guest
f4cfec7
is running on Windows Host with Hyper-V.
8e8f9a7
8e8f9a7
8e8f9a7
%package -n hypervkvpd
f4cfec7
Summary: Hyper-V key value pair (KVP) daemon
8e8f9a7
Group:   System Environment/Daemons
8e8f9a7
Requires: %{name}-license = %{version}-%{release}
a18ceab
BuildRequires: systemd, kernel-headers
8e8f9a7
Requires(post):   systemd
8e8f9a7
Requires(preun):  systemd
8e8f9a7
Requires(postun): systemd
8e8f9a7
8e8f9a7
%description -n hypervkvpd
f4cfec7
Hypervkvpd is an implementation of Hyper-V key value pair (KVP)
8e8f9a7
functionality for Linux. The daemon first registers with the
0ce7815
kernel driver. After this is done it collects information
8e8f9a7
requested by Windows Host about the Linux Guest. It also supports
8e8f9a7
IP injection functionality on the Guest.
8e8f9a7
8e8f9a7
8e8f9a7
%package -n hypervvssd
f4cfec7
Summary: Hyper-V VSS daemon
8e8f9a7
Group:   System Environment/Daemons
8e8f9a7
Requires: %{name}-license = %{version}-%{release}
a18ceab
BuildRequires: systemd, kernel-headers
8e8f9a7
Requires(post):   systemd
8e8f9a7
Requires(preun):  systemd
8e8f9a7
Requires(postun): systemd
8e8f9a7
8e8f9a7
%description -n hypervvssd
f4cfec7
Hypervvssd is an implementation of Hyper-V VSS functionality
8e8f9a7
for Linux. The daemon is used for host initiated guest snapshot
f4cfec7
on Hyper-V hypervisor. The daemon first registers with the
0ce7815
kernel driver. After this is done it waits for instructions
8e8f9a7
from Windows Host if to "freeze" or "thaw" the filesystem
8e8f9a7
on the Linux Guest.
8e8f9a7
8e8f9a7
29897df
%package -n hypervfcopyd
f4cfec7
Summary: Hyper-V FCOPY daemon
29897df
Group:   System Environment/Daemons
29897df
Requires: %{name}-license = %{version}-%{release}
29897df
BuildRequires: systemd, kernel-headers
29897df
Requires(post):   systemd
29897df
Requires(preun):  systemd
29897df
Requires(postun): systemd
29897df
29897df
%description -n hypervfcopyd
29897df
Hypervfcopyd is an implementation of file copy service functionality
f4cfec7
for Linux Guest running on Hyper-V. The daemon enables host to copy
29897df
a file (over VMBUS) into the Linux Guest. The daemon first registers
0ce7815
with the kernel driver. After this is done it waits for instructions
29897df
from Windows Host.
29897df
29897df
8e8f9a7
%package license
f4cfec7
Summary:    License of the Hyper-V daemons suite
8e8f9a7
Group:      Applications/System
8e8f9a7
BuildArch:  noarch
8e8f9a7
8e8f9a7
%description license
f4cfec7
Contains license of the Hyper-V daemons suite.
8e8f9a7
ad887a2
%package -n hyperv-tools
ad887a2
Summary:    Tools for Hyper-V guests
ad887a2
Group:      Applications/System
ad887a2
BuildArch:  noarch
ad887a2
ad887a2
%description -n hyperv-tools
ad887a2
Contains tools and scripts useful for Hyper-V guests.
8e8f9a7
8e8f9a7
%prep
8e8f9a7
%setup -Tc
8e8f9a7
cp -pvL %{SOURCE0} COPYING
8e8f9a7
8e8f9a7
cp -pvL %{SOURCE1} hv_kvp_daemon.c
8e8f9a7
cp -pvL %{SOURCE100} hv_vss_daemon.c
29897df
cp -pvL %{SOURCE200} hv_fcopy_daemon.c
29897df
8e8f9a7
%build
8e8f9a7
# HYPERV KVP DAEMON
6abf3a1
gcc $RPM_OPT_FLAGS -c hv_kvp_daemon.c
6abf3a1
gcc $RPM_LD_FLAGS  hv_kvp_daemon.o -o %{hv_kvp_daemon}
8e8f9a7
8e8f9a7
# HYPERV VSS DAEMON
6abf3a1
gcc $RPM_OPT_FLAGS -c hv_vss_daemon.c
6abf3a1
gcc $RPM_LD_FLAGS hv_vss_daemon.o -o %{hv_vss_daemon}
8e8f9a7
29897df
# HYPERV FCOPY DAEMON
6abf3a1
gcc $RPM_OPT_FLAGS -c hv_fcopy_daemon.c
6abf3a1
gcc $RPM_LD_FLAGS hv_fcopy_daemon.o -o %{hv_fcopy_daemon}
8e8f9a7
8e8f9a7
%install
8e8f9a7
rm -rf %{buildroot}
8e8f9a7
8e8f9a7
mkdir -p %{buildroot}%{_sbindir}
8e8f9a7
install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir}
8e8f9a7
install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir}
29897df
install -p -m 0755 %{hv_fcopy_daemon} %{buildroot}%{_sbindir}
8e8f9a7
# Systemd unit file
333be5b
mkdir -p %{buildroot}%{_unitdir}
8e8f9a7
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
8e8f9a7
install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
29897df
install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir}
333be5b
# Udev rules
333be5b
mkdir -p %{buildroot}%{_udevrulesdir}
333be5b
install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
333be5b
install -p -m 0644 %{SOURCE102} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
333be5b
install -p -m 0644 %{SOURCE202} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
269fc42
# Shell scripts for the KVP daemon
269fc42
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
333be5b
install -p -m 0755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
333be5b
install -p -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
333be5b
install -p -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
8e8f9a7
# Directory for pool files
8e8f9a7
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
8e8f9a7
ad887a2
# Tools
ad887a2
install -p -m 0755 %{SOURCE301} %{buildroot}%{_sbindir}/
ad887a2
8e8f9a7
%post -n hypervkvpd
a894d75
if [ $1 -gt 1 ] ; then
1f9ef4b
	# Upgrade
1f9ef4b
	systemctl --no-reload disable hypervkvpd.service >/dev/null 2>&1 || :
1f9ef4b
fi
8e8f9a7
8e8f9a7
%preun -n hypervkvpd
8e8f9a7
%systemd_preun hypervkvpd.service
8e8f9a7
8e8f9a7
%postun -n hypervkvpd
8e8f9a7
# hypervkvpd daemon does NOT support restarting (driver, neither)
8e8f9a7
%systemd_postun hypervkvpd.service
8e8f9a7
# If removing the package, delete %%{_sharedstatedir}/hyperv directory
8e8f9a7
if [ "$1" -eq "0" ] ; then
8e8f9a7
    rm -rf %{_sharedstatedir}/hyperv || :
8e8f9a7
fi
8e8f9a7
8e8f9a7
8e8f9a7
%post -n hypervvssd
a894d75
if [ $1 -gt 1 ] ; then
1f9ef4b
	# Upgrade
1f9ef4b
	systemctl --no-reload disable hypervvssd.service >/dev/null 2>&1 || :
1f9ef4b
fi
8e8f9a7
8e8f9a7
%postun -n hypervvssd
8e8f9a7
%systemd_postun hypervvssd.service
8e8f9a7
8e8f9a7
%preun -n hypervvssd
8e8f9a7
%systemd_preun hypervvssd.service
8e8f9a7
29897df
29897df
%post -n hypervfcopyd
a894d75
if [ $1 -gt 1 ] ; then
1f9ef4b
	# Upgrade
1f9ef4b
	systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
1f9ef4b
fi
29897df
29897df
%postun -n hypervfcopyd
29897df
%systemd_postun hypervfcopyd.service
29897df
29897df
%preun -n hypervfcopyd
29897df
%systemd_preun hypervfcopyd.service
29897df
29897df
ab595aa
%files
ab595aa
# the base package does not contain any files.
8e8f9a7
8e8f9a7
%files -n hypervkvpd
8e8f9a7
%{_sbindir}/%{hv_kvp_daemon}
8e8f9a7
%{_unitdir}/hypervkvpd.service
333be5b
%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
269fc42
%dir %{_libexecdir}/%{hv_kvp_daemon}
269fc42
%{_libexecdir}/%{hv_kvp_daemon}/*
8e8f9a7
%dir %{_sharedstatedir}/hyperv
8e8f9a7
8e8f9a7
%files -n hypervvssd
8e8f9a7
%{_sbindir}/%{hv_vss_daemon}
8e8f9a7
%{_unitdir}/hypervvssd.service
333be5b
%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
8e8f9a7
29897df
%files -n hypervfcopyd
29897df
%{_sbindir}/%{hv_fcopy_daemon}
29897df
%{_unitdir}/hypervfcopyd.service
333be5b
%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
29897df
8e8f9a7
%files license
8e8f9a7
%doc COPYING
8e8f9a7
ad887a2
%files -n hyperv-tools
ad887a2
%{_sbindir}/lsvmbus
ad887a2
8e8f9a7
%changelog
86fc8ab
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.22.20170105git
86fc8ab
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
86fc8ab
37eb5f0
* Mon Dec 11 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.21.20170105git
37eb5f0
- Rebase to 4.15-rc2, drop fedora patches as changes are upstream
37eb5f0
- Start kvpd after network.target
37eb5f0
ebe9c35
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.20.20170105git
ebe9c35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
ebe9c35
7b57797
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.19.20170105git
7b57797
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
7b57797
d191412
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.18.20170105git
d191412
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
d191412
a894d75
* Wed Jan 11 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.17.20160728git
a894d75
- Use '-gt' instead of '>' to do the right comparison (#1412033)
a894d75
ad858a2
* Thu Jan 05 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.16.20160728git
ad858a2
- Rebase to 4.9
ad858a2
- hyperv-tools subpackage added
ad858a2
adee12b
* Thu Jul 28 2016 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.15.20160728git
adee12b
- Rebase to 4.8-rc0 (20160728 git snapshot)
1f9ef4b
- Disable services and remove ConditionVirtualization, multi-user.target
1f9ef4b
  dependencies switching to udev-only activation (#1331577)
adee12b
6803bec
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.14.20150702git
6803bec
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
6803bec
333be5b
* Wed Nov 18 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.13.20150702git
333be5b
- Add udev rules to properly restart services (#1195029)
333be5b
- Spec cleanup
333be5b
519c426
* Thu Jul 02 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.12.20150702git
519c426
- Rebase to 4.2-rc0 (20150702 git snapshot)
519c426
- Switch to new chardev-based communication layer (#1195029)
519c426
9ace6b9
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.11.20150108git
9ace6b9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
9ace6b9
6abf3a1
* Thu Jan 08 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.10.20150108git
6abf3a1
- Rebase to 3.19-rc3 (20150108 git snapshot)
6abf3a1
- Drop 'nodaemon' patches, use newly introduced '-n' option
6abf3a1
fc05cdf
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.9.20140714git
fc05cdf
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
fc05cdf
889f1c1
* Mon Jul 14 2014 Tomas Hozza <thozza@redhat.com> - 0-0.8.20140714git
889f1c1
- Update the File copy daemon to the latest git snapshot
889f1c1
- Fix hyperfcopyd.service to check for /dev/vmbus/hv_fcopy
889f1c1
29897df
* Wed Jun 11 2014 Tomas Hozza <thozza@redhat.com> - 0-0.7.20140611git
a18ceab
- Fix FTBFS (#1106781)
a18ceab
- Use kernel-headers instead of kernel-devel for building
29897df
- package new Hyper-V fcopy daemon as hypervfcopyd sub-package
a18ceab
2525b93
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.6.20140219git
2525b93
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
2525b93
065701e
* Wed Feb 19 2014 Tomas Hozza <thozza@redhat.com> - 0-0.5.20140219git
065701e
- rebase to the latest git snapshot next-20140219
065701e
  - KVP, VSS: removed inclusion of linux/types.h
065701e
  - VSS: Ignore VFAT mounts during freeze operation
065701e
ab595aa
* Fri Jan 10 2014 Tomas Hozza <thozza@redhat.com> - 0-0.4.20131022git
ab595aa
- provide 'hyperv-daemons' package for convenient installation of all daemons
ab595aa
a2f57a7
* Tue Oct 22 2013 Tomas Hozza <thozza@redhat.com> - 0-0.3.20131022git
a2f57a7
- rebase to the latest git snapshot next-20130927 (obtained 2013-10-22)
a2f57a7
  - KVP, VSS: daemon use single buffer for send/recv
a2f57a7
  - KVP: FQDN is obtained on start and cached
a2f57a7
269fc42
* Fri Sep 20 2013 Tomas Hozza <thozza@redhat.com> - 0-0.2.20130826git
269fc42
- Use 'hypervkvpd' directory in libexec for KVP daemon scripts (#1010268)
10e51ea
- daemons are now WantedBy multi-user.target instead of basic.target (#1010260)
269fc42
8e8f9a7
* Mon Aug 26 2013 Tomas Hozza <thozza@redhat.com> - 0-0.1.20130826git
8e8f9a7
- Initial package