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,29 @@ 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+ BuildRequires: systemd, kernel-headers
3637Requires(post): systemd
3738Requires(preun): systemd
3839Requires(postun): systemd
3940
40-
4141%description
42- Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
42+ Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
4343
4444%prep
4545%setup -Tc
@@ -57,14 +57,15 @@ cp -pvL %{SOURCE10} %{hv_fcopy_daemon}.service
5757
5858cp -pvL %{SOURCE12 } Makefile
5959if [ ! -e "%{SOURCE13 }" ]; then
60- touch %{SOURCE13 }
60+ touch %{SOURCE13 }
6161fi
6262cp -pvL %{SOURCE13 } Build
6363%build
6464make clean
6565make
6666
6767%install
68+ rm -rf %{buildroot }
6869
6970mkdir -p %{buildroot }%{_sbindir }
7071install -p -m 0755 hv_kvp_daemon %{buildroot }%{_sbindir }/%{hv_kvp_daemon }
@@ -79,9 +80,9 @@ install -p -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}
7980
8081# Udev rules
8182mkdir -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
83+ install -p -m 0644 %{SOURCE2 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
84+ install -p -m 0644 %{SOURCE7 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
85+ install -p -m 0644 %{SOURCE10 } %{buildroot }%{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
8586
8687# Shell scripts for the KVP daemon
8788mkdir -p %{buildroot }%{_libexecdir }/%{hv_kvp_daemon }
@@ -92,41 +93,38 @@ install -p -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
9293# Directory for pool files
9394mkdir -p %{buildroot }%{_sharedstatedir }/hyperv
9495
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-
10796%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 || :
97+ if [ $1 -gt 1 ] ; then
98+ # Upgrade
99+ systemctl --no-reload disable hypervkvpd.service > /dev/null 2>&1 || :
100+ systemctl --no-reload disable hypervvssd.service > /dev/null 2>&1 || :
101+ systemctl --no-reload disable hypervfcopyd.service > /dev/null 2>&1 || :
113102fi
114103
115- %postun
104+ %preun
105+ %systemd_preun hypervkvpd.service
106+ %systemd_preun hypervvssd.service
107+ %systemd_preun hypervfcopyd.service
108+
109+ %postun
116110%systemd_postun hypervkvpd.service
111+ # If removing the package, delete %%{_sharedstatedir}/hyperv directory
112+ if [ " $1 " -eq " 0" ] ; then
113+ rm -rf %{_sharedstatedir}/hyperv || :
114+ fi
117115%systemd_postun hypervvssd.service
118116%systemd_postun hypervfcopyd.service
119117
120118%files
121119%{_sbindir }/%{hv_kvp_daemon }
122120%{_unitdir }/hypervkvpd.service
123- %{_udevrulesdir }/%{udev_prefix }-70- hv_kvp.rules
121+ %{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
124122%dir %{_libexecdir }/%{hv_kvp_daemon }
125123%{_libexecdir }/%{hv_kvp_daemon }/*
126124%dir %{_sharedstatedir }/hyperv
127125%{_sbindir }/%{hv_vss_daemon }
128126%{_unitdir }/hypervvssd.service
129- %{_udevrulesdir }/%{udev_prefix }-70- hv_vss.rules
127+ %{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
130128%{_sbindir }/%{hv_fcopy_daemon }
131129%{_unitdir }/hypervfcopyd.service
132- %{_udevrulesdir }/%{udev_prefix }-70- hv_fcopy.rules
130+ %{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
0 commit comments