#!/bin/bash # This specfile unpacks the original RPMs, runs pesign-gen-repackage-spec # to create a second repackage specfile, and runs another rpmbuild to # actually do the repackaging. # # Copyright (c) 2013 SUSE Linux Products GmbH, Nuernberg, Germany. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # Do not generate any debug packages from the repackage specfile %undefine _build_create_debug Name: pesign-repackage Version: 1.0 Release: 1 BuildRequires: openssl mozilla-nss-tools %ifarch %ix86 x86_64 ia64 BuildRequires: pesign %endif License: GPLv Group: Development/Tools/Other Summary: Spec file to rebuild RPMs with signatures BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Rebuilds RPMs with signatures %prep %setup -c -T %build %install pushd %buildroot disturl= rpms=() for rpm in %_sourcedir/*.rpm; do case "$rpm" in *.src.rpm | *.nosrc.rpm) cp "$rpm" %_srcrpmdir/ continue esac rpm2cpio "$rpm" | cpio -idm d=$(rpm -qp --qf '%%{disturl}' "$rpm") if test -z "$disturl"; then disturl=$d fi if test "$disturl" != "$d"; then echo "Error: packages have different disturl: $d vs $disturl" exit 1 fi rpms=("${rpms[@]}" "$rpm") done popd mkdir rsasigned pushd rsasigned cpio -idm <%_sourcedir/@NAME@.cpio.rsasign.sig cat >cert.crt <&2 esac done popd /usr/lib/rpm/pesign-gen-repackage-spec --directory=%buildroot "${rpms[@]}" rpmbuild --define "%%buildroot %buildroot" --define "%%disturl $disturl" \ --define "%%_builddir $PWD" \ --define "%_suse_insert_debug_package %%{nil}" -bb repackage.spec # This is needed by the kernel packages. Ideally, we should not run _any_ brp # checks, because the RPMs passed them once already export NO_BRP_STALE_LINK_ERROR=yes # Make sure that our rpmbuild does not complain about unpackaged files rm -rf %buildroot mkdir %buildroot