From 29897df2af9f90d21b2cbc97d81edc64c9684adc Mon Sep 17 00:00:00 2001 From: Tomas Hozza Date: Jun 11 2014 08:29:09 +0000 Subject: Package new Hyper-V fcopy daemon as hypervfcopyd sub-package Signed-off-by: Tomas Hozza --- diff --git a/.gitignore b/.gitignore index 864fce1..a2062cb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /hv_set_ifconfig.sh /hv_vss_daemon.c /COPYING +/hv_fcopy_daemon.c diff --git a/hyperv-daemons.spec b/hyperv-daemons.spec index d308cb0..d15fafe 100644 --- a/hyperv-daemons.spec +++ b/hyperv-daemons.spec @@ -2,8 +2,10 @@ %global hv_kvp_daemon hypervkvpd # HyperV VSS daemon binary name %global hv_vss_daemon hypervvssd +# HyperV FCOPY daemon binary name +%global hv_fcopy_daemon hypervfcopyd # snapshot version -%global snapver .20140219git +%global snapver .20140611git # use hardened build %global _hardened_build 1 @@ -16,7 +18,7 @@ Group: System Environment/Daemons License: GPLv2 URL: http://www.kernel.org -# Source files obtained from kernel upstream 2014-02-19. +# Source files obtained from kernel upstream 2014-06-11. # git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git # The daemon and scripts are located in "master branch - /tools/hv" # COPYING -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/COPYING?id=refs/tags/next-20130822 @@ -38,6 +40,12 @@ Source5: hypervkvpd.service Source100: hv_vss_daemon.c Source101: hypervvssd.service +# HYPERV FCOPY DAEMON +# hv_fcopy_daemon.c -> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/plain/tools/hv/hv_fcopy_daemon.c?id=refs/tags/next-20140611 +Source200: hv_fcopy_daemon.c +Source201: hypervfcopyd.service + + # HYPERV KVP DAEMON # Correct paths to external scripts ("/usr/libexec/hypervkvpd"). Patch0: hypervkvpd-0-corrected_paths_to_external_scripts.patch @@ -50,6 +58,11 @@ Patch2: hypervkvpd-0-dont_call_deamon.patch # Remove daemon() call and let systemd handle it Patch100: hypervvssd-0-dont_call_daemon.patch +# HYPERV FCOPY DAEMON +# Remove daemon() call and let systemd handle it +Patch200: hypervfcopyd-0-dont_call_daemon.patch + + # HyperV is available only on x86 architectures # The base empty (a.k.a. virtual) package can not be noarch # due to http://www.rpm.org/ticket/78 @@ -57,6 +70,7 @@ ExclusiveArch: i686 x86_64 Requires: hypervkvpd = %{version}-%{release} Requires: hypervvssd = %{version}-%{release} +Requires: hypervfcopyd = %{version}-%{release} %description Suite of daemons that are needed when Linux guest @@ -98,6 +112,23 @@ from Windows Host if to "freeze" or "thaw" the filesystem on the Linux Guest. +%package -n hypervfcopyd +Summary: HyperV FCOPY daemon +Group: System Environment/Daemons +Requires: %{name}-license = %{version}-%{release} +BuildRequires: systemd, kernel-headers +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description -n hypervfcopyd +Hypervfcopyd is an implementation of file copy service functionality +for Linux Guest running on HyperV. The daemon enables host to copy +a file (over VMBUS) into the Linux Guest. The daemon first registers +with the kernel driver. After this is done it waits for instructions +from Windows Host. + + %package license Summary: License of the HyperV daemons suite Group: Applications/System @@ -120,12 +151,16 @@ cp -pvL %{SOURCE5} hypervkvpd.service cp -pvL %{SOURCE100} hv_vss_daemon.c cp -pvL %{SOURCE101} hypervvssd.service +cp -pvL %{SOURCE200} hv_fcopy_daemon.c +cp -pvL %{SOURCE201} hypervfcopyd.service + %patch0 -p1 -b .external_scripts %patch1 -p1 -b .long_names %patch2 -p1 -b .daemon %patch100 -p1 -b .daemon +%patch200 -p1 -b .daemon_fcopy %build # HYPERV KVP DAEMON @@ -148,6 +183,16 @@ gcc \ hv_vss_daemon.o \ -o %{hv_vss_daemon} +# HYPERV FCOPY DAEMON +gcc \ + $RPM_OPT_FLAGS \ + -c hv_fcopy_daemon.c + +gcc \ + $RPM_LD_FLAGS \ + hv_fcopy_daemon.o \ + -o %{hv_fcopy_daemon} + %install rm -rf %{buildroot} @@ -155,10 +200,12 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{_sbindir} install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir} install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir} +install -p -m 0755 %{hv_fcopy_daemon} %{buildroot}%{_sbindir} mkdir -p %{buildroot}%{_unitdir} # Systemd unit file install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir} install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir} +install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir} # Shell scripts for the KVP daemon mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon} install -p -m 0755 hv_get_dhcp_info.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info @@ -192,6 +239,17 @@ fi %preun -n hypervvssd %systemd_preun hypervvssd.service + +%post -n hypervfcopyd +%systemd_post hypervfcopyd.service + +%postun -n hypervfcopyd +%systemd_postun hypervfcopyd.service + +%preun -n hypervfcopyd +%systemd_preun hypervfcopyd.service + + %files # the base package does not contain any files. @@ -206,13 +264,18 @@ fi %{_sbindir}/%{hv_vss_daemon} %{_unitdir}/hypervvssd.service +%files -n hypervfcopyd +%{_sbindir}/%{hv_fcopy_daemon} +%{_unitdir}/hypervfcopyd.service + %files license %doc COPYING %changelog -* Wed Jun 11 2014 Tomas Hozza - 0-0.7.20140219git +* Wed Jun 11 2014 Tomas Hozza - 0-0.7.20140611git - Fix FTBFS (#1106781) - Use kernel-headers instead of kernel-devel for building +- package new Hyper-V fcopy daemon as hypervfcopyd sub-package * Sat Jun 07 2014 Fedora Release Engineering - 0-0.6.20140219git - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild diff --git a/hypervfcopyd-0-dont_call_daemon.patch b/hypervfcopyd-0-dont_call_daemon.patch new file mode 100644 index 0000000..190b42d --- /dev/null +++ b/hypervfcopyd-0-dont_call_daemon.patch @@ -0,0 +1,15 @@ +diff -up ./hv_fcopy_daemon.c.daemon_fcopy ./hv_fcopy_daemon.c +--- ./hv_fcopy_daemon.c.daemon_fcopy 2014-02-19 09:55:20.689982023 +0100 ++++ ./hv_fcopy_daemon.c 2014-02-19 09:55:36.700982923 +0100 +@@ -131,11 +131,6 @@ int main(void) + char *buffer[4096 * 2]; + struct hv_fcopy_hdr *in_msg; + +- if (daemon(1, 0)) { +- syslog(LOG_ERR, "daemon() failed; error: %s", strerror(errno)); +- exit(EXIT_FAILURE); +- } +- + openlog("HV_FCOPY", 0, LOG_USER); + syslog(LOG_INFO, "HV_FCOPY starting; pid is:%d", getpid()); + diff --git a/hypervfcopyd.service b/hypervfcopyd.service new file mode 100644 index 0000000..5e965b5 --- /dev/null +++ b/hypervfcopyd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Hyper-V FCOPY daemon +ConditionVirtualization=microsoft + +[Service] +ExecStart=/usr/sbin/hypervfcopyd + +[Install] +WantedBy=multi-user.target diff --git a/sources b/sources index 60b7abe..177ec15 100644 --- a/sources +++ b/sources @@ -3,4 +3,5 @@ dbb5cc7ec83ccc7b1c39458a7521c9b4 hv_get_dns_info.sh 28b370a30d044ebe78fdbcd6d6051f5d hv_kvp_daemon.c da7f77aa7507e950851cbb53673ce5d4 hv_set_ifconfig.sh 18e75bce02aea146307877ebc4e5b45f hv_vss_daemon.c +7002bbf1a367085be17243d908e7394a hv_fcopy_daemon.c d7810fab7487fb0aad327b76f1be7cd7 COPYING