Blame SPECS/hyperv-daemons.spec

7b0ce3
# HyperV KVP daemon binary name
7b0ce3
%global hv_kvp_daemon hypervkvpd
7b0ce3
# HyperV VSS daemon binary name
7b0ce3
%global hv_vss_daemon hypervvssd
41f5a8
# HyperV FCOPY daemon binary name
41f5a8
%global hv_fcopy_daemon hypervfcopyd
7b0ce3
# snapshot version
f22315
%global snapver .20161211git
7b0ce3
# use hardened build
7b0ce3
%global _hardened_build 1
1c9ae8
# udev rules prefix
1c9ae8
%global udev_prefix 70
7b0ce3
7b0ce3
Name:     hyperv-daemons
7b0ce3
Version:  0
712bc0
Release:  0.32%{?snapver}%{?dist}
7b0ce3
Summary:  HyperV daemons suite
7b0ce3
7b0ce3
Group:    System Environment/Daemons
7b0ce3
License:  GPLv2
7b0ce3
URL:      http://www.kernel.org
7b0ce3
f22315
# Source files obtained from kernel upstream v4.9.
f22315
# git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
7b0ce3
# The daemon and scripts are located in "master branch - /tools/hv"
7b0ce3
Source0:  COPYING
7b0ce3
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
Source1:  hv_kvp_daemon.c
7b0ce3
Source2:  hv_get_dhcp_info.sh
7b0ce3
Source3:  hv_get_dns_info.sh
7b0ce3
Source4:  hv_set_ifconfig.sh
7b0ce3
Source5:  hypervkvpd.service
1c9ae8
Source6:  hypervkvp.rules
7b0ce3
7b0ce3
# HYPERV VSS DAEMON
7b0ce3
Source100:  hv_vss_daemon.c
7b0ce3
Source101:  hypervvssd.service
1c9ae8
Source102:  hypervvss.rules
7b0ce3
41f5a8
# HYPERV FCOPY DAEMON
41f5a8
Source200:  hv_fcopy_daemon.c
41f5a8
Source201:  hypervfcopyd.service
1c9ae8
Source202:  hypervfcopy.rules
41f5a8
f22315
# HYPERV TOOLS
f22315
Source301:  lsvmbus
f22315
Source302:  bondvf.sh
f22315
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
# Correct paths to external scripts ("/usr/libexec/hypervkvpd").
7b0ce3
Patch0:   hypervkvpd-0-corrected_paths_to_external_scripts.patch
7b0ce3
# rhbz#872566
41f5a8
Patch1:   hypervkvpd-0-long_file_names_from_readdir.patch
712bc0
# rhbz#1529745
712bc0
Patch2:  0001-hv-kvp-Avoid-reading-past-allocated-blocks-from-KVP-.patch
7b0ce3
7b0ce3
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
7b0ce3
# HyperV is available only on x86 architectures
7b0ce3
ExclusiveArch:  x86_64
7b0ce3
Requires:       hypervkvpd = %{version}-%{release}
7b0ce3
Requires:       hypervvssd = %{version}-%{release}
41f5a8
Requires:       hypervfcopyd = %{version}-%{release}
7b0ce3
7b0ce3
%description
7b0ce3
Suite of daemons that are needed when Linux guest
7b0ce3
is running on Windows Host with HyperV.
7b0ce3
7b0ce3
7b0ce3
%package -n hypervkvpd
7b0ce3
Summary: HyperV key value pair (KVP) daemon
7b0ce3
Group:   System Environment/Daemons
7b0ce3
Requires: %{name}-license = %{version}-%{release}
1c9ae8
Requires: kernel >= 3.10.0-384.el7
41f5a8
BuildRequires: systemd, kernel-headers
7b0ce3
Requires(post):   systemd
7b0ce3
Requires(preun):  systemd
7b0ce3
Requires(postun): systemd
7b0ce3
7b0ce3
%description -n hypervkvpd
7b0ce3
Hypervkvpd is an implementation of HyperV key value pair (KVP) 
7b0ce3
functionality for Linux. The daemon first registers with the
7b0ce3
kernel driver. After this is done it collects information 
7b0ce3
requested by Windows Host about the Linux Guest. It also supports
7b0ce3
IP injection functionality on the Guest.
7b0ce3
7b0ce3
7b0ce3
%package -n hypervvssd
7b0ce3
Summary: HyperV VSS daemon
7b0ce3
Group:   System Environment/Daemons
7b0ce3
Requires: %{name}-license = %{version}-%{release}
1c9ae8
Requires: kernel >= 3.10.0-384.el7
41f5a8
BuildRequires: systemd, kernel-headers
7b0ce3
Requires(post):   systemd
7b0ce3
Requires(preun):  systemd
7b0ce3
Requires(postun): systemd
7b0ce3
7b0ce3
%description -n hypervvssd
7b0ce3
Hypervvssd is an implementation of HyperV VSS functionality
7b0ce3
for Linux. The daemon is used for host initiated guest snapshot
7b0ce3
on HyperV hypervisor. The daemon first registers with the
7b0ce3
kernel driver. After this is done it waits for instructions 
7b0ce3
from Windows Host if to "freeze" or "thaw" the filesystem
7b0ce3
on the Linux Guest.
7b0ce3
7b0ce3
41f5a8
%package -n hypervfcopyd
41f5a8
Summary: HyperV FCOPY daemon
41f5a8
Group:   System Environment/Daemons
41f5a8
Requires: %{name}-license = %{version}-%{release}
1c9ae8
Requires: kernel >= 3.10.0-384.el7
41f5a8
BuildRequires: systemd, kernel-headers
41f5a8
Requires(post):   systemd
41f5a8
Requires(preun):  systemd
41f5a8
Requires(postun): systemd
41f5a8
41f5a8
%description -n hypervfcopyd
41f5a8
Hypervfcopyd is an implementation of file copy service functionality
41f5a8
for Linux Guest running on HyperV. The daemon enables host to copy
41f5a8
a file (over VMBUS) into the Linux Guest. The daemon first registers
41f5a8
with the kernel driver. After this is done it waits for instructions 
41f5a8
from Windows Host.
41f5a8
41f5a8
7b0ce3
%package license
7b0ce3
Summary:    License of the HyperV daemons suite
7b0ce3
Group:      Applications/System
7b0ce3
BuildArch:  noarch
7b0ce3
7b0ce3
%description license
7b0ce3
Contains license of the HyperV daemons suite.
7b0ce3
f22315
%package -n hyperv-tools
f22315
Summary:    Tools for Hyper-V guests
f22315
Group:      Applications/System
f22315
BuildArch:  noarch
f22315
f22315
%description -n hyperv-tools
f22315
Contains tools and scripts useful for Hyper-V guests.
7b0ce3
7b0ce3
%prep
7b0ce3
%setup -Tc
7b0ce3
cp -pvL %{SOURCE0} COPYING
7b0ce3
7b0ce3
cp -pvL %{SOURCE1} hv_kvp_daemon.c
7b0ce3
cp -pvL %{SOURCE2} hv_get_dhcp_info.sh
7b0ce3
cp -pvL %{SOURCE3} hv_get_dns_info.sh
7b0ce3
cp -pvL %{SOURCE4} hv_set_ifconfig.sh
7b0ce3
cp -pvL %{SOURCE5} hypervkvpd.service
7b0ce3
7b0ce3
cp -pvL %{SOURCE100} hv_vss_daemon.c
7b0ce3
cp -pvL %{SOURCE101} hypervvssd.service
7b0ce3
41f5a8
cp -pvL %{SOURCE200} hv_fcopy_daemon.c
41f5a8
cp -pvL %{SOURCE201} hypervfcopyd.service
41f5a8
7b0ce3
%patch0 -p1 -b .external_scripts
41f5a8
%patch1 -p1 -b .long_names
712bc0
%patch2 -p3 -b .kvp_past_allocated
7b0ce3
7b0ce3
%build
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
gcc \
7b0ce3
    $RPM_OPT_FLAGS \
