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