From b04dd5e7df6c10843fd9999907ee8bcb1db90c6a Mon Sep 17 00:00:00 2001 From: Sofia Boldyreva Date: Mon, 3 Feb 2025 16:06:04 +0100 Subject: [PATCH] Initial commit --- config.yaml | 147 ++++++++++++++++++ files/subscription-manager-debrand.patch | 56 +++++++ ...scription-manager-remove-redhat.repo.patch | 16 ++ files/use-almalinux-syspurposes.patch | 20 +++ 4 files changed, 239 insertions(+) create mode 100644 config.yaml create mode 100644 files/subscription-manager-debrand.patch create mode 100644 files/subscription-manager-remove-redhat.repo.patch create mode 100644 files/use-almalinux-syspurposes.patch diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..541d8bd --- /dev/null +++ b/config.yaml @@ -0,0 +1,147 @@ +actions: + - replace: + - target: "spec" + find: "%global use_initial_setup 1" + replace: "%global use_initial_setup 0" + count: 1 + - target: "spec" + find: "%global use_rhsm_gtk 1" + replace: "%global use_rhsm_gtk 0" + count: 1 + - target: "spec" + find: "%global use_cockpit 0%{?fedora} || 0%{?rhel} >= 7" + replace: "%global use_cockpit 0" + count: 1 + - target: "spec" + find: | + %if !%{use_container_plugin} + Obsoletes: subscription-manager-plugin-container + %endif + replace: | + # AlmaLinux do not provide the following packages no more + Obsoletes: subscription-manager-cockpit + Obsoletes: subscription-manager-initial-setup-addon + Obsoletes: rhsm-gtk + Obsoletes: rhsm-icons + count: 1 + - target: "spec" + find: "to manage subscriptions and yum repositories from the Red Hat entitlement" + replace: "to manage subscriptions and yum repositories from the EL entitlement" + count: 1 + - target: "spec" + find: "Summary: A GUI interface to manage Red Hat product subscriptions" + replace: "Summary: A GUI interface to manage product subscriptions" + count: 1 + - target: "spec" + find: "registering a system with a Red Hat Entitlement platform and manage" + replace: "registering a system with a Entitlement platform and manage" + count: 1 + - target: "spec" + find: "from the Red Hat entitlement platform; contains subscription-manager and" + replace: "from the entitlement platform; contains subscription-manager and" + count: 1 + - target: "spec" + find: | + %if (0%{?rhel} >= 8) + Supplements: initial-setup-gui + %endif + replace: | + %if %{undefined almalinux_ver} + %if (0%{?rhel} >= 8) + Supplements: initial-setup-gui + %endif + %endif + count: 1 + - target: "spec" + find: "Summary: A Python library to communicate with a Red Hat Unified Entitlement Platform" + replace: "Summary: A Python library to communicate with a Unified Entitlement Platform" + count: 2 + - target: "spec" + find: "A small library for communicating with the REST interface of a Red Hat Unified" + replace: "A small library for communicating with the REST interface of a Unified" + count: 2 + - target: "spec" + find: "Summary: Certificates required to communicate with a Red Hat Unified Entitlement Platform" + replace: "Summary: Certificates required to communicate with a Unified Entitlement Platform" + count: 1 + - target: "spec" + find: "of a Red Hat Unified Entitlement Platform, used for the management of system entitlements" + replace: "of a Unified Entitlement Platform, used for the management of system entitlements" + count: 1 + - target: "spec" + find: "Summary: Icons for Red Hat Subscription Management client tools" + replace: "Summary: Icons for Subscription Management client tools" + - target: "spec" + find: "of Red Hat subscriptions. There are many such interfaces, subscription-manager-gui," + replace: "of subscriptions. There are many such interfaces, subscription-manager-gui," + count: 1 + - target: "spec" + find: | + %if %{use_yum} || %{use_dnf} + mkdir %{buildroot}%{_sysconfdir}/yum.repos.d + touch %{buildroot}%{_sysconfdir}/yum.repos.d/redhat.repo + %endif + replace: | + %if %{use_yum} || %{use_dnf} + mkdir %{buildroot}%{_sysconfdir}/yum.repos.d + %if %{undefined almalinux_ver} + touch %{buildroot}%{_sysconfdir}/yum.repos.d/redhat.repo + %endif + %endif + count: 1 + - target: "spec" + find: | + mkdir %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com + install -m 644 %{_builddir}/%{buildsubdir}/src/content_plugins/redhat-entitlement-authority.pem %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + replace: | + %if %{undefined almalinux_ver} + mkdir %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com + install -m 644 %{_builddir}/%{buildsubdir}/src/content_plugins/redhat-entitlement-authority.pem %{buildroot}%{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + %endif + count: 1 + - target: "spec" + find: "# base/cli tools use the gettext domain 'rhsm', while the" + replace: | + %if %{defined almalinux_ver} + sed -e '/^enabled=/ s/1/0/' -i %{buildroot}%{_sysconfdir}/dnf/plugins/subscription-manager.conf + %endif + + # base/cli tools use the gettext domain 'rhsm', while the + count: 1 + - target: "spec" + find: | + # Copying Red Hat CA cert into each directory: + %attr(755,root,root) %dir %{_sysconfdir}/docker/certs.d/cdn.redhat.com + %attr(644,root,root) %{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + replace: | + %if %{undefined almalinux_ver} + # Copying Red Hat CA cert into each directory: + %attr(755,root,root) %dir %{_sysconfdir}/docker/certs.d/cdn.redhat.com + %attr(644,root,root) %{_sysconfdir}/docker/certs.d/cdn.redhat.com/redhat-entitlement-authority.crt + %endif + %endif + count: 1 + + - modify_release: + - suffix: ".alma.1" + enabled: true + + - changelog_entry: + - name: "Eduard Abdullin" + email: "eabdullin@almalinux.org" + line: + - "AlmaLinux changes" + + - add_files: + - type: "patch" + name: "use-almalinux-syspurposes.patch" + number: 100 + - type: "patch" + name: "subscription-manager-remove-redhat.repo.patch" + number: 101 + - type: "patch" + name: "subscription-manager-debrand.patch" + number: 102 diff --git a/files/subscription-manager-debrand.patch b/files/subscription-manager-debrand.patch new file mode 100644 index 0000000..34b8933 --- /dev/null +++ b/files/subscription-manager-debrand.patch @@ -0,0 +1,56 @@ +diff -aruN subscription-manager-1.28.29/etc-conf/rhsm-icon.desktop.in subscription-manager-1.28.29.alma/etc-conf/rhsm-icon.desktop.in +--- subscription-manager-1.28.29/etc-conf/rhsm-icon.desktop.in 2022-04-13 18:01:03.000000000 +0300 ++++ subscription-manager-1.28.29.alma/etc-conf/rhsm-icon.desktop.in 2022-05-10 19:54:31.000000000 +0300 +@@ -1,6 +1,6 @@ + + [Desktop Entry] +-_Name=Red Hat Subscription Validity Applet ++_Name=Subscription Validity Applet + Icon=subscription-manager + Exec=rhsm-icon + Terminal=false +diff -aruN subscription-manager-1.28.29/etc-conf/subscription-manager-cockpit.desktop.in subscription-manager-1.28.29.alma/etc-conf/subscription-manager-cockpit.desktop.in +--- subscription-manager-1.28.29/etc-conf/subscription-manager-cockpit.desktop.in 2022-04-13 18:01:03.000000000 +0300 ++++ subscription-manager-1.28.29.alma/etc-conf/subscription-manager-cockpit.desktop.in 2022-05-10 19:54:57.000000000 +0300 +@@ -1,5 +1,5 @@ + [Desktop Entry] +-_Name=Red Hat Subscription Manager ++_Name=Subscription Manager + Icon=subscription-manager + Type=Application + TryExec=/usr/libexec/cockpit-desktop +diff -aruN subscription-manager-1.28.29/etc-conf/subscription-manager-gui.desktop.in subscription-manager-1.28.29.alma/etc-conf/subscription-manager-gui.desktop.in +--- subscription-manager-1.28.29/etc-conf/subscription-manager-gui.desktop.in 2022-04-13 18:01:03.000000000 +0300 ++++ subscription-manager-1.28.29.alma/etc-conf/subscription-manager-gui.desktop.in 2022-05-10 19:55:18.000000000 +0300 +@@ -1,5 +1,5 @@ + [Desktop Entry] +-_Name=Red Hat Subscription Manager ++_Name=Subscription Manager + Icon=subscription-manager + Exec=subscription-manager-gui + Terminal=false +diff -aruN subscription-manager-1.28.29/src/subscription_manager/migrate/migrate.py subscription-manager-1.28.29.alma/src/subscription_manager/migrate/migrate.py +--- subscription-manager-1.28.29/src/subscription_manager/migrate/migrate.py 2022-04-13 18:01:03.000000000 +0300 ++++ subscription-manager-1.28.29.alma/src/subscription_manager/migrate/migrate.py 2022-05-10 19:59:46.000000000 +0300 +@@ -278,8 +278,7 @@ + if self.options.five_to_six: + msgs = [_("This system appears to already be registered to Satellite 6.")] + else: +- msgs = [_("This system appears to already be registered to Red Hat Subscription Management.")] +- msgs.append(_("Please visit https://access.redhat.com/management/consumers/%s to view the profile details.") % identity.uuid) ++ msgs = [_("This system appears to already be registered to Subscription Management.")] + system_exit(1, msgs) + + try: +diff -aruN subscription-manager-1.28.29/src/subscription_manager/repolib.py subscription-manager-1.28.29.alma/src/subscription_manager/repolib.py +--- subscription-manager-1.28.29/src/subscription_manager/repolib.py 2022-04-13 18:01:03.000000000 +0300 ++++ subscription-manager-1.28.29.alma/src/subscription_manager/repolib.py 2022-05-10 20:01:44.000000000 +0300 +@@ -87,7 +87,7 @@ + @staticmethod + def warning_message(enabled_yum_plugins): + message = _('The yum/dnf plugins: %s were automatically enabled for the benefit of ' +- 'Red Hat Subscription Management. If not desired, use ' ++ 'Subscription Management. If not desired, use ' + '"subscription-manager config --rhsm.auto_enable_yum_plugins=0" to ' + 'block this behavior.') % ', '.join(enabled_yum_plugins) + return message diff --git a/files/subscription-manager-remove-redhat.repo.patch b/files/subscription-manager-remove-redhat.repo.patch new file mode 100644 index 0000000..0001d86 --- /dev/null +++ b/files/subscription-manager-remove-redhat.repo.patch @@ -0,0 +1,16 @@ +diff -Nurp subscription-manager-1.27.11.orig/src/subscription_manager/repofile.py subscription-manager-1.27.11/src/subscription_manager/repofile.py +--- subscription-manager-1.27.11.orig/src/subscription_manager/repofile.py 2020-07-28 11:06:10.000000000 -0500 ++++ subscription-manager-1.27.11/src/subscription_manager/repofile.py 2020-08-05 16:48:00.911709258 -0500 +@@ -368,11 +368,7 @@ class RepoFileBase(object): + Try to create new repo file. + :return: None + """ +- self.create_dir_path() +- if self.path_exists(self.path) or not self.manage_repos: +- return +- with open(self.path, 'w') as f: +- f.write(self.REPOFILE_HEADER) ++ pass + + def fix_content(self, content): + return content diff --git a/files/use-almalinux-syspurposes.patch b/files/use-almalinux-syspurposes.patch new file mode 100644 index 0000000..2cfced4 --- /dev/null +++ b/files/use-almalinux-syspurposes.patch @@ -0,0 +1,20 @@ +diff --git a/etc-conf/syspurpose/valid_fields.json b/etc-conf/syspurpose/valid_fields.json +index 1ac7ea0e..305ec4b9 100644 +--- a/etc-conf/syspurpose/valid_fields.json ++++ b/etc-conf/syspurpose/valid_fields.json +@@ -1,12 +1,10 @@ + { + "role": [ +- "Red Hat Enterprise Linux Server", +- "Red Hat Enterprise Linux Workstation", +- "Red Hat Enterprise Linux Compute Node" ++ "AlmaLinux Server", ++ "AlmaLinux Workstation", ++ "AlmaLinux Compute Node" + ], + "service_level_agreement": [ +- "Premium", +- "Standard", + "Self-Support" + ], + "usage": [