7b0ce3
    -c hv_kvp_daemon.c
7b0ce3
    
7b0ce3
gcc \
7b0ce3
    $RPM_LD_FLAGS \
7b0ce3
    hv_kvp_daemon.o \
7b0ce3
    -o %{hv_kvp_daemon}
7b0ce3
7b0ce3
# HYPERV VSS DAEMON
7b0ce3
gcc \
7b0ce3
    $RPM_OPT_FLAGS \
7b0ce3
    -c hv_vss_daemon.c
7b0ce3
    
7b0ce3
gcc \
7b0ce3
    $RPM_LD_FLAGS \
7b0ce3
    hv_vss_daemon.o \
7b0ce3
    -o %{hv_vss_daemon}
7b0ce3
41f5a8
# HYPERV FCOPY DAEMON
41f5a8
gcc \
41f5a8
    $RPM_OPT_FLAGS \
41f5a8
    -c hv_fcopy_daemon.c
41f5a8
    
41f5a8
gcc \
41f5a8
    $RPM_LD_FLAGS \
41f5a8
    hv_fcopy_daemon.o \
41f5a8
    -o %{hv_fcopy_daemon}
41f5a8
7b0ce3
7b0ce3
%install
7b0ce3
rm -rf %{buildroot}
7b0ce3
7b0ce3
mkdir -p %{buildroot}%{_sbindir}
7b0ce3
install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir}
7b0ce3
install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir}
41f5a8
install -p -m 0755 %{hv_fcopy_daemon} %{buildroot}%{_sbindir}
7b0ce3
# Systemd unit file
1c9ae8
mkdir -p %{buildroot}%{_unitdir}
7b0ce3
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
7b0ce3
install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
41f5a8
install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir}
1c9ae8
# Udev rules
1c9ae8
mkdir -p %{buildroot}%{_udevrulesdir}
1c9ae8
install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
1c9ae8
install -p -m 0644 %{SOURCE102} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
1c9ae8
install -p -m 0644 %{SOURCE202} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
7b0ce3
# Shell scripts for the KVP daemon
7b0ce3
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
1c9ae8
install -p -m 0755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
1c9ae8
install -p -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
1c9ae8
install -p -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
7b0ce3
# Directory for pool files
7b0ce3
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
7b0ce3
f22315
# Tools
f22315
install -p -m 0755 %{SOURCE301} %{buildroot}%{_sbindir}/
f22315
f22315
mkdir -p %{buildroot}%{_datarootdir}/hyperv-tools/
f22315
install -p -m 0755 %{SOURCE302} %{buildroot}%{_datarootdir}/hyperv-tools/
7b0ce3
7b0ce3
%post -n hypervkvpd
f22315
if [ $1 -gt 1 ] ; then
1c9ae8
	# Upgrade
