Blame WALinuxAgent.spec

5f84b1
%global commit 30019ae2c10a5c78f55d4ec342db07366abcc602
73c307
73c307
%if 0%{?fedora}
73c307
%global distro fedora
73c307
%global initsys systemd
73c307
%else
73c307
%if 0%{?rhel}
73c307
%global distro redhat
73c307
%if 0%{?rhel} < 7
73c307
%global initsys sysV
5f84b1
%{!?_udevrulesdir: %global _udevrulesdir /lib/udev/rules.d}
73c307
%else
73c307
%global initsys systemd
73c307
%endif
73c307
%{!?__python2: %global __python2 /usr/bin/python2}
73c307
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
73c307
%endif
73c307
%endif
73c307
73c307
Name:           WALinuxAgent
5f84b1
Version:        2.0.13
d3958f
Release:        1%{?dist}
196a46
Summary:        The Microsoft Azure Linux Agent
73c307
73c307
Group:          System Environment/Daemons
73c307
License:        ASL 2.0
73c307
URL:            https://github.com/Azure/%{name}
73c307
Source0:        https://github.com/Azure/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
73c307
# Redhat-specific patch (not submitted upstream)
73c307
Patch0:         %{name}-2.0.8-logrotate-name.patch
73c307
73c307
BuildArch:      noarch
73c307
73c307
BuildRequires:  python2-devel
73c307
BuildRequires:  python-setuptools
73c307
Requires:       net-tools
73c307
Requires:       ntfsprogs
73c307
Requires:       openssh
73c307
Requires:       openssh-server
73c307
Requires:       openssl
73c307
Requires:       parted
73c307
Requires:       python-pyasn1
73c307
73c307
%if 0%{?rhel} && 0%{?rhel} < 7
73c307
Conflicts:      NetworkManager
73c307
%endif
73c307
73c307
%if %{initsys} == systemd
73c307
BuildRequires:   systemd
73c307
Requires(post):  systemd
73c307
Requires(preun): systemd
73c307
Requires(postun): systemd
73c307
%else
73c307
%if %{initsys} == sysv
73c307
Requires(post):  chkconfig
73c307
Requires(preun): chkconfig
73c307
Requires(preun): initscripts
73c307
Requires(postun): initscripts
73c307
%endif
73c307
%endif
73c307
73c307
%description
196a46
The Microsoft Azure Linux Agent supports the provisioning and running of Linux
196a46
VMs in the Microsoft Azure cloud. This package should be installed on Linux disk
196a46
images that are built to run in the Microsoft Azure environment.
73c307
73c307
%prep
73c307
%setup -qn %{name}-%{commit}
73c307
%patch0 -p1
73c307
73c307
chmod 0755 distro/redhat/waagent.sysV
73c307
73c307
%build
73c307
%{__python2} setup.py build
73c307
73c307
%install
73c307
%{__python2} setup.py install --skip-build --root %{buildroot} --lnx-distro '%{distro}' --init-system '%{initsys}'
73c307
73c307
mkdir -p -m 0700 %{buildroot}%{_sharedstatedir}/waagent
73c307
mkdir -p %{buildroot}%{_localstatedir}/log
73c307
touch %{buildroot}%{_localstatedir}/log/waagent.log
73c307
5f84b1
mkdir -p %{buildroot}%{_udevrulesdir}
5f84b1
mv %{buildroot}%{_sysconfdir}/udev/rules.d/99-azure-product-uuid.rules %{buildroot}%{_udevrulesdir}/99-azure-product-uuid.rules
5f84b1
73c307
%post
73c307
%if %{initsys} == systemd
73c307
%systemd_post waagent.service
73c307
%else
73c307
%if %{initsys} == sysV
73c307
/sbin/chkconfig --add waagent
73c307
%endif
73c307
%endif
73c307
73c307
%preun
73c307
%if %{initsys} == systemd
73c307
%systemd_preun waagent.service
73c307
%else
73c307
%if %{initsys} == sysV
73c307
if [ $1 = 0 ]; then
73c307
        /sbin/service waagent stop >/dev/null 2>&1
73c307
        /sbin/chkconfig --del waagent
73c307
fi
73c307
%endif
73c307
%endif
73c307
73c307
%postun
73c307
%if %{initsys} == systemd
73c307
%systemd_postun_with_restart waagent.service
73c307
%else
73c307
%if %{initsys} == sysV
73c307
if [ "$1" -ge "1" ]; then
73c307
        /sbin/service waagent restart >/dev/null 2>&1 || :
73c307
fi
73c307
%endif
73c307
%endif
73c307
73c307
%files
73c307
%doc Changelog LICENSE-2.0.txt NOTICE README
73c307
%ghost %{_localstatedir}/log/waagent.log
73c307
%dir %attr(0700, root, root) %{_sharedstatedir}/waagent
73c307
%config(noreplace) %{_sysconfdir}/logrotate.d
73c307
%{_sbindir}/waagent
73c307
%config(noreplace) %{_sysconfdir}/waagent.conf
5f84b1
%{_udevrulesdir}/99-azure-product-uuid.rules
73c307
73c307
%if %{initsys} == systemd
73c307
%{_unitdir}/waagent.service
73c307
%else
73c307
%{_initddir}/waagent
73c307
%endif
73c307
73c307
%changelog
5f84b1
* Mon Jun 01 2015 Scott K Logan <logans@cottsay.net> - 2.0.13-1
5f84b1
- Update to 2.0.13
5f84b1
d3958f
* Thu Apr 02 2015 Scott K Logan <logans@cottsay.net> - 2.0.12-1
d3958f
- Update to 2.0.12-Oracle
d3958f
73c307
* Sat Jan 10 2015 Scott K Logan <logans@cottsay.net> - 2.0.11-2
73c307
- Use systemd for rhel7
73c307
- Own logrotate.d
73c307
- Fix python2-devel dep
73c307
73c307
* Sat Dec 20 2014 Scott K Logan <logans@cottsay.net> - 2.0.11-1
73c307
- Initial package