- use rpm -qf to determine if a ssl cert is owned by some other

package and therefore doesn't need to be migrated (related to
  bnc#890205).

OBS-URL: https://build.opensuse.org/package/show/Base:System/ca-certificates?expand=0&rev=59
This commit is contained in:
Ludwig Nussel 2014-08-05 11:29:58 +00:00 committed by Git OBS Bridge
parent e236524a63
commit 011a67030e
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Aug 5 11:09:24 UTC 2014 - lnussel@suse.de
- use rpm -qf to determine if a ssl cert is owned by some other
package and therefore doesn't need to be migrated (related to
bnc#890205).
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Aug 4 15:35:27 UTC 2014 - lnussel@suse.de Mon Aug 4 15:35:27 UTC 2014 - lnussel@suse.de

View File

@ -91,14 +91,15 @@ mv %{buildroot}/%{_prefix}/lib/ca-certificates/update.d/{,99}certbundle.run
%pre %pre
# migrate /etc/ssl/certs to a symlink # migrate /etc/ssl/certs to a symlink
if [ "$1" -ne 0 -a -d %{sslcerts} -a ! -L %{sslcerts} ]; then if [ "$1" -ne 0 -a -d %{sslcerts} -a ! -L %{sslcerts} ]; then
mv -T --backup=numbered %{sslcerts} %{sslcerts}.rpmsave && ln -s /var/lib/ca-certificates/pem %{sslcerts}
# copy custom pem files to new location (bnc#875647) # copy custom pem files to new location (bnc#875647)
mkdir -p /etc/pki/trust/anchors mkdir -p /etc/pki/trust/anchors
for cert in %{sslcerts}.rpmsave/*.pem; do for cert in %{sslcerts}/*.pem; do
test -f "$cert" -a ! -L "$cert" || continue test -f "$cert" -a ! -L "$cert" || continue
read firstline < "$cert" read firstline < "$cert"
# skip package provided certificates (bnc#875647) # skip package provided certificates (bnc#875647)
test "$firstline" != "# generated by openssl-certs, do not edit" || continue if test "${firstline#\# generated by }" != "${firstline}" || rpm -qf "$cert" > /dev/null; then
continue
fi
# create a p11-kit header that set the label of # create a p11-kit header that set the label of
# the certificate to the file name. That ensures # the certificate to the file name. That ensures
# that the certificate gets the same name in # that the certificate gets the same name in
@ -107,7 +108,7 @@ if [ "$1" -ne 0 -a -d %{sslcerts} -a ! -L %{sslcerts} ]; then
( (
cat <<-EOF cat <<-EOF
# created by update-ca-certificates from # created by update-ca-certificates from
# /etc/ssl/certs/$bn # $cert
[p11-kit-object-v1] [p11-kit-object-v1]
class: certificate class: certificate
label: "${bn%.pem}" label: "${bn%.pem}"
@ -116,6 +117,7 @@ if [ "$1" -ne 0 -a -d %{sslcerts} -a ! -L %{sslcerts} ]; then
cat $cert cat $cert
) > "/etc/pki/trust/$bn" ) > "/etc/pki/trust/$bn"
done done
mv -T --backup=numbered %{sslcerts} %{sslcerts}.rpmsave && ln -s /var/lib/ca-certificates/pem %{sslcerts}
fi fi
%post %post