33%global hv_vss_daemon hypervvssd
44%global hv_fcopy_daemon hypervfcopyd
55
6+ %global snapver .20180415git
7+ %global udev_prefix 70
68# nodebuginfo
79# norootforbuild
810
@@ -16,30 +18,78 @@ License: GPLv2+
1618Summary: Microsoft hyper-v daemons
1719Version: 1
1820Release: 0.29%{?snapver }%{?dist }
19- Source0: hv_kvp_daemon.c
20- Source1: hypervkvpd.service
21- Source2: hypervkvp.rules
22- Source3: hv_get_dhcp_info.sh
23- Source4: hv_get_dns_info.sh
24- Source5: hv_set_ifconfig.sh
25- Source6: hv_vss_daemon.c
26- Source7: hypervvss.rules
27- Source8: hypervvssd.service
28- Source9: hv_fcopy_daemon.c
29- Source10: hypervfcopy.rules
21+ Source0: hv_kvp_daemon.c
22+ Source1: hypervkvpd.service
23+ Source2: hypervkvp.rules
24+ Source3: hv_get_dhcp_info.sh
25+ Source4: hv_get_dns_info.sh
26+ Source5: hv_set_ifconfig.sh
27+ Source6: hv_vss_daemon.c
28+ Source7: hypervvss.rules
29+ Source8: hypervvssd.service
30+ Source9: hv_fcopy_daemon.c
31+ Source10: hypervfcopy.rules
3032Source11: hypervfcopyd.service
31- Source12: Makefile
33+ Source12: Makefile
3234Source13: Build
3335BuildRoot: %{_tmppath }/%{name }-%{version }-build
3436Requires: kernel >= 3.10.0-123
35- BuildRequires: systemd, kernel-headers
36- Requires(post): systemd
37- Requires(preun): systemd
38- Requires(postun): systemd
39-
37+ Requires: hypervkvpd = %{version }-%{release }
38+ Requires: hypervvssd = %{version }-%{release }
39+ Requires: hypervfcopyd = %{version }-%{release }
40+ BuildRequires: systemd, kernel-headers
4041
4142%description
42- Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
43+ Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
44+
45+ %package -n hypervkvpd
46+ Summary: HyperV key value pair (KVP) daemon
47+ Group: System Environment/Daemons
48+ Requires: kernel >= 3.10.0-123
49+ BuildRequires: systemd, kernel-headers
50+ Requires(post): systemd
51+ Requires(preun): systemd
52+ Requires(postun): systemd
53+
54+ %description -n hypervkvpd
55+ Hypervkvpd is an implementation of HyperV key value pair (KVP)
56+ functionality for Linux. The daemon first registers with the
57+ kernel driver. After this is done it collects information
58+ requested by Windows Host about the Linux Guest. It also supports
59+ IP injection functionality on the Guest.
60+
61+ %package -n hypervvssd
62+ Summary: HyperV VSS daemon
63+ Group: System Environment/Daemons
64+ Requires: kernel >= 3.10.0-123
65+ BuildRequires: systemd, kernel-headers
66+ Requires(post): systemd
67+ Requires(preun): systemd
68+ Requires(postun): systemd
69+
70+ %description -n hypervvssd
71+ Hypervvssd is an implementation of HyperV VSS functionality
72+ for Linux. The daemon is used for host initiated guest snapshot
73+ on HyperV hypervisor. The daemon first registers with the
74+ kernel driver. After this is done it waits for instructions
75+ from Windows Host if to "freeze" or "thaw" the filesystem
76+ on the Linux Guest.
77+
78+ %package -n hypervfcopyd
79+ Summary: HyperV FCOPY daemon
80+ Group: System Environment/Daemons
81+ Requires: kernel >= 3.10.0-123
82+ BuildRequires: systemd, kernel-headers
83+ Requires(post): systemd
84+ Requires(preun): systemd
85+ Requires(postun): systemd
86+
87+ %description -n hypervfcopyd
88+ Hypervfcopyd is an implementation of file copy service functionality
89+ for Linux Guest running on HyperV. The daemon enables host to copy
90+ a file (over VMBUS) into the Linux Guest. The daemon first registers
91+ with the kernel driver. After this is done it waits for instructions
92+ from Windows Host.
4393
4494%prep
4595%setup -Tc
@@ -57,14 +107,15 @@ cp -pvL %{SOURCE10} %{hv_fcopy_daemon}.service
57107
58108cp -pvL %{SOURCE12 } Makefile
59109if [ ! -e "%{SOURCE13 }" ]; then
60- touch %{SOURCE13 }
110+ touch %{SOURCE13 }
61111fi
62112cp -pvL %{SOURCE13 } Build
63113%build
64114make clean
65115make
66116
67117%install
118+ rm -rf %{buildroot }
68119
69120mkdir -p %{buildroot }%{_sbindir }
70121install -p -m 0755 hv_kvp_daemon %{buildroot }%{_sbindir }/%{hv_kvp_daemon }
@@ -79,9 +130,9 @@ install -p -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}
79130
80131# Udev rules
81132mkdir -p %{buildroot }%{_udevrulesdir }
82- install -p -m 0644 %{SOURCE2 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-70- hv_kvp.rules
83- install -p -m 0644 %{SOURCE7 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-70- hv_vss.rules
84- install -p -m 0644 %{SOURCE10 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-70- hv_fcopy.rules
133+ install -p -m 0644 %{SOURCE2 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
134+ install -p -m 0644 %{SOURCE7 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
135+ install -p -m 0644 %{SOURCE10 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
85136
86137# Shell scripts for the KVP daemon
87138mkdir -p %{buildroot }%{_libexecdir }/%{hv_kvp_daemon }
@@ -92,41 +143,67 @@ install -p -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
92143# Directory for pool files
93144mkdir -p %{buildroot }%{_sharedstatedir }/hyperv
94145
95- %preun
96- if [ $1 -eq 0 ]; then # package is being erased, not upgraded
97- echo " Removing Package.."
98- echo " Stopping KVP Daemon...."
99- systemctl stop hypervkvpd
100- echo " Stopping FCOPY Daemon...."
101- systemctl stop hypervfcopyd
102- echo " Stopping VSS Daemon...."
103- systemctl stop hypervvssd
104- rm -rf %{_sharedstatedir}/hyperv || :
146+ %post -n hypervkvpd
147+ if [ $1 -gt 1 ] ; then
148+ # Upgrade
149+ systemctl --no-reload disable hypervkvpd.service > /dev/null 2>&1 || :
105150fi
106151
107- %post
108- if [ $1 > 1 ] ; then
109- # Upgrade
110- systemctl --no-reload disable hypervkvpd.service > /dev/null 2>&1 || :
111- systemctl --no-reload disable hypervvssd.service > /dev/null 2>&1 || :
112- systemctl --no-reload disable hypervfcopyd.service > /dev/null 2>&1 || :
113- fi
152+ %preun -n hypervkvpd
153+ %systemd_preun hypervkvpd.service
114154
115- %postun
155+ %postun -n hypervkvpd
156+ # hypervkvpd daemon does NOT support restarting (driver, neither)
116157%systemd_postun hypervkvpd.service
158+ # If removing the package, delete %%{_sharedstatedir}/hyperv directory
159+ if [ " $1 " -eq " 0" ] ; then
160+ rm -rf %{_sharedstatedir}/hyperv || :
161+ fi
162+
163+
164+ %post -n hypervvssd
165+ if [ $1 -gt 1 ] ; then
166+ # Upgrade
167+ systemctl --no-reload disable hypervvssd.service > /dev/null 2>&1 || :
168+ fi
169+
170+ %postun -n hypervvssd
117171%systemd_postun hypervvssd.service
172+
173+ %preun -n hypervvssd
174+ %systemd_preun hypervvssd.service
175+
176+
177+ %post -n hypervfcopyd
178+ if [ $1 -gt 1 ] ; then
179+ # Upgrade
180+ systemctl --no-reload disable hypervfcopyd.service > /dev/null 2>&1 || :
181+ fi
182+
183+ %postun -n hypervfcopyd
118184%systemd_postun hypervfcopyd.service
119185
186+ %preun -n hypervfcopyd
187+ %systemd_preun hypervfcopyd.service
188+
189+
120190%files
191+ # the base package does not contain any files.
192+
193+ %files -n hypervkvpd
121194%{_sbindir }/%{hv_kvp_daemon }
122195%{_unitdir }/hypervkvpd.service
123- %{_udevrulesdir }/%{udev_prefix }-70- hv_kvp.rules
196+ %{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
124197%dir %{_libexecdir }/%{hv_kvp_daemon }
125198%{_libexecdir }/%{hv_kvp_daemon }/*
126199%dir %{_sharedstatedir }/hyperv
200+
201+ %files -n hypervvssd
127202%{_sbindir }/%{hv_vss_daemon }
128203%{_unitdir }/hypervvssd.service
129- %{_udevrulesdir }/%{udev_prefix }-70-hv_vss.rules
204+ %{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
205+
206+ %files -n hypervfcopyd
130207%{_sbindir }/%{hv_fcopy_daemon }
131208%{_unitdir }/hypervfcopyd.service
132- %{_udevrulesdir }/%{udev_prefix }-70- hv_fcopy.rules
209+ %{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
0 commit comments