8e8f9a7
# HyperV KVP daemon binary name
8e8f9a7
%global hv_kvp_daemon hypervkvpd
8e8f9a7
# HyperV VSS daemon binary name
8e8f9a7
%global hv_vss_daemon hypervvssd
29897df
# HyperV FCOPY daemon binary name
29897df
%global hv_fcopy_daemon hypervfcopyd
8e8f9a7
# snapshot version
519c426
%global snapver .20150702git
8e8f9a7
# use hardened build
8e8f9a7
%global _hardened_build 1
20c667d
# udev rules prefix
20c667d
%global udev_prefix 70
8e8f9a7
8e8f9a7
Name:     hyperv-daemons
8e8f9a7
Version:  0
20c667d
Release:  0.13%{?snapver}%{?dist}
8e8f9a7
Summary:  HyperV daemons suite
8e8f9a7
8e8f9a7
Group:    System Environment/Daemons
8e8f9a7
License:  GPLv2
8e8f9a7
URL:      http://www.kernel.org
8e8f9a7
519c426
# Source files obtained from kernel upstream 4.2-rc0 (4da3064d1775810f10f7ddc1c34c3f1ff502a654)
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"
6abf3a1
# COPYING -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/COPYING?id=b1940cd21c0f4abdce101253e860feff547291b
8e8f9a7
Source0:  COPYING
8e8f9a7
8e8f9a7
# HYPERV KVP DAEMON
519c426
# hv_kvp_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_kvp_daemon.c?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
8e8f9a7
Source1:  hv_kvp_daemon.c
519c426
# hv_get_dhcp_info.sh -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_get_dhcp_info.sh?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
8e8f9a7
Source2:  hv_get_dhcp_info.sh
519c426
# hv_get_dns_info.sh -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_get_dns_info.sh?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
8e8f9a7
Source3:  hv_get_dns_info.sh
519c426
# hv_set_ifconfig.sh -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_set_ifconfig.sh?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
8e8f9a7
Source4:  hv_set_ifconfig.sh
8e8f9a7
Source5:  hypervkvpd.service
20c667d
Source6:  hypervkvp.rules
8e8f9a7
8e8f9a7
# HYPERV VSS DAEMON
519c426
# hv_vss_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_vss_daemon.c?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
8e8f9a7
Source100:  hv_vss_daemon.c
8e8f9a7
Source101:  hypervvssd.service
20c667d
Source102:  hypervvss.rules
8e8f9a7
29897df
# HYPERV FCOPY DAEMON
519c426
# hv_fcopy_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/tools/hv/hv_fcopy_daemon.c?id=4da3064d1775810f10f7ddc1c34c3f1ff502a654
29897df
Source200:  hv_fcopy_daemon.c
29897df
Source201:  hypervfcopyd.service
20c667d
Source202:  hypervfcopy.rules
29897df
29897df
8e8f9a7
# HYPERV KVP DAEMON
8e8f9a7
# Correct paths to external scripts ("/usr/libexec/hypervkvpd").
8e8f9a7
Patch0:   hypervkvpd-0-corrected_paths_to_external_scripts.patch
8e8f9a7
# rhbz#872566
a18ceab
Patch1:   hypervkvpd-0-long_file_names_from_readdir.patch
29897df
29897df
8e8f9a7
# HyperV 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
8e8f9a7
is running on Windows Host with HyperV.
8e8f9a7
8e8f9a7
8e8f9a7
%package -n hypervkvpd
8e8f9a7
Summary: HyperV 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
8e8f9a7
Hypervkvpd is an implementation of HyperV key value pair (KVP) 
8e8f9a7
functionality for Linux. The daemon first registers with the
8e8f9a7
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
8e8f9a7
Summary: HyperV 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
8e8f9a7
Hypervvssd is an implementation of HyperV VSS functionality
8e8f9a7
for Linux. The daemon is used for host initiated guest snapshot
8e8f9a7
on HyperV hypervisor. The daemon first registers with the
8e8f9a7
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
29897df
Summary: HyperV 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
29897df
for Linux Guest running on HyperV. The daemon enables host to copy
29897df
a file (over VMBUS) into the Linux Guest. The daemon first registers
29897df
with the kernel driver. After this is done it waits for instructions 
29897df
from Windows Host.
29897df
29897df
8e8f9a7
%package license
8e8f9a7
Summary:    License of the HyperV daemons suite
8e8f9a7
Group:      Applications/System
8e8f9a7
BuildArch:  noarch
8e8f9a7
8e8f9a7
%description license
8e8f9a7
Contains license of the HyperV daemons suite.
8e8f9a7
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
%patch0 -p1 -b .external_scripts
a18ceab
%patch1 -p1 -b .long_names
8e8f9a7
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
20c667d
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}
20c667d
# Udev rules
20c667d
mkdir -p %{buildroot}%{_udevrulesdir}
20c667d
install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
20c667d
install -p -m 0644 %{SOURCE102} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
20c667d
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}
20c667d
install -p -m 0755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
20c667d
install -p -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
20c667d
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
8e8f9a7
8e8f9a7
%post -n hypervkvpd
8e8f9a7
%systemd_post hypervkvpd.service
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
8e8f9a7
%systemd_post hypervvssd.service
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
29897df
%systemd_post hypervfcopyd.service
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
20c667d
%{_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
20c667d
%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
8e8f9a7
29897df
%files -n hypervfcopyd
29897df
%{_sbindir}/%{hv_fcopy_daemon}
29897df
%{_unitdir}/hypervfcopyd.service
20c667d
%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
29897df
8e8f9a7
%files license
8e8f9a7
%doc COPYING
8e8f9a7
8e8f9a7
%changelog
20c667d
* Wed Nov 18 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.13.20150702git
20c667d
- Add udev rules to properly restart services (#1195029)
20c667d
- Spec cleanup
20c667d
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