diff --git a/.gitignore b/.gitignore
index 50876d0..fda49dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-SOURCES/rhc-0.2.0.tar.gz
+SOURCES/rhc-0.2.4.tar.gz
+SOURCES/yggdrasil-0.2.2.tar.gz
+SOURCES/yggdrasil-worker-package-manager-0.1.0.tar.gz
diff --git a/.rhc.metadata b/.rhc.metadata
index b1110d3..caff331 100644
--- a/.rhc.metadata
+++ b/.rhc.metadata
@@ -1 +1,3 @@
-8f9f437c9d7ee2afe09b2000aa77fd384fc91d2f SOURCES/rhc-0.2.0.tar.gz
+d86980ee8506b164209dbd991df36199922d8592 SOURCES/rhc-0.2.4.tar.gz
+24ff87c13112e673d81fd71858bf61da1dceb60b SOURCES/yggdrasil-0.2.2.tar.gz
+0582350e1001af0d608772860045f7f4964aa321 SOURCES/yggdrasil-worker-package-manager-0.1.0.tar.gz
diff --git a/SOURCES/0001-feat-default-config-file-location.patch b/SOURCES/0001-feat-default-config-file-location.patch
new file mode 100644
index 0000000..8bc3f8c
--- /dev/null
+++ b/SOURCES/0001-feat-default-config-file-location.patch
@@ -0,0 +1,28 @@
+--- main.go.orig 2022-02-11 15:41:53.199642591 -0500
++++ main.go 2022-02-11 15:42:43.738219604 -0500
+@@ -6,6 +6,7 @@
+ "fmt"
+ "net"
+ "os"
++ "path/filepath"
+ "strconv"
+ "strings"
+ "time"
+@@ -21,7 +22,7 @@
+ )
+
+ func main() {
+- fs := flag.NewFlagSet("yggd-package-manager-worker", flag.ExitOnError)
++ fs := flag.NewFlagSet(filepath.Base(os.Args[0]), flag.ExitOnError)
+
+ var (
+ socketAddr = ""
+@@ -32,7 +33,7 @@
+ fs.StringVar(&socketAddr, "socket-addr", "", "dispatcher socket address")
+ fs.Var(&logLevel, "log-level", "log verbosity level (error (default), warn, info, debug, trace)")
+ fs.Var(&allowPatterns, "allow-pattern", "regular expression pattern to allow package operations\n(can be specified multiple times)")
+- _ = fs.String("config", "", "path to `file` containing configuration values (optional)")
++ _ = fs.String("config", filepath.Join("/", "etc", "rhc", "workers", "rhc-package-manager.toml"), "path to `file` containing configuration values (optional)")
+
+ ff.Parse(fs, os.Args[1:], ff.WithEnvVarPrefix("YGG"), ff.WithConfigFileFlag("config"), ff.WithConfigFileParser(fftoml.Parser))
+
\ No newline at end of file
diff --git a/SOURCES/0001-revert-drop-enable_content-option.patch b/SOURCES/0001-revert-drop-enable_content-option.patch
new file mode 100644
index 0000000..3ac5653
--- /dev/null
+++ b/SOURCES/0001-revert-drop-enable_content-option.patch
@@ -0,0 +1,30 @@
+From b04e4e5014d0f23e9c0c13e5858bc946b69e4c5a Mon Sep 17 00:00:00 2001
+From: Link Dupont
+Date: Tue, 12 Sep 2023 10:46:31 -0400
+Subject: [PATCH] revert: drop "enable_content" option
+
+Revert ab0b7f95e494634a121ccc3bd286c605d07fea27. The "enable_content"
+key is not supported in older versions of subscription-manager.
+
+Refs: ab0b7f95e494634a121ccc3bd286c605d07fea27
+Signed-off-by: Link Dupont
+---
+ register.go | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/register.go b/register.go
+index 348b79c..6c213ba 100644
+--- a/register.go
++++ b/register.go
+@@ -126,7 +126,7 @@ func registerUsernamePassword(username, password, organization, serverURL string
+ organization,
+ username,
+ password,
+- map[string]string{"enable_content": "true"},
++ map[string]string{},
+ map[string]string{},
+ "").Err; err != nil {
+
+--
+2.41.0
+
diff --git a/SOURCES/Use-gzip-c-instead-of-k.patch b/SOURCES/Use-gzip-c-instead-of-k.patch
deleted file mode 100644
index 812f152..0000000
--- a/SOURCES/Use-gzip-c-instead-of-k.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 975b142e53608f3b218ee964bd28e1f4dfdde335 Mon Sep 17 00:00:00 2001
-From: Link Dupont
-Date: Fri, 14 May 2021 14:54:44 -0400
-Subject: [PATCH] build: Use gzip -c instead of -k
-
-The '-k' option was added in a later version of gzip.
-
-Signed-off-by: Link Dupont
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 2cf6b88..0bc0efc 100644
---- a/Makefile
-+++ b/Makefile
-@@ -95,7 +95,7 @@ data: $(DATA)
- go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" ./cmd/$(patsubst %.1,%,$@) --generate-man-page > $@
-
- %.1.gz: %.1
-- gzip -k $^
-+ gzip -c $^ > $@.tmp && mv $@.tmp $@
-
- %-USAGE.md: $(GOSRC)
- go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" ./cmd/$(patsubst %-USAGE.md,%,$@) --generate-markdown > $@
diff --git a/SOURCES/build-Remove-the-Makefile-preamble.patch b/SOURCES/build-Remove-the-Makefile-preamble.patch
deleted file mode 100644
index bb503b9..0000000
--- a/SOURCES/build-Remove-the-Makefile-preamble.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 56f26e01049ddfad13ded0edbbf5c60a3246720d Mon Sep 17 00:00:00 2001
-From: Link Dupont
-Date: Fri, 14 May 2021 14:55:06 -0400
-Subject: [PATCH] build: Remove the Makefile preamble
-
-Signed-off-by: Link Dupont
----
- Makefile | 9 ---------
- 1 file changed, 9 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 0bc0efc..f1f4380 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,12 +1,3 @@
--SHELL := bash
--.ONESHELL:
--.SHELLFLAGS := -eu -o pipefail -c
--.DELETE_ON_ERROR:
--MAKEFLAGS += --warn-undefined-variables
--MAKEFLAGS += --no-builtin-rules
--.POSIX:
--.SUFFIXES:
--
- # Project variables
-
- # Used as a prefix to binary names. Cannot contain spaces.
diff --git a/SOURCES/config.toml b/SOURCES/config.toml
index b6fc5be..5e34c30 100644
--- a/SOURCES/config.toml
+++ b/SOURCES/config.toml
@@ -1,4 +1,4 @@
-# yggdrasil global configuration settings
+# rhc global configuration settings
broker = ["wss://connect.cloud.redhat.com:443"]
cert-file = "/etc/pki/consumer/cert.pem"
diff --git a/SOURCES/rhc-package-manager.toml b/SOURCES/rhc-package-manager.toml
new file mode 100644
index 0000000..1abdda4
--- /dev/null
+++ b/SOURCES/rhc-package-manager.toml
@@ -0,0 +1,5 @@
+# regular expression patterns to allow package operations
+allow-pattern = ["^rhc-worker-playbook$"]
+
+# log verbosity level (error (default), warn, info, debug, trace)
+log-level = "error"
diff --git a/SOURCES/rhc-patch-Makefile.patch b/SOURCES/rhc-patch-Makefile.patch
new file mode 100644
index 0000000..f4151e5
--- /dev/null
+++ b/SOURCES/rhc-patch-Makefile.patch
@@ -0,0 +1,25 @@
+diff -urN rhc-0.2.4.orig/Makefile rhc-0.2.4/Makefile
+--- rhc-0.2.4.orig/Makefile 2023-08-01 05:37:07.000000000 -0400
++++ rhc-0.2.4/Makefile 2023-08-30 12:25:02.357010969 -0400
+@@ -1,12 +1,3 @@
+-SHELL := bash
+-.ONESHELL:
+-.SHELLFLAGS := -eu -o pipefail -c
+-.DELETE_ON_ERROR:
+-MAKEFLAGS += --warn-undefined-variables
+-MAKEFLAGS += --no-builtin-rules
+-.POSIX:
+-.SUFFIXES:
+-
+ # Project variables
+
+ # Used as a prefix to binary names. Cannot contain spaces.
+@@ -90,7 +81,7 @@
+ go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" . --generate-man-page > $@
+
+ %.1.gz: %.1
+- gzip -k -f $^
++ gzip -c -f $^ > $@.tmp && mv $@.tmp $@
+
+ USAGE.md: $(GOSRC)
+ go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" . --generate-markdown > $@
diff --git a/SOURCES/yggdrasil-patch-Makefile.patch b/SOURCES/yggdrasil-patch-Makefile.patch
new file mode 100644
index 0000000..ed4b221
--- /dev/null
+++ b/SOURCES/yggdrasil-patch-Makefile.patch
@@ -0,0 +1,24 @@
+--- yggdrasil-0.2.2.orig/Makefile 2023-06-21 11:34:14.000000000 -0400
++++ yggdrasil-0.2.2/Makefile 2023-08-30 12:21:48.611686392 -0400
+@@ -1,12 +1,3 @@
+-SHELL := bash
+-.ONESHELL:
+-.SHELLFLAGS := -eu -o pipefail -c
+-.DELETE_ON_ERROR:
+-MAKEFLAGS += --warn-undefined-variables
+-MAKEFLAGS += --no-builtin-rules
+-.POSIX:
+-.SUFFIXES:
+-
+ # Project variables
+
+ # Used as a prefix to binary names. Cannot contain spaces.
+@@ -99,7 +90,7 @@
+ go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" ./cmd/$(patsubst %.1,%,$@) --generate-man-page > $@
+
+ %.1.gz: %.1
+- gzip -k $^
++ gzip -c $^ > $@.tmp && mv $@.tmp $@
+
+ %-USAGE.md: $(GOSRC)
+ go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" ./cmd/$(patsubst %-USAGE.md,%,$@) --generate-markdown > $@
diff --git a/SPECS/rhc.spec b/SPECS/rhc.spec
index 18c2a75..b3173e6 100644
--- a/SPECS/rhc.spec
+++ b/SPECS/rhc.spec
@@ -1,81 +1,122 @@
%define debug_package %{nil}
+%global buildflags -buildmode pie -compiler gc -a -v -x
+%global goldflags %{expand:-linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'}
%global go_arches x86_64 s390x ppc64le
+%global yggdrasil_ver 0.2.2
+%global ygg_pkg_mgr_ver 0.1.0
+
Name: rhc
-Version: 0.2.0
-Release: 3%{?dist}
+Version: 0.2.4
+Release: 1%{?dist}
Epoch: 1
-Summary: Message dispatch agent for cloud-connected systems
+Summary: rhc connects the system to Red Hat hosted services
License: GPLv3
-URL: https://github.com/redhatinsights/yggdrasil
+URL: https://github.com/RedHatInsights/rhc
-Source0: %{name}-%{version}.tar.gz
+Source0: https://github.com/RedHatInsights/rhc/releases/download/%{version}/%{name}-%{version}.tar.gz
Source1: config.toml
+Source2: https://github.com/RedHatInsights/yggdrasil/releases/download/%{yggdrasil_ver}/yggdrasil-%{yggdrasil_ver}.tar.gz
+Source3: https://github.com/RedHatInsights/yggdrasil-worker-package-manager/releases/download/%{ygg_pkg_mgr_ver}/yggdrasil-worker-package-manager-%{ygg_pkg_mgr_ver}.tar.gz
+Source4: rhc-package-manager.toml
-Patch0: Use-gzip-c-instead-of-k.patch
-Patch1: build-Remove-the-Makefile-preamble.patch
+# Remove Makefile preamble and use gzip -c instead of -k
+Patch0: yggdrasil-patch-Makefile.patch
+Patch1: rhc-patch-Makefile.patch
+Patch2: 0001-feat-default-config-file-location.patch
+Patch3: 0001-revert-drop-enable_content-option.patch
ExclusiveArch: %{go_arches}
+Requires: insights-client
+
+%global go_toolset_version 1.19
BuildRequires: git
-BuildRequires: go-toolset-1.16-golang
+BuildRequires: go-toolset-%{go_toolset_version}-golang
BuildRequires: dbus-devel
BuildRequires: systemd-devel
+%define _description %{expand:%{name} is a client tool and daemon that connects
+the system to Red Hat hosted services enabling system and subscription
+management.}
+
%description
-%{name} is pair of utilities that register systems with RHSM and establishes
-a receiving queue for instructions to be sent to the system via a broker.
+%{_description}
-%prep
-%autosetup -p1
+%global makeflags %{expand:PREFIX=%{_prefix} \\
+ SYSCONFDIR=%{_sysconfdir} \\
+ LOCALSTATEDIR=%{_localstatedir} \\
+ SHORTNAME=%{name} \\
+ LONGNAME=%{name} \\
+ PKGNAME=%{name} \\
+ 'BRANDNAME=Remote Host Configuration' \\
+ TOPICPREFIX=redhat/insights \\
+ VERSION=%{version} \\
+ DATAHOST=cert.cloud.redhat.com \\
+ 'PROVIDER=Red Hat'}
-%global ldflags %{expand:-linkmode=external -compressdwarf=false -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'}
-%global buildflags %{expand:-compiler gc -buildmode pie -tags=\\"rpm_crashtraceback libtrust_openssl\\" -ldflags \\"%ldflags\\" -a -v -x %{?**}}
+
+%prep
+%setup -q -T -D -c -n %{name} -a 0
+%setup -q -T -D -c -n %{name} -a 2
+%setup -q -T -D -c -n %{name} -a 3
+sed -i -e "s/LDFLAGS :=/LDFLAGS ?=/" %{_builddir}/%{name}/yggdrasil-%{yggdrasil_ver}/Makefile
+sed -i -e "s/LDFLAGS :=/LDFLAGS ?=/" %{_builddir}/%{name}/%{name}-%{version}/Makefile
+cd %{_builddir}/%{name}/yggdrasil-%{yggdrasil_ver}
+%patch -P 0 -p1
+cd %{_builddir}/%{name}/%{name}-%{version}
+%patch -P 1 -p1
+%patch -P 3 -p1
+cd %{_builddir}/%{name}/yggdrasil-worker-package-manager
+%patch -P 2 -p0
%build
-CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" \
-BUILDFLAGS="%buildflags" \
-scl enable go-toolset-1.16 -- \
-make PREFIX=%{_prefix} \
- SYSCONFDIR=%{_sysconfdir} \
- LOCALSTATEDIR=%{_localstatedir} \
- SHORTNAME=%{name} \
- LONGNAME=%{name} \
- PKGNAME=%{name} \
- 'BRANDNAME=Red Hat connector' \
- TOPICPREFIX=redhat/insights \
- VERSION=%{version} \
- DATAHOST=cert.cloud.redhat.com \
- 'PROVIDER=Red Hat'
+export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all"
+export BUILDFLAGS="%{buildflags}"
+export LDFLAGS="%{goldflags}"
+cd %{_builddir}/%{name}/yggdrasil-%{yggdrasil_ver}
+scl enable go-toolset-%{go_toolset_version} -- \
+make %{makeflags}
+
+cd %{_builddir}/%{name}/yggdrasil-worker-package-manager
+scl enable go-toolset-%{go_toolset_version} -- \
+go build %{buildflags} -ldflags="%{goldflags}" -o rhc-package-manager-worker -mod=vendor .
+
+cd %{_builddir}/%{name}/%{name}-%{version}
+scl enable go-toolset-%{go_toolset_version} -- \
+make %{makeflags}
%install
-CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" \
-BUILDFLAGS="%buildflags" \
-scl enable go-toolset-1.16 -- \
-make PREFIX=%{_prefix} \
- SYSCONFDIR=%{_sysconfdir} \
- LOCALSTATEDIR=%{_localstatedir} \
+export CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all"
+export BUILDFLAGS="%{buildflags}"
+export LDFLAGS="%{goldflags}"
+cd %{_builddir}/%{name}/yggdrasil-%{yggdrasil_ver}
+scl enable go-toolset-%{go_toolset_version} -- \
+make %{makeflags} \
DESTDIR=%{buildroot} \
- SHORTNAME=%{name} \
- LONGNAME=%{name} \
- PKGNAME=%{name} \
- 'BRANDNAME=Red Hat connector' \
- TOPICPREFIX=redhat/insights \
- VERSION=%{version} \
- DATAHOST=cert.cloud.redhat.com \
- 'PROVIDER=Red Hat' \
install
+
%{__install} -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}/
+cd %{_builddir}/%{name}/yggdrasil-worker-package-manager
+%{__install} -D -m 755 rhc-package-manager-worker %{buildroot}%{_libexecdir}/%{name}/
+%{__install} -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}/workers/rhc-package-manager.toml
+
+cd %{_builddir}/%{name}/%{name}-%{version}
+make %{makeflags} \
+ DESTDIR=%{buildroot} \
+ install
+
%files
-%doc README.md
+%doc %{name}-%{version}/README.md yggdrasil-%{yggdrasil_ver}/doc/tags.toml
%{_bindir}/%{name}
%{_sbindir}/%{name}d
%config(noreplace) %{_sysconfdir}/%{name}/config.toml
+%config(noreplace) %{_sysconfdir}/%{name}/workers/rhc-package-manager.toml
%{_unitdir}/%{name}d.service
%{_datadir}/bash-completion/completions/*
%{_mandir}/man1/*
@@ -84,6 +125,12 @@ make PREFIX=%{_prefix} \
%changelog
+* Wed Aug 30 2023 Link Dupont - 0.2.4-1
+- Update rhc to 0.2.4 (RHBZ#2227142)
+- Update yggdrasion to 0.2.2 (RHBZ#2227142)
+- Include rhc-worker-package-manager
+- Rebuild with Go 1.19
+
* Mon Oct 24 2022 Link Dupont - 0.2.0-3
- Rebuild with Go 1.16 (RHBZ#2028560)