# This RPM spec file exists primarily to enable CI/CD pipelines and automatic # testing of built RPMs. This RPM can be used as a suitable baseline for a # proper distribution package, but changes should be made to suit the needs of # the package. %define debug_package %{nil} %define source_date_epoch_from_changelog 0 %global has_go_rpm_macros (0%{?fedora}) # must be before %%gometa Version: 0.2.4 # https://github.com/redhatinsights/rhc %global goipath github.com/redhatinsights/rhc %global commit 011f7b1aa505563113d5fba87b23510df0f496f6 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global date %(date "+%Y%m%d") %global archivename rhc-%{version} %if %{has_go_rpm_macros} %gometa %{?fedora:-f} %else %global gourl https://github.com/RedHatInsights/%{name} %global gomodulesmode GO111MODULES=off %global gosource %{gourl}/releases/download/%{version}/rhc-%{version}.tar.gz %global gocompilerflags "-buildmode pie -compiler gc" %global scm git %forgemeta %endif Name: rhc Release: 99%{?dist} Epoch: 1 Summary: Client for registering Red Hat Enterprise Linux systems License: GPL-3.0-only URL: %{gourl} Source0: %{gosource} ExclusiveArch: %{go_arches} Requires: insights-client Requires: yggdrasil >= 0.4 Requires: yggdrasil-worker-package-manager Requires: subscription-manager BuildRequires: golang BuildRequires: dbus-devel BuildRequires: systemd-devel BuildRequires: systemd %description rhc is a client that registers a system with RHSM and activates the Red Hat yggd MQTT client. %package compat Summary: Transition package to support migrating from rhcd to yggd Requires: yggdrasil >= 0.4.2 Recommends: rhc %description compat Transition package to support migrating from rhcd to yggd. %prep %forgesetup %build make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ SERVICENAME=yggdrasil \ 'PROVIDER=Red Hat' %install make PREFIX=%{_prefix} \ SYSCONFDIR=%{_sysconfdir} \ LOCALSTATEDIR=%{_localstatedir} \ DESTDIR=%{buildroot} \ SHORTNAME=rhc \ LONGNAME=rhc \ PKGNAME=rhc \ TOPICPREFIX=redhat/insights \ VERSION=%{version} \ DATAHOST=cert.cloud.redhat.com \ SERVICENAME=yggdrasil \ 'PROVIDER=Red Hat' \ install install --directory %{buildroot}%{_unitdir} install --directory %{buildroot}%{_sysconfdir}/rhc ln -sf yggdrasil.service %{buildroot}%{_unitdir}/rhcd.service ln -sf ../yggdrasil/config.toml %{buildroot}%{_sysconfdir}/rhc/config.toml %post %systemd_post rhc-canonical-facts.timer if [ $1 -eq 1 ]; then systemctl daemon-reload systemctl start rhc-canonical-facts.timer fi %preun %systemd_preun rhc-canonical-facts.timer %postun %systemd_postun_with_restart rhc-canonical-facts.timer if [ $1 -eq 0 ]; then systemctl daemon-reload fi %files %doc README.md %{_bindir}/rhc %{_datadir}/bash-completion/completions/* %{_mandir}/man1/* %{_unitdir}/* %files compat %{_unitdir}/rhcd.service %{_sysconfdir}/rhc/config.toml %changelog %if (0%{?fedora} || 0%{?rhel} >= 9) %autochangelog %endif