File ca-certificates.spec of Package ca-certificates

# spec file for package ca-certificates
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# 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

# norootforbuild

%bcond_without java

BuildRequires:  openssl
%if %{with java}
BuildRequires:  gcc-java
BuildRequires:  fastjar

Name:           ca-certificates
%define ssletcdir %{_sysconfdir}/ssl
%define etccadir  %{ssletcdir}/certs
%define cabundle  /var/lib/ca-certificates/ca-bundle.pem
%define usrcadir  %{_datadir}/ca-certificates
License:        GPL-2.0+
Group:          Productivity/Networking/Security
Version:        1
Release:        12
Summary:        Utilities for system wide CA certificate installation
Source0:        update-ca-certificates
Source1:        update-ca-certificates.8
Source2:        GPL-2.0.txt
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       openssl
# needed for %post
Requires:       coreutils
Recommends:     ca-certificates-mozilla
# we need to obsolete openssl-certs to make sure it's files are
# gone when a package providing actual certificates gets
# installed (bnc#594434).
Obsoletes:      openssl-certs < 0.9.9
BuildArch:      noarch

%if %{with java}

%package -n java-ca-certificates
License:        GPL-2.0+
Group:          Productivity/Networking/Security
Summary:        Utilities CA certificate import to gcj
Requires(post): ca-certificates
Supplements:    packageand(gcj-compat:ca-certificates)
Supplements:    packageand(java-1_6_0-openjdk:ca-certificates)
Supplements:    packageand(java-1_6_0-sun:ca-certificates)

Utilities for system wide CA certificate installation

%if %{with java}

%description -n java-ca-certificates
Utilities for CA certificate installation for gcj and openjdk Java

%setup -qcT
install -m 755 %{SOURCE0} .
install -m 644 %{SOURCE1} .
install -m 644 %{SOURCE2} COPYING

%if %{with java}
gcj -C %SOURCE4 -d .
# emulate -e option of jar for fastjar
Manifest-Version: 1.0
Created-By: 0.98
Main-Class: keystore
fastjar cfm keystore.jar MANIFEST.MF keystore*.class

mkdir -p %{buildroot}/%{etccadir}
mkdir -p %{buildroot}/%{usrcadir}
mkdir -p %{buildroot}/%{_sbindir}
mkdir -p %{buildroot}/%{_mandir}/man8
mkdir -p %{buildroot}/etc/ca-certificates/update.d
mkdir -p %{buildroot}%{_prefix}/lib/ca-certificates/update.d
install -D -m 644 /dev/null %{buildroot}/%{cabundle}
install -m 644 /dev/null %{buildroot}/etc/ca-certificates.conf
install -m 755 %{SOURCE3} %{buildroot}%{_prefix}/lib/ca-certificates/update.d
install -m 755 %{SOURCE5} %{buildroot}%{_prefix}/lib/ca-certificates/update.d
ln -s %{cabundle} %{buildroot}%{ssletcdir}/ca-bundle.pem

install -m 755 update-ca-certificates %{buildroot}/%{_sbindir}
install -m 644 update-ca-certificates.8 %{buildroot}/%{_mandir}/man8
install -m 644 /dev/null %{buildroot}/var/lib/ca-certificates/ca-bundle.pem
%if %{with java}
mkdir -p %{buildroot}%{_prefix}/lib/ca-certificates/java
install -m 644 keystore.jar %{buildroot}%{_prefix}/lib/ca-certificates/java
install -m 644 /dev/null %{buildroot}/var/lib/ca-certificates/java-cacerts
install -m 644 /dev/null %{buildroot}/var/lib/ca-certificates/gcj-cacerts

# this is just needed for those updating Factory,
# can be removed before 11.3
if [ "$1" -ge 1 ]; then
  rm -f /etc/ca-certificates/update.d/
# force rebuilding all certificate stores.
# This also makes sure we update the hash links in /etc/ssl/certs
# as openssl changed the hash format between 0.9.8 and 1.0
update-ca-certificates -f || true

%if %{with java}

%post -n java-ca-certificates
update-ca-certificates || true

rm -rf %{buildroot}

%defattr(-, root, root)
%dir %{usrcadir}
%dir %{etccadir}
%ghost %config(noreplace) /etc/ca-certificates.conf
%ghost %{cabundle}
%dir /etc/ca-certificates
%dir /etc/ca-certificates/update.d
%dir %{_prefix}/lib/ca-certificates
%dir %{_prefix}/lib/ca-certificates/update.d
%dir /var/lib/ca-certificates
%ghost /var/lib/ca-certificates/ca-bundle.pem

%if %{with java}

%files -n java-ca-certificates
%defattr(-, root, root)
%dir %{_prefix}/lib/ca-certificates/java
%ghost /var/lib/ca-certificates/java-cacerts
%ghost /var/lib/ca-certificates/gcj-cacerts

openSUSE Build Service is sponsored by