33%global hv_vss_daemon hypervvssd
44%global hv_fcopy_daemon hypervfcopyd
55
6+ %global udev_prefix 70
67# nodebuginfo
78# norootforbuild
89
@@ -16,30 +17,26 @@ License: GPLv2+
1617Summary: Microsoft hyper-v daemons
1718Version: 1
1819Release: 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
20+ Source0: hv_kvp_daemon.c
21+ Source1: hypervkvpd.service
22+ Source2: hypervkvp.rules
23+ Source3: hv_get_dhcp_info.sh
24+ Source4: hv_get_dns_info.sh
25+ Source5: hv_set_ifconfig.sh
26+ Source6: hv_vss_daemon.c
27+ Source7: hypervvss.rules
28+ Source8: hypervvssd.service
29+ Source9: hv_fcopy_daemon.c
30+ Source10: hypervfcopy.rules
3031Source11: hypervfcopyd.service
31- Source12: Makefile
32+ Source12: Makefile
3233Source13: Build
3334BuildRoot: %{_tmppath }/%{name }-%{version }-build
3435Requires: kernel >= 3.10.0-123
35- BuildRequires: systemd, kernel-headers
36- Requires(post): systemd
37- Requires(preun): systemd
38- Requires(postun): systemd
39-
36+ BuildRequires: systemd, kernel-headers
4037
4138%description
42- Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
39+ Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
4340
4441%prep
4542%setup -Tc
@@ -57,14 +54,15 @@ cp -pvL %{SOURCE10} %{hv_fcopy_daemon}.service
5754
5855cp -pvL %{SOURCE12 } Makefile
5956if [ ! -e "%{SOURCE13 }" ]; then
60- touch %{SOURCE13 }
57+ touch %{SOURCE13 }
6158fi
6259cp -pvL %{SOURCE13 } Build
6360%build
6461make clean
6562make
6663
6764%install
65+ rm -rf %{buildroot }
6866
6967mkdir -p %{buildroot }%{_sbindir }
7068install -p -m 0755 hv_kvp_daemon %{buildroot }%{_sbindir }/%{hv_kvp_daemon }
@@ -79,9 +77,9 @@ install -p -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}
7977
8078# Udev rules
8179mkdir -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
80+ install -p -m 0644 %{SOURCE2 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
81+ install -p -m 0644 %{SOURCE7 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
82+ install -p -m 0644 %{SOURCE10 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
8583
8684# Shell scripts for the KVP daemon
8785mkdir -p %{buildroot }%{_libexecdir }/%{hv_kvp_daemon }
@@ -92,41 +90,38 @@ install -p -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
9290# Directory for pool files
9391mkdir -p %{buildroot }%{_sharedstatedir }/hyperv
9492
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 || :
105- fi
106-
10793%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 || :
94+ if [ $1 -gt 1 ] ; then
95+ # Upgrade
96+ systemctl --no-reload disable hypervkvpd.service > /dev/null 2>&1 || :
97+ systemctl --no-reload disable hypervvssd.service > /dev/null 2>&1 || :
98+ systemctl --no-reload disable hypervfcopyd.service > /dev/null 2>&1 || :
11399fi
114100
115- %postun
101+ %preun
102+ %systemd_preun hypervkvpd.service
103+ %systemd_preun hypervvssd.service
104+ %systemd_preun hypervfcopyd.service
105+
106+ %postun
116107%systemd_postun hypervkvpd.service
108+ # If removing the package, delete %%{_sharedstatedir}/hyperv directory
109+ if [ " $1 " -eq " 0" ] ; then
110+ rm -rf %{_sharedstatedir}/hyperv || :
111+ fi
117112%systemd_postun hypervvssd.service
118113%systemd_postun hypervfcopyd.service
119114
120115%files
121116%{_sbindir }/%{hv_kvp_daemon }
122117%{_unitdir }/hypervkvpd.service
123- %{_udevrulesdir }/%{udev_prefix }-70- hv_kvp.rules
118+ %{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
124119%dir %{_libexecdir }/%{hv_kvp_daemon }
125120%{_libexecdir }/%{hv_kvp_daemon }/*
126121%dir %{_sharedstatedir }/hyperv
127122%{_sbindir }/%{hv_vss_daemon }
128123%{_unitdir }/hypervvssd.service
129- %{_udevrulesdir }/%{udev_prefix }-70- hv_vss.rules
124+ %{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
130125%{_sbindir }/%{hv_fcopy_daemon }
131126%{_unitdir }/hypervfcopyd.service
132- %{_udevrulesdir }/%{udev_prefix }-70- hv_fcopy.rules
127+ %{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
0 commit comments