Blame SPECS/insights-client.spec

9e9e6c
%if 0%{?rhel} != 8
9e9e6c
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
9e9e6c
%endif
7ed636
%define _binaries_in_noarch_packages_terminate_build 0
7ed636
7ed636
Name:                   insights-client
7ed636
Summary:                Uploads Insights information to Red Hat on a periodic basis
9e9e6c
Version:                3.0.13
9e9e6c
Release:                1%{?dist}
7ed636
Source0:                https://github.com/redhatinsights/insights-client/archive/insights-client-%{version}.tar.gz
7ed636
Epoch:                  0
7ed636
License:                GPLv2+
23e911
URL:                    http://cloud.redhat.com/insights
7ed636
Group:                  Applications/System
7ed636
Vendor:                 Red Hat, Inc.
7ed636
7ed636
Provides: redhat-access-insights = 1.0.13-3
23e911
Provides: redhat-access-insights = %{version}-%{release}%{?dist}
23e911
23e911
Obsoletes: redhat-access-insights
23e911
Obsoletes: redhat-access-proactive
7ed636
23e911
Requires: tar
23e911
Requires: gpg
23e911
Requires: pciutils
23e911
BuildArch: noarch
7ed636
23e911
# RHEL 8
23e911
%if 0%{?rhel} == 8
23e911
%{?__python3:Requires: %{__python3}}
23e911
Requires: platform-python-setuptools
23e911
Requires: python3-requests >= 2.6
23e911
Requires: python3-PyYAML
23e911
Requires: python3-magic
23e911
Requires: python3-six
23e911
BuildRequires: python3-devel
9e9e6c
BuildRequires: python3-six
23e911
BuildRequires: python3-setuptools
23e911
23e911
# RHEL 6-7
23e911
%else
7ed636
Requires: python
7ed636
Requires: python-setuptools
7ed636
Requires: python-requests >= 2.6
7ed636
Requires: PyYAML
7ed636
Requires: libcgroup
7ed636
Requires: python-magic
23e911
Requires: python-six >= 1.9.0
23e911
BuildRequires: python2-devel
9e9e6c
BuildRequires: python-six
23e911
BuildRequires: python-setuptools
23e911
%endif
23e911
23e911
# systemd/RHEL 6 deps
23e911
%if 0%{?rhel} == 6
7ed636
Requires: python-argparse
7ed636
%else
7ed636
%{?systemd_requires}
7ed636
Requires: systemd
7ed636
BuildRequires: systemd
7ed636
%endif
7ed636
7ed636
%description
7ed636
Sends insightful information to Red Hat for automated analysis
7ed636
7ed636
%prep
23e911
%setup -q
7ed636
7ed636
%install
7ed636
rm -rf ${RPM_BUILD_ROOT}
23e911
%if 0%{?rhel} == 8
23e911
%{__python3} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
23e911
pathfix.py -pni "%{__python3}" %{buildroot}%{python3_sitelib}/insights_client/{__init__.py,major_version.py,run.py}
23e911
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/insights-client
23e911
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/redhat-access-insights
23e911
%else
9e9e6c
%{__python} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
23e911
%endif
7ed636
7ed636
%post
7ed636
7ed636
%if 0%{?rhel} != 6
7ed636
%systemd_post %{name}.timer
7ed636
%endif
7ed636
7ed636
# Only perform migration from redhat-access-insights to insights-client
7ed636
if  [ $1 -eq 1  ]; then
7ed636
    #Migrate existing machine-id
7ed636
    if  [ -f "/etc/redhat_access_proactive/machine-id" ]; then
7ed636
        cp /etc/redhat_access_proactive/machine-id /etc/insights-client/machine-id
7ed636
    fi
7ed636
    #Migrate OTHER existing machine-id
7ed636
    if [ -f "/etc/redhat-access-insights/machine-id" ]; then
7ed636
        cp /etc/redhat-access-insights/machine-id /etc/insights-client/machine-id
7ed636
    fi
7ed636
    #Migrate existing config
7ed636
    if [ -f "/etc/redhat-access-insights/redhat-access-insights.conf" ]; then
7ed636
        cp /etc/redhat-access-insights/redhat-access-insights.conf /etc/insights-client/insights-client.conf
7ed636
        sed -i 's/\[redhat-access-insights\]/\[insights-client\]/' /etc/insights-client/insights-client.conf
7ed636
    fi
7ed636
    #Migrate registration record
7ed636
    if [ -f "/etc/redhat-access-insights/.registered" ]; then
7ed636
        cp /etc/redhat-access-insights/.registered /etc/insights-client/.registered
7ed636
    fi
7ed636
    if [ -f "/etc/redhat-access-insights/.unregistered" ]; then
7ed636
        cp /etc/redhat-access-insights/.unregistered /etc/insights-client/.unregistered
7ed636
    fi
7ed636
    #Migrate last upload record
7ed636
    if [ -f "/etc/redhat-access-insights/.lastupload" ]; then
