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
7b0ce3
# snapshot version
7b0ce3
%global snapver .20130826git
7b0ce3
# use hardened build
7b0ce3
%global _hardened_build 1
7b0ce3
7b0ce3
Name:     hyperv-daemons
7b0ce3
Version:  0
7b0ce3
Release:  0.21%{?snapver}%{?dist}
7b0ce3
Summary:  HyperV daemons suite
7b0ce3
7b0ce3
Group:    System Environment/Daemons
7b0ce3
License:  GPLv2
7b0ce3
URL:      http://www.kernel.org
7b0ce3
7b0ce3
# Source files obtained from kernel upstream 2013-08-26.
7b0ce3
# git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
7b0ce3
# The daemon and scripts are located in "master branch - /tools/hv"
7b0ce3
# COPYING -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/COPYING?id=refs/tags/next-20130822 
7b0ce3
Source0:  COPYING
7b0ce3
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
# hv_kvp_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_kvp_daemon.c?id=refs/tags/next-20130822
7b0ce3
Source1:  hv_kvp_daemon.c
7b0ce3
# hv_get_dhcp_info.sh -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_get_dhcp_info.sh?id=refs/tags/next-20130822
7b0ce3
Source2:  hv_get_dhcp_info.sh
7b0ce3
# hv_get_dns_info.sh -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_get_dns_info.sh?id=refs/tags/next-20130822
7b0ce3
Source3:  hv_get_dns_info.sh
7b0ce3
# hv_set_ifconfig.sh -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_set_ifconfig.sh?id=refs/tags/next-20130822
7b0ce3
Source4:  hv_set_ifconfig.sh
7b0ce3
Source5:  hypervkvpd.service
7b0ce3
7b0ce3
# HYPERV VSS DAEMON
7b0ce3
# hv_vss_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_vss_daemon.c?id=refs/tags/next-20130822
7b0ce3
Source100:  hv_vss_daemon.c
7b0ce3
Source101:  hypervvssd.service
7b0ce3
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
# Correct paths to external scripts ("/usr/libexec/hypervkvpd").
7b0ce3
Patch0:   hypervkvpd-0-corrected_paths_to_external_scripts.patch
7b0ce3
# use quoted include for linux/hyperv.h because we use gcc option
7b0ce3
# -iquote for include PATH where it is located. This is because
7b0ce3
# some headers in system include PATH are also in kernel-devel
7b0ce3
# package.
7b0ce3
Patch1:   hypervkvpd-0-include_fix.patch
7b0ce3
# rhbz#872566
7b0ce3
Patch2:   hypervkvpd-0-long_file_names_from_readdir.patch
7b0ce3
# Remove daemon() call and let systemd handle it
7b0ce3
Patch3:   hypervkvpd-0-dont_call_deamon.patch
7b0ce3
7b0ce3
# HYPERV VSS DAEMON
7b0ce3
# use quoted include for linux/hyperv.h because we use gcc option
7b0ce3
# -iquote for include PATH where it is located. This is because
7b0ce3
# some headers in system include PATH are also in kernel-devel
7b0ce3
# package.
7b0ce3
Patch100:   hypervvssd-0-fix_includes.patch
7b0ce3
# Remove daemon() call and let systemd handle it
7b0ce3
Patch101:   hypervvssd-0-dont_call_daemon.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}
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}
7b0ce3
BuildRequires: systemd, kernel-devel
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}
7b0ce3
BuildRequires: systemd, kernel-devel
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
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
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
7b0ce3
%patch0 -p1 -b .external_scripts
7b0ce3
%patch1 -p1 -b .include
7b0ce3
%patch2 -p1 -b .long_names
7b0ce3
%patch3 -p1 -b .daemon
7b0ce3
7b0ce3
%patch100 -p1 -b .include
7b0ce3
%patch101 -p1 -b .daemon
7b0ce3
7b0ce3
7b0ce3
%build
7b0ce3
# kernel-devel version
7b0ce3
%{!?kversion: %global kversion `ls %{_usrsrc}/kernels | sort -dr | head -n 1`}
7b0ce3
7b0ce3
# HYPERV KVP DAEMON
7b0ce3
gcc \
7b0ce3
    $RPM_OPT_FLAGS \
7b0ce3
    -iquote %{_usrsrc}/kernels/%{kversion}/include \
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
    -iquote %{_usrsrc}/kernels/%{kversion}/include \
7b0ce3
    -c hv_vss_daemon.c
7b0ce3
    
7b0ce3
gcc \
7b0ce3
    $RPM_LD_FLAGS \
7b0ce3
    hv_vss_daemon.o \
7b0ce3
    -o %{hv_vss_daemon}
7b0ce3
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}
7b0ce3
mkdir -p %{buildroot}%{_unitdir}
7b0ce3
# Systemd unit file
7b0ce3
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
7b0ce3
install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
7b0ce3
# Shell scripts for the KVP daemon
7b0ce3
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
7b0ce3
install -p -m 0755 hv_get_dhcp_info.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
7b0ce3
install -p -m 0755 hv_get_dns_info.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
7b0ce3
install -p -m 0755 hv_set_ifconfig.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
7b0ce3
# Directory for pool files
7b0ce3
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
7b0ce3
7b0ce3
7b0ce3
%post -n hypervkvpd
7b0ce3
%systemd_post hypervkvpd.service
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
7b0ce3
%systemd_post hypervvssd.service
7b0ce3
7b0ce3
%postun -n hypervvssd
7b0ce3
%systemd_postun hypervvssd.service
7b0ce3
7b0ce3
%preun -n hypervvssd
7b0ce3
%systemd_preun hypervvssd.service
7b0ce3
7b0ce3
7b0ce3
%files -n hypervkvpd
7b0ce3
%{_sbindir}/%{hv_kvp_daemon}
7b0ce3
%{_unitdir}/hypervkvpd.service
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
7b0ce3
7b0ce3
%files license
7b0ce3
%doc COPYING
7b0ce3
7b0ce3
%changelog
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