Josef Stribny a3ec261
# http://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines#PIE
Josef Stribny a3ec261
%global _hardened_build 1
Josef Stribny a3ec261
Josef Stribny a3ec261
Name:             obs-signd
Josef Stribny a3ec261
Summary:          The OBS sign daemon
Josef Stribny a3ec261
License:          GPLv2
Josef Stribny a3ec261
Group:            Applications/System
Josef Stribny a3ec261
Url:              https://github.com/openSUSE/obs-sign
Josef Stribny a3ec261
Version:          2.2.1
7963283
Release:          9%{?dist}
Josef Stribny a3ec261
# Taken from upstream git
Josef Stribny a3ec261
# git clone https://github.com/openSUSE/obs-sign && cd obs-sign
Josef Stribny a3ec261
# git checkout 2.2.1
Josef Stribny a3ec261
# tar czvf obs-signd-2.2.1.tar.bz2 \
Josef Stribny a3ec261
#   sign.8  sign.c  sign.conf  sign.conf.5  signd signd.8 obssignd
Josef Stribny a3ec261
Source0:          obs-signd-%version.tar.bz2
Josef Stribny a3ec261
# Upstream doesn't provide systemd service file
Josef Stribny a3ec261
Source1:          signd.service
Josef Stribny a3ec261
# We renamed the option in gnupg2 to 'file-is-digest'
Josef Stribny a3ec261
Patch0:           obs-sign-rename-option-files-are-digests-to-file-is-digest.patch
efb0017
# https://github.com/openSUSE/obs-sign/pull/6
efb0017
Patch1:			  0001-fixes-user-id-matching-to-provide-unique-results.patch
Josef Stribny a3ec261
Requires:         gnupg2
Josef Stribny a3ec261
Requires(post):   systemd
Josef Stribny a3ec261
Requires(preun):  systemd
Josef Stribny a3ec261
Requires(postun): systemd
589ff6a
BuildRequires:    perl-generators
Josef Stribny a3ec261
BuildRequires:    systemd
Josef Stribny a3ec261
Josef Stribny a3ec261
%description
Josef Stribny a3ec261
The OpenSUSE Build Service sign client and daemon.
Josef Stribny a3ec261
Josef Stribny a3ec261
This daemon can be used to sign anything via gpg by communicating
Josef Stribny a3ec261
with a remote server to avoid the need to host the private key
Josef Stribny a3ec261
on the same server.
Josef Stribny a3ec261
Josef Stribny a3ec261
%prep
Josef Stribny a3ec261
%setup -q -c -n obs-signd-%version
Josef Stribny a3ec261
Josef Stribny a3ec261
%patch0 -p1
efb0017
%patch1 -p1
Josef Stribny a3ec261
Josef Stribny a3ec261
%build
Josef Stribny a3ec261
gcc %{optflags} -fPIC -pie -o sign sign.c
Josef Stribny a3ec261
Josef Stribny a3ec261
%install
Josef Stribny a3ec261
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_sysconfdir}
Josef Stribny a3ec261
install -d -m 0755 %{buildroot}%{_bindir}
Josef Stribny a3ec261
Josef Stribny a3ec261
# binaries and configuration
Josef Stribny a3ec261
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_bindir} %{buildroot}%{_sysconfdir}
Josef Stribny a3ec261
install -m 0755 signd %{buildroot}%{_sbindir}
Josef Stribny a3ec261
install -m 0750 sign %{buildroot}%{_bindir}
Josef Stribny a3ec261
install -m 0644 sign.conf %{buildroot}%{_sysconfdir}
Josef Stribny a3ec261
Josef Stribny a3ec261
# systemd service
Josef Stribny a3ec261
mkdir -p %{buildroot}%{_unitdir}
Josef Stribny a3ec261
install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}
Josef Stribny a3ec261
Josef Stribny a3ec261
# man pages
Josef Stribny a3ec261
install -d -m 0755 %{buildroot}%{_mandir}/man{5,8}
Josef Stribny a3ec261
Josef Stribny a3ec261
for f in 5 8; do
Josef Stribny a3ec261
  install -m 0644 sig*.${f} %{buildroot}%{_mandir}/man${f}/
Josef Stribny a3ec261
done
Josef Stribny a3ec261
Josef Stribny a3ec261
%pre
Josef Stribny a3ec261
getent group obsrun >/dev/null || %{_sbindir}/groupadd -r obsrun
Josef Stribny a3ec261
getent passwd obsrun >/dev/null || \
Josef Stribny a3ec261
  %{_sbindir}/useradd -r -s /bin/false -c "User for Open Build Service backend" \
Josef Stribny a3ec261
                         -d %{_libdir}/obs -g obsrun obsrun
Josef Stribny a3ec261
exit 0
Josef Stribny a3ec261
Josef Stribny a3ec261
%post
Josef Stribny a3ec261
%systemd_post signd.service
Josef Stribny a3ec261
Josef Stribny a3ec261
%preun
Josef Stribny a3ec261
%systemd_preun signd.service
Josef Stribny a3ec261
Josef Stribny a3ec261
%postun
Josef Stribny a3ec261
%systemd_postun_with_restart signd.service
Josef Stribny a3ec261
Josef Stribny a3ec261
%files
Josef Stribny a3ec261
%config(noreplace) %{_sysconfdir}/sign.conf
Josef Stribny a3ec261
%verify(not mode) %attr(4750,root,obsrun) %{_bindir}/sign
Josef Stribny a3ec261
%{_sbindir}/signd
Josef Stribny a3ec261
%{_unitdir}/signd.service
Josef Stribny a3ec261
%doc %{_mandir}/man*/*
Josef Stribny a3ec261
Josef Stribny a3ec261
%changelog
7963283
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-9
7963283
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7963283
dbd8c3d
* Tue Apr 26 2016 Miroslav Suchy <msuchy@redhat.com> - 2.2.1-8
dbd8c3d
- fix id matching (Patch1)
dbd8c3d
4314733
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-7
4314733
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
4314733
b6444cb
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-6
b6444cb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b6444cb
Josef Stribny fb37d4d
* Fri Oct 03 2014 Josef Stribny <jstribny@redhat.com> - 2.2.1-5
Josef Stribny fb37d4d
- Add install section to unit file
Josef Stribny fb37d4d
Josef Stribny a3ec261
* Tue Aug 26 2014 Josef Stribny <jstribny@redhat.com> - 2.2.1-4
Josef Stribny a3ec261
- Enable Position-independent code (PIC)
Josef Stribny a3ec261
Josef Stribny a3ec261
* Mon Aug 25 2014 Josef Stribny <jstribny@redhat.com> - 2.2.1-3
Josef Stribny a3ec261
- Create group or user only if it doesn't exist yet
Josef Stribny a3ec261
- Remove explicit gzip of man pages
Josef Stribny a3ec261
Josef Stribny a3ec261
* Fri Aug 22 2014 Josef Stribny <jstribny@redhat.com> - 2.2.1-2
Josef Stribny a3ec261
- Use macros where possible
Josef Stribny a3ec261
Josef Stribny a3ec261
* Fri May 23 2014 Josef Stribny <jstribny@redhat.com> 2.2.1-1
Josef Stribny a3ec261
- Initial package