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

Commit

Permalink
Fix install hyperv-daemon on CentOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
LiliDeng committed Feb 4, 2020
1 parent 10ae0c4 commit fd0dd6e
Showing 1 changed file with 120 additions and 43 deletions.
163 changes: 120 additions & 43 deletions scripts/package_building/deps-lis/rpm/lis-daemon.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
%global hv_vss_daemon hypervvssd
%global hv_fcopy_daemon hypervfcopyd

%global snapver .20180415git
%global udev_prefix 70
# nodebuginfo
# norootforbuild

Expand All @@ -16,30 +18,78 @@ License: GPLv2+
Summary: Microsoft hyper-v daemons
Version: 1
Release: 0.29%{?snapver}%{?dist}
Source0: hv_kvp_daemon.c
Source1: hypervkvpd.service
Source2: hypervkvp.rules
Source3: hv_get_dhcp_info.sh
Source4: hv_get_dns_info.sh
Source5: hv_set_ifconfig.sh
Source6: hv_vss_daemon.c
Source7: hypervvss.rules
Source8: hypervvssd.service
Source9: hv_fcopy_daemon.c
Source10: hypervfcopy.rules
Source0: hv_kvp_daemon.c
Source1: hypervkvpd.service
Source2: hypervkvp.rules
Source3: hv_get_dhcp_info.sh
Source4: hv_get_dns_info.sh
Source5: hv_set_ifconfig.sh
Source6: hv_vss_daemon.c
Source7: hypervvss.rules
Source8: hypervvssd.service
Source9: hv_fcopy_daemon.c
Source10: hypervfcopy.rules
Source11: hypervfcopyd.service
Source12: Makefile
Source12: Makefile
Source13: Build
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: kernel >= 3.10.0-123
BuildRequires: systemd, kernel-headers
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

Requires: hypervkvpd = %{version}-%{release}
Requires: hypervvssd = %{version}-%{release}
Requires: hypervfcopyd = %{version}-%{release}
BuildRequires: systemd, kernel-headers

%description
Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.
Suite of daemons that are needed when Linux guest is running on Windows host with HyperV.

%package -n hypervkvpd
Summary: HyperV key value pair (KVP) daemon
Group: System Environment/Daemons
Requires: kernel >= 3.10.0-123
BuildRequires: systemd, kernel-headers
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description -n hypervkvpd
Hypervkvpd is an implementation of HyperV key value pair (KVP)
functionality for Linux. The daemon first registers with the
kernel driver. After this is done it collects information
requested by Windows Host about the Linux Guest. It also supports
IP injection functionality on the Guest.

%package -n hypervvssd
Summary: HyperV VSS daemon
Group: System Environment/Daemons
Requires: kernel >= 3.10.0-123
BuildRequires: systemd, kernel-headers
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description -n hypervvssd
Hypervvssd is an implementation of HyperV VSS functionality
for Linux. The daemon is used for host initiated guest snapshot
on HyperV hypervisor. The daemon first registers with the
kernel driver. After this is done it waits for instructions
from Windows Host if to "freeze" or "thaw" the filesystem
on the Linux Guest.

%package -n hypervfcopyd
Summary: HyperV FCOPY daemon
Group: System Environment/Daemons
Requires: kernel >= 3.10.0-123
BuildRequires: systemd, kernel-headers
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%description -n hypervfcopyd
Hypervfcopyd is an implementation of file copy service functionality
for Linux Guest running on HyperV. The daemon enables host to copy
a file (over VMBUS) into the Linux Guest. The daemon first registers
with the kernel driver. After this is done it waits for instructions
from Windows Host.

%prep
%setup -Tc
Expand All @@ -57,14 +107,15 @@ cp -pvL %{SOURCE10} %{hv_fcopy_daemon}.service

