File openSUSE-build-key-tigro.spec of Package openSUSE-build-key-tigro

#
# spec file for package openSUSE-build-key
#
# Copyright (c) 2025 SUSE LLC
#
# 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/
#
# needspubkeyforbuild


%define keydir  %{_prefix}/lib/rpm/gnupg/keys/

Name:           openSUSE-build-key-tigro
Version:        1.0
Release:        1
Summary:        The public gpg keys for rpm package signature verification
License:        GPL-2.0-or-later
Group:          System/Packages
URL:            https://en.opensuse.org/openSUSE:Security_team
Source:         key2rpmname

# ashejn@gmail.com
Source10:       gpg-pubkey-828a2021-69578d44.asc
Source11:	gpg-pubkey-c3207923-6957ed12.asc

# Auto Import handling via systemd timer + service.
# Needed in Leap currently, but also have it here.
Source101:      import-openSUSE-build-key-tigro
Source102:      %name-import.service
Source103:      %name-import.timer

BuildRequires:  gpg
Conflicts:      suse-build-key
Provides:       build-key = %{version}
BuildRequires:  systemd-rpm-macros

%description
This package contains the gpg keys that are used to sign the
openSUSE rpm packages. The keys installed here are not actually
used by anything. rpm/zypper use the keys in the rpm db instead.

%prep
%setup -qcT

%build

%install
mkdir -p %{buildroot}%{keydir}
for i in %{SOURCE10} %{SOURCE11} \
; do
    case "$i" in
	*/gpg-pubkey-*.asc)
	install -m 644 "$i" %{buildroot}%{keydir}
	;;
    esac
done
if [ -e "%_sourcedir/_pubkey" ]; then
    name="$(sh %{SOURCE0} %_sourcedir/_pubkey).asc"
    if [ ! -e "%_sourcedir/$name" ]; then
	install -D -m 644 %_sourcedir/_pubkey %{buildroot}%keydir/"$name"
    fi
fi

mkdir -p $RPM_BUILD_ROOT/usr/sbin/
mkdir -p $RPM_BUILD_ROOT/var/lib/%name
install -m 755 %{SOURCE101} $RPM_BUILD_ROOT/usr/sbin/import-%name
mkdir -p $RPM_BUILD_ROOT/%_unitdir
install -m 644 %{SOURCE102} $RPM_BUILD_ROOT/%_unitdir/
install -m 644 %{SOURCE103} $RPM_BUILD_ROOT/%_unitdir/

%post
: >/var/lib/%{name}/imported
%service_add_post openSUSE-build-key-tigro-import.service openSUSE-build-key-tigro-import.timer
test -x /usr/bin/systemctl && systemctl enable openSUSE-build-key-tigro-import.timer && systemctl start openSUSE-build-key-tigro-import.timer || true

%pre
%service_add_pre openSUSE-build-key-tigro-import.service openSUSE-build-key-tigro-import.timer

%preun
%service_del_preun openSUSE-build-key-tigro-import.service openSUSE-build-key-tigro-import.timer

%postun
%service_del_postun openSUSE-build-key-tigro-import.service openSUSE-build-key-tigro-import.timer

%files
%defattr(644,root,root)
%attr(755,root,root) %dir %{_prefix}/lib/rpm/gnupg
%attr(755,root,root) %dir %{keydir}
%{keydir}/gpg-pubkey-*.asc
%attr(755,root,root) %_sbindir/import-%name
%dir /var/lib/%{name}
%ghost /var/lib/%{name}/imported
%_unitdir/%name-import.service
%_unitdir/%name-import.timer

%changelog
openSUSE Build Service is sponsored by