7ed636
        cp /etc/redhat-access-insights/.lastupload /etc/insights-client/.lastupload
7ed636
    fi
23e911
    #Migrate remove.conf
23e911
    if [ -f "/etc/redhat-access-insights/remove.conf" ]; then
23e911
        cp /etc/redhat-access-insights/remove.conf /etc/insights-client/remove.conf
23e911
    fi
7ed636
    if ! [ -d "/etc/redhat-access-insights" ]; then
7ed636
        mkdir /etc/redhat-access-insights
7ed636
    fi
7ed636
    # Symlink new cron job if the old one exists. Remove the old one
7ed636
    if [ -f "/etc/cron.daily/redhat-access-insights" ]; then
7ed636
        rm -f /etc/cron.daily/redhat-access-insights
23e911
        %if 0%{?rhel} == 6
7ed636
            ln -sf /etc/insights-client/insights-client.cron /etc/cron.daily/insights-client                               
7ed636
        %else
7ed636
            %_bindir/systemctl start insights-client.timer
7ed636
        %endif
7ed636
    fi 
7ed636
fi
7ed636
7ed636
# if the logging directory isnt created then make it
7ed636
if ! [ -d "/var/log/insights-client" ]; then
9e9e6c
mkdir -m 750 /var/log/insights-client
7ed636
fi
7ed636
7ed636
# if the library directory for eggs and such isn't present
23e911
# make it
7ed636
if ! [ -d "/var/lib/insights" ]; then
9e9e6c
mkdir -m 755 /var/lib/insights
9e9e6c
fi
9e9e6c
9e9e6c
%if 0%{?rhel} == 8
9e9e6c
#Link motd into place. Only do so if motd file doesn't exist and insights hasn't been used
9e9e6c
if [ ! -e /etc/motd.d/insights-client -a ! -L /etc/motd.d/insights-client ]; then
9e9e6c
    mkdir -p /etc/motd.d
9e9e6c
    if [ -e /var/lib/insights/newest.egg ]; then
9e9e6c
        ln -sn /dev/null /etc/motd.d/insights-client
9e9e6c
    else
9e9e6c
        ln -sn /etc/insights-client/insights-client.motd /etc/motd.d/insights-client
9e9e6c
    fi