cp -pvL %{SOURCE12} Makefile
if [ ! -e "%{SOURCE13}" ]; then
touch %{SOURCE13}
touch %{SOURCE13}
fi
cp -pvL %{SOURCE13} Build
%build
make clean
make

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}%{_sbindir}
install -p -m 0755 hv_kvp_daemon %{buildroot}%{_sbindir}/%{hv_kvp_daemon}
Expand All @@ -79,9 +130,9 @@ install -p -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}

# Udev rules
mkdir -p %{buildroot}%{_udevrulesdir}
install -p -m 0644 %{SOURCE2} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-70-hv_kvp.rules
install -p -m 0644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-70-hv_vss.rules
install -p -m 0644 %{SOURCE10} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-70-hv_fcopy.rules
install -p -m 0644 %{SOURCE2} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hv_kvp.rules
install -p -m 0644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hv_vss.rules
install -p -m 0644 %{SOURCE10} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hv_fcopy.rules

# Shell scripts for the KVP daemon
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
Expand All @@ -92,41 +143,67 @@ install -p -m 0755 %{SOURCE5} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set
# Directory for pool files
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv

%preun
if [ $1 -eq 0 ]; then # package is being erased, not upgraded
echo "Removing Package.."
echo "Stopping KVP Daemon...."
systemctl stop hypervkvpd
echo "Stopping FCOPY Daemon...."
systemctl stop hypervfcopyd
echo "Stopping VSS Daemon...."
systemctl stop hypervvssd
rm -rf %{_sharedstatedir}/hyperv || :
%post -n hypervkvpd
if [ $1 -gt 1 ] ; then
# Upgrade
systemctl --no-reload disable hypervkvpd.service >/dev/null 2>&1 || :
fi

%post
if [ $1 > 1 ] ; then
# Upgrade
systemctl --no-reload disable hypervkvpd.service >/dev/null 2>&1 || :
systemctl --no-reload disable hypervvssd.service >/dev/null 2>&1 || :
systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
fi
%preun -n hypervkvpd
%systemd_preun hypervkvpd.service

%postun
%postun -n hypervkvpd
# hypervkvpd daemon does NOT support restarting (driver, neither)
%systemd_postun hypervkvpd.service
# If removing the package, delete %%{_sharedstatedir}/hyperv directory
if [ "$1" -eq "0" ] ; then
rm -rf %{_sharedstatedir}/hyperv || :
fi


%post -n hypervvssd
if [ $1 -gt 1 ] ; then
# Upgrade
systemctl --no-reload disable hypervvssd.service >/dev/null 2>&1 || :
fi

%postun -n hypervvssd
%systemd_postun hypervvssd.service

%preun -n hypervvssd
%systemd_preun hypervvssd.service


%post -n hypervfcopyd
if [ $1 -gt 1 ] ; then
# Upgrade
systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
fi

%postun -n hypervfcopyd
%systemd_postun hypervfcopyd.service

%preun -n hypervfcopyd
%systemd_preun hypervfcopyd.service


%files
# the base package does not contain any files.

%files -n hypervkvpd
%{_sbindir}/%{hv_kvp_daemon}
%{_unitdir}/hypervkvpd.service
%{_udevrulesdir}/%{udev_prefix}-70-hv_kvp.rules
%{_udevrulesdir}/%{udev_prefix}-hv_kvp.rules
%dir %{_libexecdir}/%{hv_kvp_daemon}
%{_libexecdir}/%{hv_kvp_daemon}/*
%dir %{_sharedstatedir}/hyperv

%files -n hypervvssd
%{_sbindir}/%{hv_vss_daemon}
%{_unitdir}/hypervvssd.service
%{_udevrulesdir}/%{udev_prefix}-70-hv_vss.rules
%{_udevrulesdir}/%{udev_prefix}-hv_vss.rules

%files -n hypervfcopyd
%{_sbindir}/%{hv_fcopy_daemon}
%{_unitdir}/hypervfcopyd.service
%{_udevrulesdir}/%{udev_prefix}-70-hv_fcopy.rules
%{_udevrulesdir}/%{udev_prefix}-hv_fcopy.rules

0 comments on commit fd0dd6e

Please sign in to comment.