1c9ae8
	systemctl --no-reload disable hypervkvpd.service >/dev/null 2>&1 || :
1c9ae8
fi
7b0ce3
7b0ce3
%preun -n hypervkvpd
7b0ce3
%systemd_preun hypervkvpd.service
7b0ce3
7b0ce3
%postun -n hypervkvpd
7b0ce3
# hypervkvpd daemon does NOT support restarting (driver, neither)
7b0ce3
%systemd_postun hypervkvpd.service
7b0ce3
# If removing the package, delete %%{_sharedstatedir}/hyperv directory
7b0ce3
if [ "$1" -eq "0" ] ; then
7b0ce3
    rm -rf %{_sharedstatedir}/hyperv || :
7b0ce3
fi
7b0ce3
7b0ce3
7b0ce3
%post -n hypervvssd
f22315
if [ $1 -gt 1 ] ; then
1c9ae8
	# Upgrade
1c9ae8
	systemctl --no-reload disable hypervvssd.service >/dev/null 2>&1 || :
1c9ae8
fi
7b0ce3
7b0ce3
%postun -n hypervvssd
7b0ce3
%systemd_postun hypervvssd.service
7b0ce3
7b0ce3
%preun -n hypervvssd
7b0ce3
%systemd_preun hypervvssd.service
7b0ce3
41f5a8
41f5a8
%post -n hypervfcopyd
f22315
if [ $1 -gt 1 ] ; then
1c9ae8
	# Upgrade
1c9ae8
	systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
