Clean up spec

SysV initscripts support is not needed.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
This commit is contained in:
Vitaly Kuznetsov 2018-04-16 15:14:02 +02:00
parent 49ee797010
commit 2420c98c23

View File

@ -1,21 +1,7 @@
%global commit 5bb9df7f2f485dbd5be057bbb657afe54bc1bf1b %global commit 5bb9df7f2f485dbd5be057bbb657afe54bc1bf1b
%if 0%{?fedora}
%global distro fedora %global distro fedora
%global initsys systemd %global initsys systemd
%else
%if 0%{?rhel}
%global distro redhat
%if 0%{?rhel} < 7
%global initsys sysV
%{!?_udevrulesdir: %global _udevrulesdir /lib/udev/rules.d}
%else
%global initsys systemd
%endif
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%endif
Name: WALinuxAgent Name: WALinuxAgent
Version: 2.0.18 Version: 2.0.18
@ -41,23 +27,10 @@ Requires: openssl
Requires: parted Requires: parted
Requires: python2-pyasn1 Requires: python2-pyasn1
%if 0%{?rhel} && 0%{?rhel} < 7
Conflicts: NetworkManager
%endif
%if %{initsys} == systemd
BuildRequires: systemd BuildRequires: systemd
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
%else
%if %{initsys} == sysv
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
%endif
%endif
%description %description
The Microsoft Azure Linux Agent supports the provisioning and running of Linux The Microsoft Azure Linux Agent supports the provisioning and running of Linux
@ -68,8 +41,6 @@ images that are built to run in the Microsoft Azure environment.
%setup -qn %{name}-%{commit} %setup -qn %{name}-%{commit}
%patch0 -p1 %patch0 -p1
chmod 0755 distro/redhat/waagent.sysV
%build %build
%{__python2} setup.py build %{__python2} setup.py build
@ -84,36 +55,13 @@ mkdir -p %{buildroot}%{_udevrulesdir}
mv %{buildroot}%{_sysconfdir}/udev/rules.d/99-azure-product-uuid.rules %{buildroot}%{_udevrulesdir}/99-azure-product-uuid.rules mv %{buildroot}%{_sysconfdir}/udev/rules.d/99-azure-product-uuid.rules %{buildroot}%{_udevrulesdir}/99-azure-product-uuid.rules
%post %post
%if %{initsys} == systemd
%systemd_post waagent.service %systemd_post waagent.service
%else
%if %{initsys} == sysV
/sbin/chkconfig --add waagent
%endif
%endif
%preun %preun
%if %{initsys} == systemd
%systemd_preun waagent.service %systemd_preun waagent.service
%else
%if %{initsys} == sysV
if [ $1 = 0 ]; then
/sbin/service waagent stop >/dev/null 2>&1
/sbin/chkconfig --del waagent
fi
%endif
%endif
%postun %postun
%if %{initsys} == systemd
%systemd_postun_with_restart waagent.service %systemd_postun_with_restart waagent.service
%else
%if %{initsys} == sysV
if [ "$1" -ge "1" ]; then
/sbin/service waagent restart >/dev/null 2>&1 || :
fi
%endif
%endif
%files %files
%doc Changelog LICENSE-2.0.txt NOTICE README %doc Changelog LICENSE-2.0.txt NOTICE README
@ -123,12 +71,7 @@ fi
%{_sbindir}/waagent %{_sbindir}/waagent
%config(noreplace) %{_sysconfdir}/waagent.conf %config(noreplace) %{_sysconfdir}/waagent.conf
%{_udevrulesdir}/99-azure-product-uuid.rules %{_udevrulesdir}/99-azure-product-uuid.rules
%if %{initsys} == systemd
%{_unitdir}/waagent.service %{_unitdir}/waagent.service
%else
%{_initddir}/waagent
%endif
%changelog %changelog
* Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.0.18-5 * Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.0.18-5