3
3
%global hv_vss_daemon hypervvssd
4
4
%global hv_fcopy_daemon hypervfcopyd
5
5
6
+ %global udev_prefix 70
6
7
# nodebuginfo
7
8
# norootforbuild
8
9
@@ -16,30 +17,26 @@ License: GPLv2+
16
17
Summary: Microsoft hyper-v daemons
17
18
Version: 1
18
19
Release: 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
30
31
Source11: hypervfcopyd.service
31
- Source12: Makefile
32
+ Source12: Makefile
32
33
Source13: Build
33
34
BuildRoot: %{_tmppath }/%{name }-%{version }-build
34
35
Requires: 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
40
37
41
38
%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.
43
40
44
41
%prep
45
42
%setup -Tc
@@ -57,14 +54,15 @@ cp -pvL %{SOURCE10} %{hv_fcopy_daemon}.service
57
54
58
55
cp -pvL %{SOURCE12 } Makefile
59
56
if [ ! -e "%{SOURCE13 }" ]; then
60
- touch %{SOURCE13 }
57
+ touch %{SOURCE13 }
61
58
fi
62
59
cp -pvL %{SOURCE13 } Build
63
60
%build
64
61
make clean
65
62
make
66
63
67
64
%install
65
+ rm -rf %{buildroot }
68
66
69
67
mkdir -p %{buildroot }%{_sbindir }
70
68
install -p -m 0755 hv_kvp_daemon %{buildroot }%{_sbindir }/%{hv_kvp_daemon }
@@ -79,9 +77,9 @@ install -p -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}
79
77
80
78
# Udev rules
81
79
mkdir -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
85
83
86
84
# Shell scripts for the KVP daemon
87
85
mkdir -p %{buildroot }%{_libexecdir }/%{hv_kvp_daemon }
@@ -92,41 +90,38 @@ install -p -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
92
90
# Directory for pool files
93
91
mkdir -p %{buildroot }%{_sharedstatedir }/hyperv
94
92
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
-
107
93
%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 || :
113
99
fi
114
100
115
- %postun
101
+ %preun
102
+ %systemd_preun hypervkvpd.service
103
+ %systemd_preun hypervvssd.service
104
+ %systemd_preun hypervfcopyd.service
105
+
106
+ %postun
116
107
%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
117
112
%systemd_postun hypervvssd.service
118
113
%systemd_postun hypervfcopyd.service
119
114
120
115
%files
121
116
%{_sbindir }/%{hv_kvp_daemon }
122
117
%{_unitdir }/hypervkvpd.service
123
- %{_udevrulesdir }/%{udev_prefix }-70- hv_kvp.rules
118
+ %{_udevrulesdir }/%{udev_prefix }-hv_kvp.rules
124
119
%dir %{_libexecdir }/%{hv_kvp_daemon }
125
120
%{_libexecdir }/%{hv_kvp_daemon }/*
126
121
%dir %{_sharedstatedir }/hyperv
127
122
%{_sbindir }/%{hv_vss_daemon }
128
123
%{_unitdir }/hypervvssd.service
129
- %{_udevrulesdir }/%{udev_prefix }-70- hv_vss.rules
124
+ %{_udevrulesdir }/%{udev_prefix }-hv_vss.rules
130
125
%{_sbindir }/%{hv_fcopy_daemon }
131
126
%{_unitdir }/hypervfcopyd.service
132
- %{_udevrulesdir }/%{udev_prefix }-70- hv_fcopy.rules
127
+ %{_udevrulesdir }/%{udev_prefix }-hv_fcopy.rules
0 commit comments