1c9ae8
fi
41f5a8
41f5a8
%postun -n hypervfcopyd
41f5a8
%systemd_postun hypervfcopyd.service
41f5a8
41f5a8
%preun -n hypervfcopyd
41f5a8
%systemd_preun hypervfcopyd.service
41f5a8
41f5a8
5f68da
%files
5f68da
# the base package does not contain any files.
7b0ce3
7b0ce3
%files -n hypervkvpd
7b0ce3
%{_sbindir}/%{hv_kvp_daemon}
7b0ce3
%{_unitdir}/hypervkvpd.service
1c9ae8
%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
7b0ce3
%dir %{_libexecdir}/%{hv_kvp_daemon}
7b0ce3
%{_libexecdir}/%{hv_kvp_daemon}/*
7b0ce3
%dir %{_sharedstatedir}/hyperv
7b0ce3
7b0ce3
%files -n hypervvssd
7b0ce3
%{_sbindir}/%{hv_vss_daemon}
7b0ce3
%{_unitdir}/hypervvssd.service
1c9ae8
%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
7b0ce3
41f5a8
%files -n hypervfcopyd
41f5a8
%{_sbindir}/%{hv_fcopy_daemon}
41f5a8
%{_unitdir}/hypervfcopyd.service
1c9ae8
%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
41f5a8
7b0ce3
%files license
7b0ce3
%doc COPYING
7b0ce3
f22315
%files -n hyperv-tools
f22315
%{_sbindir}/lsvmbus
f22315
%{_datarootdir}/hyperv-tools
f22315
7b0ce3
%changelog
712bc0
* Wed Jan 03 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.32.20161211git
712bc0
- Include 'Avoid reading past allocated blocks from KVP file' fix (#1529745)
712bc0
712bc0
* Mon Dec 11 2017 Eduardo Otubo <otubo@redhat.com> - 0-0.31.20161211git
712bc0
- Start KVP daemon after network is setup (#1377550)
712bc0
f22315
* Thu Jan 19 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.30.20161211git
f22315
- Use '-gt' instead of '>' to do the right comparison (#1414822)
f22315
- hyperv-tools subpackage added (#1378710)
f22315
- Update to upstream v4.9 (#1406397)
f22315
1c9ae8
* Tue Aug 16 2016 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.29.20150216git
1c9ae8
- Switch units to udev-only activation (#1367240)
1c9ae8
1c9ae8
* Wed Jun 22 2016 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.28.20150216git
1c9ae8
- Close /dev/vmbus/hv_kvp fd on popen (#1347659)
1c9ae8
1c9ae8
* Fri May 15 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.27.20150216git
1c9ae8
- 2016-02-16 git snapshot
1c9ae8
- Add udev rules to support host-side activation (#1304005)
1c9ae8
68a822
* Fri May 15 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.26.20150402git
68a822
- 2015-04-02 git snapshot
68a822
- VSS: skip all readonly-mounted filesystems (#1160584)
68a822
- VSS: support partitions mounted several times (#1169724)
68a822
41f5a8
* Thu Oct 9 2014 Matej Muzila <mmuzila@redhat.com> - 0-0.25.20141008git
41f5a8
- Daemons updated to the last git snapshot
41f5a8
- Use kernel-headers instead of kernel-devel to build
41f5a8
- Added Hyper-V fcopy daemon as hypervfcopyd subpackage
41f5a8
5f68da
* Mon Feb 17 2014 Tomas Hozza <thozza@redhat.com> - 0-0.24.20130826git
5f68da
- VSS: Ignore VFAT mounts on freeze/thaw (#1064094)
5f68da
5f68da
* Fri Jan 10 2014 Tomas Hozza <thozza@redhat.com> - 0-0.23.20130826git
5f68da
- Provide 'hyperv-daemons' package for convenient installation of all daemons (#1051450)
5f68da
5f68da
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0-0.22.20130826git
5f68da
- Mass rebuild 2013-12-27
5f68da
7b0ce3
* Thu Sep 26 2013 Tomas Hozza <thozza@redhat.com> - 0-0.21.20130826git
7b0ce3
- Use 'hypervkvpd' directory in libexec for KVP daemon scripts (#1010280)
7b0ce3
- daemons are now WantedBy multi-user.target instead of basic.target (#1010284)
7b0ce3
7b0ce3
* Mon Sep 23 2013 Tomas Hozza <thozza@redhat.com> - 0-0.20.20130826git
7b0ce3
- Build daemons only for x86_64 architecture (#1010220)
7b0ce3
- Bump release to 20 to prevent RHEL6 -> RHEL7 update path issues
7b0ce3
7b0ce3
* Mon Aug 26 2013 Tomas Hozza <thozza@redhat.com> - 0-0.1.20130826git
7b0ce3
- Initial package