7ed636
fi
9e9e6c
%endif
7ed636
7ed636
# always perform legacy symlinks
7ed636
%posttrans
7ed636
mkdir -p /etc/redhat-access-insights
7ed636
ln -sf /etc/insights-client/insights-client.conf /etc/redhat-access-insights/redhat-access-insights.conf
7ed636
ln -sf /etc/insights-client/insights-client.cron /etc/redhat-access-insights/redhat-access-insights.cron
7ed636
ln -sf /etc/insights-client/.registered /etc/redhat-access-insights/.registered
7ed636
ln -sf /etc/insights-client/.unregistered /etc/redhat-access-insights/.unregistered
7ed636
ln -sf /etc/insights-client/.lastupload /etc/redhat-access-insights/.lastupload
7ed636
ln -sf /etc/insights-client/machine-id /etc/redhat-access-insights/machine-id
23e911
# remove all ACLs on upgrade, forever and always
23e911
setfacl -Rb /var/lib/insights
23e911
setfacl -Rb /var/log/insights-client
23e911
setfacl -Rb /etc/insights-client
7ed636
7ed636
%preun
7ed636
%if 0%{?rhel} != 6
7ed636
%systemd_preun %{name}.timer
7ed636
%systemd_preun %{name}.service
7ed636
%endif
7ed636
7ed636
%postun
7ed636
if [ "$1" -eq 0 ]; then
7ed636
# One run on removal, not upgrade
7ed636
%if 0%{?rhel} != 6
7ed636
%_bindir/systemctl daemon-reload > /dev/null 2>&1
7ed636
%endif
7ed636
rm -f /etc/cron.daily/insights-client
7ed636
rm -f /etc/cron.weekly/insights-client
7ed636
rm -f /etc/insights-client/.cache*
7ed636
rm -f /etc/insights-client/.registered
7ed636
rm -f /etc/insights-client/.unregistered
7ed636
rm -f /etc/insights-client/.lastupload
7ed636
rm -f /etc/insights-client/rpm.egg
7ed636
rm -f /etc/insights-client/rpm.egg.asc
23e911
rm -f /etc/insights-client/.insights-core*.etag
7ed636
rm -rf /var/lib/insights
23e911
# keep these to remove from previous install
7ed636
rm -f /etc/ansible/facts.d/insights.fact
7ed636
rm -f /etc/ansible/facts.d/insights_machine_id.fact
7ed636
# remove symlink to old name on uninstall
7ed636
rm -f %{_bindir}/redhat-access-insights
7ed636
# remove symlinks to old configs
7ed636
rm -rf /etc/redhat-access-insights/
7ed636
rm -f /etc/cron.daily/redhat-access-insights
7ed636
rm -f /etc/cron.weekly/redhat-access-insights
9e9e6c
%if 0%{?rhel} == 8
9e9e6c
rm -f /etc/motd.d/insights-client
9e9e6c
%endif
7ed636
fi
7ed636
7ed636
%clean
7ed636
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
7ed636
7ed636
%files
7ed636
%defattr(0600, root, root)
7ed636
%config(noreplace) /etc/insights-client/*.conf
7ed636
/etc/insights-client/.fallback.json
7ed636
/etc/insights-client/.fallback.json.asc
7ed636
/etc/insights-client/.exp.sed
9e9e6c
%if 0%{?rhel} == 8
9e9e6c
%config(noreplace) %attr(644,root,root) /etc/insights-client/insights-client.motd
9e9e6c
%endif
7ed636
7ed636
%if 0%{?rhel} != 6
7ed636
%attr(644,root,root) %{_unitdir}/insights-client.service
7ed636
%attr(644,root,root) %{_unitdir}/insights-client.timer
7ed636
%endif
7ed636
7ed636
%attr(440,root,root) /etc/insights-client/*.pem
7ed636
%attr(440,root,root) /etc/insights-client/redhattools.pub.gpg
7ed636
7ed636
%attr(755,root,root) %{_bindir}/insights-client
7ed636
%attr(755,root,root) %{_bindir}/redhat-access-insights
7ed636
23e911
%if 0%{?rhel} == 6
7ed636
%attr(755,root,root) /etc/insights-client/insights-client.cron
9e9e6c
%config(noreplace) %attr(644,root,root) /etc/sysconfig/insights-client
7ed636
%endif
7ed636
7ed636
%attr(644,root,root) /etc/insights-client/rpm.egg
7ed636
%attr(644,root,root) /etc/insights-client/rpm.egg.asc
7ed636
23e911
%if 0%{?rhel} == 8
9e9e6c
%attr(755,root,root) %{python3_sitelib}/insights_client*.egg-info
23e911
%attr(644,root,root) %{python3_sitelib}/insights_client*.egg-info/*
23e911
%attr(644,root,root) %{python3_sitelib}/insights_client/*.py*
9e9e6c
%attr(744,root,root) %{python3_sitelib}/insights_client/__pycache__
23e911
%else
9e9e6c
%attr(755,root,root) %{python_sitelib}/insights_client*.egg-info
9e9e6c
%attr(644,root,root) %{python_sitelib}/insights_client*.egg-info/*
9e9e6c
%attr(644,root,root) %{python_sitelib}/insights_client/*.py*
23e911
%endif
23e911
9e9e6c
%attr(750,root,root) /var/log/insights-client
9e9e6c
%attr(755,root,root) /var/lib/insights
7ed636
7ed636
%doc
7ed636
%defattr(-, root, root)
7ed636
/usr/share/man/man8/*.8.gz
7ed636
/usr/share/man/man5/*.5.gz
7ed636
7ed636
%changelog
9e9e6c
* Tue Feb 11 2020 Link Dupont <link@redhat.com> - 3.0.13-1
9e9e6c
- New upstream version
9e9e6c
- Resolves: RHBZ#1759083
23e911
5eaba2
* Wed Mar 14 2018 Richard Brantley <rbrantle@redhat.com> - 3.0.3-8
5eaba2
- Resolves: rhbz#1555041
5eaba2
7ed636
* Fri Feb 16 2018 Kyle Lape <klape@redhat.com> - 3.0.3-6
7ed636
- Persist systemd timer config between reboots
7ed636
7ed636
* Wed Feb 7 2018 Kyle Lape <klape@redhat.com> - 3.0.3-2
7ed636
- Correct the version strings in Obsoletes and Provides in RPM spec
7ed636
7ed636
* Thu Jan 18 2018 Kyle Lape <klape@redhat.com> - 3.0.3-1
7ed636
- RHEL 7 RPM now uses systemd service and timer instead of cron
7ed636
- Addition of IO and CPU cgroup constraints
7ed636
- Fixed memory cgroup constraint
7ed636
7ed636
* Wed Oct 18 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.2-2
7ed636
- Resolves BZ1498650, BZ1500008, BZ1501545, BZ1501552, BZ1501556, BZ1501561, BZ1501565, BZ1501566
7ed636
- Fixes version migration logic
7ed636
- Fixes symlink issues to old binary
7ed636
- Fixes short ID analysis for images and containers
7ed636
- Fixes Docker library detection
7ed636
- Fixes image and container detection
7ed636
- Fixes registration execution flow
7ed636
- Fixes --version flag to print to stdout and include additional versioning information
7ed636
- Includes Insights Core 3.0.3-1
7ed636
7ed636
* Wed Oct 4 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.1-5
7ed636
- Resolves BZ1498581
7ed636
- Fixes sys.path issues
7ed636
- Includes Insights Core 3.0.2-6
7ed636
7ed636
* Wed Sep 27 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.0-4
7ed636
- Initial build