Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit aa44a7d

Browse files
committed
Fix install hyperv-daemon on CentOS.
1 parent 10ae0c4 commit aa44a7d

File tree

1 file changed

+38
-40
lines changed

1 file changed

+38
-40
lines changed

scripts/package_building/deps-lis/rpm/lis-daemon.spec

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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+
1617
Summary: Microsoft hyper-v daemons
1718
Version: 1
1819
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
3031
Source11: hypervfcopyd.service
31-
Source12: Makefile
32+
Source12: Makefile
3233
Source13: Build
3334
BuildRoot: %{_tmppath}/%{name}-%{version}-build
3435
Requires: kernel >= 3.10.0-123
35-
BuildRequires: systemd, kernel-headers
36+
BuildRequires: systemd, kernel-headers
3637
Requires(post): systemd
3738
Requires(preun): systemd
3839
Requires(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

5858
cp -pvL %{SOURCE12} Makefile
5959
if [ ! -e "%{SOURCE13}" ]; then
60-
touch %{SOURCE13}
60+
touch %{SOURCE13}
6161
fi
6262
cp -pvL %{SOURCE13} Build
6363
%build
6464
make clean
6565
make
6666

6767
%install
68+
rm -rf %{buildroot}
6869

6970
mkdir -p %{buildroot}%{_sbindir}
7071
install -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
8182
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
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
8788
mkdir -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
9394
mkdir -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 || :
113102
fi
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

Comments
 (0)