2021-07-01 11:57:55 +02:00
|
|
|
#
|
|
|
|
# spec file for package suseconnect-ng
|
|
|
|
#
|
2024-01-16 11:59:21 +01:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2021-07-01 11:57:55 +02:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2022-12-06 11:17:19 +01:00
|
|
|
|
2024-02-27 15:15:15 +01:00
|
|
|
%global project github.com/SUSE/connect-ng
|
2022-01-07 14:48:10 +01:00
|
|
|
|
2021-07-01 11:57:55 +02:00
|
|
|
Name: suseconnect-ng
|
2024-05-23 15:25:18 +02:00
|
|
|
Version: 1.10.0
|
2021-07-01 11:57:55 +02:00
|
|
|
Release: 0
|
|
|
|
URL: https://github.com/SUSE/connect-ng
|
2023-03-14 11:15:28 +01:00
|
|
|
License: LGPL-2.1-or-later
|
2023-07-07 16:46:27 +02:00
|
|
|
Summary: Utility to register a system with the SUSE Customer Center
|
2021-07-01 11:57:55 +02:00
|
|
|
Group: System/Management
|
2024-02-27 15:15:15 +01:00
|
|
|
Source: suseconnect-ng-%{version}.tar.xz
|
|
|
|
Source1: %{name}-rpmlintrc
|
2024-05-23 15:25:18 +02:00
|
|
|
Source2: vendor.tar.xz
|
2024-02-15 15:59:37 +01:00
|
|
|
|
|
|
|
# Build against latest golang in Tumbleweed and
|
2024-05-23 15:25:18 +02:00
|
|
|
# go1.21-openssl on all other distributions
|
2024-02-15 16:59:15 +01:00
|
|
|
%if 0%{?suse_version} > 1600
|
2024-02-15 15:59:37 +01:00
|
|
|
BuildRequires: golang(API)
|
|
|
|
%else
|
2024-02-27 15:15:15 +01:00
|
|
|
BuildRequires: go1.21-openssl
|
2024-02-15 15:59:37 +01:00
|
|
|
%endif
|
|
|
|
|
2022-12-06 10:44:58 +01:00
|
|
|
BuildRequires: ruby-devel
|
2022-12-06 11:17:19 +01:00
|
|
|
BuildRequires: zypper
|
2022-12-06 10:44:58 +01:00
|
|
|
|
2023-03-17 11:42:40 +01:00
|
|
|
ExcludeArch: %ix86 s390 ppc64
|
2022-01-07 14:48:10 +01:00
|
|
|
|
2023-03-17 11:42:40 +01:00
|
|
|
Obsoletes: SUSEConnect < 1.1.0
|
2023-08-03 15:34:33 +02:00
|
|
|
Provides: SUSEConnect = %version
|
2024-05-23 15:25:18 +02:00
|
|
|
Provides: suseconnect = %version
|
2021-12-01 15:43:57 +01:00
|
|
|
Obsoletes: zypper-migration-plugin < 0.99
|
|
|
|
Provides: zypper-migration-plugin = 0.99
|
|
|
|
Obsoletes: zypper-search-packages-plugin < 0.99
|
|
|
|
Provides: zypper-search-packages-plugin = 0.99
|
2024-02-27 15:15:15 +01:00
|
|
|
|
2022-12-13 14:02:02 +01:00
|
|
|
%if 0%{?suse_version}
|
2021-07-27 11:03:08 +02:00
|
|
|
Requires: ca-certificates-mozilla
|
2022-12-13 14:02:02 +01:00
|
|
|
%else
|
|
|
|
Requires: ca-certificates
|
2021-07-27 11:03:08 +02:00
|
|
|
%endif
|
2024-02-27 15:15:15 +01:00
|
|
|
|
2021-07-27 11:03:08 +02:00
|
|
|
Requires: coreutils
|
2024-05-23 15:25:18 +02:00
|
|
|
Requires: util-linux
|
|
|
|
Requires: zypper
|
|
|
|
Recommends: systemd
|
|
|
|
|
2021-07-27 11:03:08 +02:00
|
|
|
%ifarch s390x
|
|
|
|
Requires: s390-tools
|
|
|
|
%endif
|
2024-05-23 15:25:18 +02:00
|
|
|
|
|
|
|
# ExclusiveArch from this package
|
|
|
|
%ifarch ia64 x86_64 %arm aarch64
|
|
|
|
Requires: dmidecode
|
2021-07-27 11:03:08 +02:00
|
|
|
%endif
|
2021-07-01 11:57:55 +02:00
|
|
|
|
|
|
|
%description
|
|
|
|
This package provides a command line tool for connecting a
|
|
|
|
client system to the SUSE Customer Center. It will connect the system to your
|
|
|
|
product subscriptions and enable the product repositories/services locally.
|
2021-07-09 16:07:56 +02:00
|
|
|
suseconnect-ng reduces the size of its runtime dependencies compared to the
|
|
|
|
replaced SUSEConnect.
|
2021-07-01 11:57:55 +02:00
|
|
|
|
2021-12-01 15:43:57 +01:00
|
|
|
%package -n libsuseconnect
|
2022-09-12 17:29:03 +02:00
|
|
|
Summary: C interface to suseconnect-ng
|
2023-03-14 11:15:28 +01:00
|
|
|
Group: System/Management
|
2023-07-07 16:46:27 +02:00
|
|
|
# the CLI is not used by libsuseconnect but it has the same dependencies and it's easier to keep one list above
|
2024-05-23 15:25:18 +02:00
|
|
|
Requires: suseconnect-ng = %version
|
2022-12-13 14:02:02 +01:00
|
|
|
|
2021-12-01 15:43:57 +01:00
|
|
|
%description -n libsuseconnect
|
|
|
|
This package contains library which provides C interface to selected
|
|
|
|
suseconnect-ng functions.
|
|
|
|
|
|
|
|
%package -n suseconnect-ruby-bindings
|
2022-09-12 17:29:03 +02:00
|
|
|
Summary: Ruby bindings for libsuseconnect library
|
2021-12-01 15:43:57 +01:00
|
|
|
Group: System/Management
|
2024-05-23 15:25:18 +02:00
|
|
|
Requires: libsuseconnect = %version
|
2023-07-07 16:58:48 +02:00
|
|
|
# Adding the rubygem provides, to work as a drop-in replacement for Ruby SUSEConnect on SLE15<SP4
|
|
|
|
%if (0%{?sle_version} > 0 && 0%{?sle_version} < 150400)
|
|
|
|
Provides: rubygem(ruby:2.5.0:suse-connect)
|
|
|
|
%endif
|
2022-12-13 14:02:02 +01:00
|
|
|
|
2021-12-01 15:43:57 +01:00
|
|
|
%description -n suseconnect-ruby-bindings
|
|
|
|
This package provides bindings needed to use libsuseconnect from Ruby scripts.
|
|
|
|
|
2021-07-01 11:57:55 +02:00
|
|
|
%prep
|
2024-05-23 15:25:18 +02:00
|
|
|
%autosetup -p1 -a2 -n%{name}-%{version}
|
2021-07-01 11:57:55 +02:00
|
|
|
|
|
|
|
%build
|
2024-02-27 15:15:15 +01:00
|
|
|
# the binary
|
2021-07-23 12:55:42 +02:00
|
|
|
echo %{version} > internal/connect/version.txt
|
2024-05-23 15:25:18 +02:00
|
|
|
go build -v -ldflags "-s -w" -mod=vendor -buildmode=pie -o bin/suseconnect %{project}/cmd/suseconnect
|
|
|
|
go build -v -ldflags "-s -w" -mod=vendor -buildmode=pie -o bin/zypper-migration %{project}/cmd/zypper-migration
|
|
|
|
go build -v -ldflags "-s -w" -mod=vendor -buildmode=pie -o bin/zypper-search-packages %{project}/cmd/zypper-search-packages
|
2024-02-27 15:15:15 +01:00
|
|
|
|
|
|
|
# the library
|
2021-12-01 15:43:57 +01:00
|
|
|
mkdir -p %_builddir/go/lib
|
2024-05-23 15:25:18 +02:00
|
|
|
go build -v -ldflags "-s -w" -mod=vendor -buildmode=c-shared -o lib/libsuseconnect.so %{project}/third_party/libsuseconnect
|
2021-07-01 11:57:55 +02:00
|
|
|
|
|
|
|
%install
|
2024-02-27 15:15:15 +01:00
|
|
|
# Install binary + symlinks
|
|
|
|
install -D -m 0755 bin/suseconnect %{buildroot}/%{_bindir}/suseconnect
|
|
|
|
ln -s %{_bindir}/suseconnect %{buildroot}/%{_bindir}/SUSEConnect
|
2024-05-23 15:25:18 +02:00
|
|
|
|
|
|
|
install -d -m 0755 %{buildroot}/%{_sbindir}
|
2024-02-27 15:15:15 +01:00
|
|
|
ln -s %{_bindir}/suseconnect %{buildroot}/%{_sbindir}/SUSEConnect
|
2024-05-23 15:25:18 +02:00
|
|
|
|
|
|
|
install -d -m 0755 %{buildroot}/usr/lib/zypper/commands
|
|
|
|
install -D -m 0755 bin/zypper-search-packages %{buildroot}/usr/lib/zypper/commands/zypper-search-packages
|
|
|
|
install -D -m 0755 bin/zypper-migration %{buildroot}/usr/lib/zypper/commands/zypper-migration
|
2024-02-27 15:15:15 +01:00
|
|
|
|
|
|
|
# Install library + ruby bindings
|
|
|
|
install -D -m 0755 lib/libsuseconnect.so %{buildroot}/%{_libdir}/libsuseconnect.so
|
|
|
|
install -d -m 0755 %{buildroot}/%{_libdir}/ruby/vendor_ruby/%{rb_ver}
|
2024-05-23 15:25:18 +02:00
|
|
|
cp -r third_party/yast/lib/* %{buildroot}/%{_libdir}/ruby/vendor_ruby/%{rb_ver}
|
2024-02-27 15:15:15 +01:00
|
|
|
|
|
|
|
# Install metadata
|
2024-05-23 15:25:18 +02:00
|
|
|
install -D -m 644 docs/SUSEConnect.5 %{buildroot}/%{_mandir}/man5/SUSEConnect.5
|
|
|
|
install -D -m 644 docs/SUSEConnect.8 %{buildroot}/%{_mandir}/man8/SUSEConnect.8
|
|
|
|
install -D -m 644 docs/zypper-migration.8 %{buildroot}/%{_mandir}/man8/zypper-migration.8
|
|
|
|
install -D -m 644 docs/zypper-search-packages.8 %{buildroot}/%{_mandir}/man8/zypper-search-packages.8
|
2024-02-27 15:15:15 +01:00
|
|
|
install -D -m 644 SUSEConnect.example %{buildroot}%{_sysconfdir}/SUSEConnect.example
|
2021-07-01 11:57:55 +02:00
|
|
|
|
2022-08-05 15:42:43 +02:00
|
|
|
# Install the SUSEConnect --keepalive timer and service.
|
2024-05-23 15:25:18 +02:00
|
|
|
install -D -m 644 build/packaging/suseconnect-keepalive.timer %{buildroot}/%{_unitdir}/suseconnect-keepalive.timer
|
|
|
|
install -D -m 644 build/packaging/suseconnect-keepalive.service %{buildroot}/%{_unitdir}/suseconnect-keepalive.service
|
2024-02-27 15:15:15 +01:00
|
|
|
ln -sf service %{buildroot}/%{_sbindir}/rcsuseconnect-keepalive
|
2022-08-05 15:42:43 +02:00
|
|
|
|
2021-07-09 16:07:56 +02:00
|
|
|
# we currently do not ship the source for any go module
|
2024-02-27 15:15:15 +01:00
|
|
|
rm -rf %{buildroot}/usr/share/go
|
2021-07-01 11:57:55 +02:00
|
|
|
|
2022-08-05 15:42:43 +02:00
|
|
|
%pre
|
|
|
|
%service_add_pre suseconnect-keepalive.service suseconnect-keepalive.timer
|
|
|
|
|
|
|
|
# in pre blocks the old version is still installed. This way we can detect
|
|
|
|
# if --keepalive was already present before
|
|
|
|
kainfo=0
|
2022-12-06 10:44:58 +01:00
|
|
|
helptext=$(test -x "$(type -p SUSEConnect)" && SUSEConnect --help)
|
2022-08-05 15:42:43 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "$helptext" | grep -q keepalive
|
|
|
|
kainfo=$?
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $kainfo -ne 0 ]; then
|
|
|
|
cat << EOF
|
|
|
|
Empowering you with enriched system visibility in the SUSE Customer Center
|
|
|
|
|
|
|
|
SUSE is committed to helping provide better insights into the consumption of
|
|
|
|
SUSE subscriptions regardless of where they are running; physical or virtual,
|
|
|
|
on-prem or in the cloud.
|
|
|
|
|
|
|
|
SUSE has been working on several improvements to the SUSE Customer Center (SCC),
|
|
|
|
RMT, and SUSE Manager to provide a clearer picture of your system landscape:
|
|
|
|
|
|
|
|
- SUSE Manager v4.1+ now sends system information to SCC.
|
|
|
|
- SCC now captures which products are activated on systems that sit behind RMT
|
|
|
|
or SMT.
|
|
|
|
- This update will enable your system to "ping" SCC/RMT daily to
|
|
|
|
confirm the system's active status. This will help you identify or filter out
|
|
|
|
systems in SCC that are no longer running or decommissioned. As always, the
|
|
|
|
choice is yours, you can disable the daily ping by disabling the
|
|
|
|
suseconnect-keepalive systemd timer.
|
|
|
|
|
|
|
|
We will continue improving our products to make it easier for you to view and
|
|
|
|
manage your subscription consumption. As always, we'd love to hear your feedback
|
|
|
|
about these improvements and any ideas you might have.
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2023-06-07 08:16:00 +02:00
|
|
|
# If the keepalive timer exists on package install (not upgrade), then we are replacing SUSEConnect.
|
2024-02-27 15:15:15 +01:00
|
|
|
# Record the enabled and active statuses so they can be restored in posttrans macro.
|
2023-06-07 08:16:00 +02:00
|
|
|
if [ "$1" -eq 1 ]; then
|
|
|
|
/usr/bin/systemctl is-enabled suseconnect-keepalive.timer >/dev/null 2>&1 && touch /run/suseconnect-keepalive.timer.is-enabled || :
|
|
|
|
/usr/bin/systemctl is-active suseconnect-keepalive.timer >/dev/null 2>&1 && touch /run/suseconnect-keepalive.timer.is-active || :
|
|
|
|
fi
|
|
|
|
|
2022-08-05 15:42:43 +02:00
|
|
|
%post
|
2023-09-12 12:58:21 +02:00
|
|
|
# Randomize schedule time for SLES12. SLES12 systemd does not support RandomizedDelaySec.
|
|
|
|
%if (0%{?sle_version} > 0 && 0%{?sle_version} < 150000)
|
|
|
|
TIMER_HOUR=$(( RANDOM % 24 ))
|
|
|
|
TIMER_MINUTE=$(( RANDOM % 60 ))
|
|
|
|
sed -i '/RandomizedDelaySec*/d' %{_unitdir}/suseconnect-keepalive.timer
|
|
|
|
sed -i "s/OnCalendar=daily/OnCalendar=*-*-* $TIMER_HOUR:$TIMER_MINUTE:00/" %{_unitdir}/suseconnect-keepalive.timer
|
|
|
|
%endif
|
2022-08-05 15:42:43 +02:00
|
|
|
%service_add_post suseconnect-keepalive.service suseconnect-keepalive.timer
|
|
|
|
|
|
|
|
%preun
|
|
|
|
%service_del_preun suseconnect-keepalive.service suseconnect-keepalive.timer
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%service_del_postun suseconnect-keepalive.service suseconnect-keepalive.timer
|
|
|
|
|
2023-06-07 08:16:00 +02:00
|
|
|
%posttrans
|
|
|
|
if [ -e /run/suseconnect-keepalive.timer.is-enabled ]; then
|
|
|
|
/usr/bin/systemctl enable suseconnect-keepalive.timer >/dev/null 2>&1 || :
|
|
|
|
rm /run/suseconnect-keepalive.timer.is-enabled ||:
|
|
|
|
fi
|
|
|
|
if [ -e /run/suseconnect-keepalive.timer.is-active ]; then
|
|
|
|
/usr/bin/systemctl start suseconnect-keepalive.timer >/dev/null 2>&1 || :
|
|
|
|
rm /run/suseconnect-keepalive.timer.is-active ||:
|
|
|
|
fi
|
|
|
|
|
2021-07-09 16:07:56 +02:00
|
|
|
%files
|
2021-07-01 11:57:55 +02:00
|
|
|
%license LICENSE LICENSE.LGPL
|
|
|
|
%doc README.md
|
2024-02-27 15:15:15 +01:00
|
|
|
%{_bindir}/suseconnect
|
|
|
|
%{_bindir}/SUSEConnect
|
|
|
|
%{_sbindir}/SUSEConnect
|
|
|
|
%{_sbindir}/rcsuseconnect-keepalive
|
2021-08-28 00:54:32 +02:00
|
|
|
/usr/lib/zypper/commands
|
2024-02-27 15:15:15 +01:00
|
|
|
%{_mandir}/man8/*
|
|
|
|
%{_mandir}/man5/*
|
|
|
|
%{_unitdir}/suseconnect-keepalive.service
|
|
|
|
%{_unitdir}/suseconnect-keepalive.timer
|
2023-09-12 12:58:21 +02:00
|
|
|
%config %{_sysconfdir}/SUSEConnect.example
|
2021-07-01 11:57:55 +02:00
|
|
|
|
2021-12-01 15:43:57 +01:00
|
|
|
%files -n libsuseconnect
|
|
|
|
%license LICENSE LICENSE.LGPL
|
2024-02-27 15:15:15 +01:00
|
|
|
%{_libdir}/libsuseconnect.so
|
2021-12-01 15:43:57 +01:00
|
|
|
|
|
|
|
%files -n suseconnect-ruby-bindings
|
2024-05-23 15:25:18 +02:00
|
|
|
%doc third_party/yast/README.md
|
2024-02-27 15:15:15 +01:00
|
|
|
%{_libdir}/ruby/vendor_ruby/%rb_ver/suse
|
2022-12-06 11:17:19 +01:00
|
|
|
|
2022-12-13 14:02:02 +01:00
|
|
|
%changelog
|