83bcdf
83bcdf
%global pkgname   dirsrv
83bcdf
%global srcname   389-ds-base
83bcdf
83bcdf
# Exclude i686 bit arches
83bcdf
ExcludeArch: i686
83bcdf
83bcdf
# for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release
83bcdf
# also remove the space between % and global - this space is needed because
83bcdf
# fedpkg verrel stupidly ignores comment lines
83bcdf
#% global prerel .rc3
83bcdf
# also need the relprefix field for a pre-release e.g. .0 - also comment out for official release
83bcdf
#% global relprefix 0.
83bcdf
83bcdf
# If perl-Socket-2.000 or newer is available, set 0 to use_Socket6.
83bcdf
%global use_Socket6 0
83bcdf
83bcdf
%global use_asan 0
83bcdf
%global use_rust 0
c384d7
%global use_legacy 1
83bcdf
%global bundle_jemalloc 1
83bcdf
%if %{use_asan}
83bcdf
%global bundle_jemalloc 0
83bcdf
%endif
83bcdf
83bcdf
%if %{bundle_jemalloc}
83bcdf
%global jemalloc_name jemalloc
c384d7
%global jemalloc_ver 5.2.0
83bcdf
%global __provides_exclude ^libjemalloc\\.so.*$
83bcdf
%endif
83bcdf
83bcdf
# Use Clang instead of GCC
83bcdf
%global use_clang 0
83bcdf
83bcdf
# fedora 15 and later uses tmpfiles.d
83bcdf
# otherwise, comment this out
83bcdf
%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d}
83bcdf
83bcdf
# systemd support
83bcdf
%global groupname %{pkgname}.target
83bcdf
83bcdf
# set PIE flag
83bcdf
%global _hardened_build 1
83bcdf
83bcdf
Summary:          389 Directory Server (base)
83bcdf
Name:             389-ds-base
c384d7
Version:          1.4.2.4
c384d7
Release:          %{?relprefix}4%{?prerel}%{?dist}
83bcdf
License:          GPLv3+
83bcdf
URL:              https://www.port389.org
83bcdf
Group:            System Environment/Daemons
83bcdf
Conflicts:        selinux-policy-base < 3.9.8
83bcdf
Conflicts:        freeipa-server < 4.0.3
83bcdf
Obsoletes:        %{name} <= 1.4.0.9
83bcdf
Provides:         ldif2ldbm >= 0
83bcdf
83bcdf
BuildRequires:    nspr-devel
83bcdf
BuildRequires:    nss-devel >= 3.34
83bcdf
BuildRequires:    perl-generators
83bcdf
BuildRequires:    openldap-devel
83bcdf
BuildRequires:    libdb-devel
83bcdf
BuildRequires:    cyrus-sasl-devel
83bcdf
BuildRequires:    icu
83bcdf
BuildRequires:    libicu-devel
83bcdf
BuildRequires:    pcre-devel
83bcdf
BuildRequires:    cracklib-devel
83bcdf
%if %{use_clang}
83bcdf
BuildRequires:    libatomic
83bcdf
BuildRequires:    clang
83bcdf
%else
83bcdf
BuildRequires:    gcc
83bcdf
BuildRequires:    gcc-c++
83bcdf
%endif
83bcdf
# The following are needed to build the snmp ldap-agent
83bcdf
BuildRequires:    net-snmp-devel
83bcdf
BuildRequires:    lm_sensors-devel
83bcdf
BuildRequires:    bzip2-devel
83bcdf
BuildRequires:    zlib-devel
83bcdf
BuildRequires:    openssl-devel
83bcdf
# the following is for the pam passthru auth plug-in
83bcdf
BuildRequires:    pam-devel
83bcdf
BuildRequires:    systemd-units
83bcdf
BuildRequires:    systemd-devel
83bcdf
%if %{use_asan}
83bcdf
BuildRequires:    libasan
83bcdf
%endif
83bcdf
# If rust is enabled
83bcdf
%if %{use_rust}
83bcdf
BuildRequires: cargo
83bcdf
BuildRequires: rust
83bcdf
%endif
83bcdf
BuildRequires:    pkgconfig
83bcdf
BuildRequires:    pkgconfig(systemd)
83bcdf
BuildRequires:    pkgconfig(krb5)
83bcdf
83bcdf
# Needed to support regeneration of the autotool artifacts.
83bcdf
BuildRequires:    autoconf
83bcdf
BuildRequires:    automake
83bcdf
BuildRequires:    libtool
83bcdf
# For our documentation
83bcdf
BuildRequires:    doxygen
83bcdf
# For tests!
83bcdf
BuildRequires:    libcmocka-devel
83bcdf
BuildRequires:    libevent-devel
83bcdf
# For lib389 and related components
83bcdf
BuildRequires:    python%{python3_pkgversion}
83bcdf
BuildRequires:    python%{python3_pkgversion}-devel
83bcdf
BuildRequires:    python%{python3_pkgversion}-setuptools
83bcdf
BuildRequires:    python%{python3_pkgversion}-ldap
83bcdf
BuildRequires:    python%{python3_pkgversion}-six
83bcdf
BuildRequires:    python%{python3_pkgversion}-pyasn1
83bcdf
BuildRequires:    python%{python3_pkgversion}-pyasn1-modules
83bcdf
BuildRequires:    python%{python3_pkgversion}-dateutil
83bcdf
BuildRequires:    python%{python3_pkgversion}-argcomplete
83bcdf
BuildRequires:    python%{python3_pkgversion}-argparse-manpage
83bcdf
BuildRequires:    python%{python3_pkgversion}-policycoreutils
83bcdf
BuildRequires:    python%{python3_pkgversion}-libselinux
83bcdf
83bcdf
# For cockpit
83bcdf
BuildRequires:    rsync
83bcdf
BuildRequires:    npm
83bcdf
BuildRequires:    nodejs
83bcdf
83bcdf
Requires:         %{name}-libs = %{version}-%{release}
83bcdf
Requires:         python%{python3_pkgversion}-lib389 = %{version}-%{release}
83bcdf
83bcdf
# this is needed for using semanage from our setup scripts
83bcdf
Requires:         policycoreutils-python-utils
83bcdf
Requires:         /usr/sbin/semanage
83bcdf
Requires:         libsemanage-python%{python3_pkgversion}
83bcdf
83bcdf
Requires:         selinux-policy >= 3.14.1-29
83bcdf
83bcdf
# the following are needed for some of our scripts
83bcdf
Requires:         openldap-clients
83bcdf
Requires:         openssl-perl
83bcdf
Requires:         python%{python3_pkgversion}-ldap
83bcdf
83bcdf
# this is needed to setup SSL if you are not using the
83bcdf
# administration server package
83bcdf
Requires:         nss-tools
83bcdf
Requires:         nss >= 3.34
83bcdf
83bcdf
# these are not found by the auto-dependency method
83bcdf
# they are required to support the mandatory LDAP SASL mechs
83bcdf
Requires:         cyrus-sasl-gssapi
83bcdf
Requires:         cyrus-sasl-md5
83bcdf
Requires:         cyrus-sasl-plain
83bcdf
83bcdf
# this is needed for verify-db.pl
83bcdf
Requires:         libdb-utils
83bcdf
c384d7
# Needed for password dictionary checks
c384d7
Requires:         cracklib-dicts
c384d7
83bcdf
# This picks up libperl.so as a Requires, so we add this versioned one
83bcdf
Requires:         perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
83bcdf
Requires:         perl-Errno >= 1.23-360
83bcdf
83bcdf
# Needed by logconv.pl
83bcdf
Requires:         perl-DB_File
83bcdf
Requires:         perl-Archive-Tar
83bcdf
83bcdf
# Needed for password dictionary checks
83bcdf
Requires:         cracklib-dicts
83bcdf
83bcdf
# Picks up our systemd deps.
83bcdf
%{?systemd_requires}
83bcdf
83bcdf
Obsoletes:        %{name} <= 1.3.5.4
83bcdf
83bcdf
Source0:          https://releases.pagure.org/389-ds-base/%{name}-%{version}.tar.bz2
83bcdf
# 389-ds-git.sh should be used to generate the source tarball from git
83bcdf
Source1:          %{name}-git.sh
83bcdf
Source2:          %{name}-devel.README
83bcdf
%if %{bundle_jemalloc}
83bcdf
Source3:          https://github.com/jemalloc/%{jemalloc_name}/releases/download/%{jemalloc_ver}/%{jemalloc_name}-%{jemalloc_ver}.tar.bz2
83bcdf
%endif
c384d7
Patch00:          0000-Issue-50712-Version-comparison-doesn-t-work-correctl.patch
c384d7
Patch01:          0001-Issue-50499-Fix-npm-audit-issues.patch
c384d7
Patch02:          0002-Issue-50701-Add-additional-healthchecks-to-dsconf.patch
c384d7
Patch03:          0003-Issue-50701-Fix-type-in-lint-report.patch
83bcdf
83bcdf
%description
83bcdf
389 Directory Server is an LDAPv3 compliant server.  The base package includes
83bcdf
the LDAP server and command line utilities for server administration.
83bcdf
%if %{use_asan}
83bcdf
WARNING! This build is linked to Address Sanitisation libraries. This probably
83bcdf
isn't what you want. Please contact support immediately.
83bcdf
Please see http://seclists.org/oss-sec/2016/q1/363 for more information.
83bcdf
%endif
83bcdf
83bcdf
%package          libs
83bcdf
Summary:          Core libraries for 389 Directory Server
83bcdf
Group:            System Environment/Daemons
83bcdf
BuildRequires:    nspr-devel
83bcdf
BuildRequires:    nss-devel >= 3.34
83bcdf
BuildRequires:    openldap-devel
83bcdf
BuildRequires:    libdb-devel
83bcdf
BuildRequires:    cyrus-sasl-devel
83bcdf
BuildRequires:    libicu-devel
83bcdf
BuildRequires:    pcre-devel
83bcdf
BuildRequires:    libtalloc-devel
83bcdf
BuildRequires:    libevent-devel
83bcdf
BuildRequires:    libtevent-devel
83bcdf
Requires:         krb5-libs
83bcdf
Requires:         libevent
83bcdf
BuildRequires:    systemd-devel
83bcdf
Provides:         svrcore = 4.1.4
83bcdf
Conflicts:        svrcore
83bcdf
Obsoletes:        svrcore <= 4.1.3
83bcdf
83bcdf
%description      libs
83bcdf
Core libraries for the 389 Directory Server base package.  These libraries
83bcdf
are used by the main package and the -devel package.  This allows the -devel
83bcdf
package to be installed with just the -libs package and without the main package.
83bcdf
c384d7
%if %{use_legacy}
83bcdf
%package          legacy-tools
83bcdf
Summary:          Legacy utilities for 389 Directory Server (%{variant})
83bcdf
Group:            System Environment/Daemons
83bcdf
Obsoletes:        %{name} <= 1.4.0.9
c384d7
Requires:         %{name}-libs = %{version}-%{release}
83bcdf
# for setup-ds.pl to support ipv6
83bcdf
%if %{use_Socket6}
83bcdf
Requires:         perl-Socket6
83bcdf
%else
83bcdf
Requires:         perl-Socket
83bcdf
%endif
83bcdf
Requires:         perl-NetAddr-IP
83bcdf
# use_openldap assumes perl-Mozilla-LDAP is built with openldap support
83bcdf
Requires:         perl-Mozilla-LDAP
83bcdf
# for setup-ds.pl
83bcdf
Requires:         bind-utils
c384d7
%global __provides_exclude_from %{_libdir}/%{pkgname}/perl
c384d7
%global __requires_exclude perl\\((DSCreate|DSMigration|DSUpdate|DSUtil|Dialog|DialogManager|FileConn|Inf|Migration|Resource|Setup|SetupLog)
83bcdf
%{?perl_default_filter}
83bcdf
83bcdf
%description      legacy-tools
83bcdf
Legacy (and deprecated) utilities for 389 Directory Server. This includes
83bcdf
the old account management and task scripts. These are deprecated in favour of
83bcdf
the dscreate, dsctl, dsconf and dsidm tools.
c384d7
%endif
83bcdf
83bcdf
%package          devel
83bcdf
Summary:          Development libraries for 389 Directory Server
83bcdf
Group:            Development/Libraries
83bcdf
Requires:         %{name}-libs = %{version}-%{release}
83bcdf
Requires:         pkgconfig
83bcdf
Requires:         nspr-devel
83bcdf
Requires:         nss-devel >= 3.34
83bcdf
Requires:         openldap-devel
83bcdf
Requires:         libtalloc
83bcdf
Requires:         libevent
83bcdf
Requires:         libtevent
83bcdf
Requires:         systemd-libs
83bcdf
Provides:         svrcore-devel = 4.1.4
83bcdf
Conflicts:        svrcore-devel
83bcdf
Obsoletes:        svrcore-devel <= 4.1.3
83bcdf
83bcdf
%description      devel
83bcdf
Development Libraries and headers for the 389 Directory Server base package.
83bcdf
83bcdf
%package          snmp
83bcdf
Summary:          SNMP Agent for 389 Directory Server
83bcdf
Group:            System Environment/Daemons
83bcdf
Requires:         %{name} = %{version}-%{release}
83bcdf
83bcdf
Obsoletes:        %{name} <= 1.4.0.0
83bcdf
83bcdf
%description      snmp
83bcdf
SNMP Agent for the 389 Directory Server base package.
83bcdf
83bcdf
%package -n python%{python3_pkgversion}-lib389
83bcdf
Summary:  A library for accessing, testing, and configuring the 389 Directory Server
83bcdf
BuildArch:        noarch
83bcdf
Group:            Development/Libraries
83bcdf
Requires: openssl
83bcdf
Requires: iproute
83bcdf
Requires: platform-python
83bcdf
Requires: python%{python3_pkgversion}-ldap
83bcdf
Requires: python%{python3_pkgversion}-six
83bcdf
Requires: python%{python3_pkgversion}-pyasn1
83bcdf
Requires: python%{python3_pkgversion}-pyasn1-modules
83bcdf
Requires: python%{python3_pkgversion}-dateutil
83bcdf
Requires: python%{python3_pkgversion}-argcomplete
83bcdf
Requires: python%{python3_pkgversion}-libselinux
c384d7
Requires: python%{python3_pkgversion}-setuptools
83bcdf
%{?python_provide:%python_provide python%{python3_pkgversion}-lib389}
83bcdf
83bcdf
%description -n python%{python3_pkgversion}-lib389
83bcdf
This module contains tools and libraries for accessing, testing,
83bcdf
 and configuring the 389 Directory Server.
83bcdf
83bcdf
%package -n cockpit-389-ds
83bcdf
Summary:          Cockpit UI Plugin for configuring and administering the 389 Directory Server
83bcdf
BuildArch:        noarch
83bcdf
Requires:         cockpit
83bcdf
Requires:         platform-python
83bcdf
Requires:         python%{python3_pkgversion}-lib389
83bcdf
83bcdf
%description -n cockpit-389-ds
83bcdf
A cockpit UI Plugin for configuring and administering the 389 Directory Server
83bcdf
83bcdf
%prep
83bcdf
%autosetup -p1 -v -n %{name}-%{version}%{?prerel}
83bcdf
%if %{bundle_jemalloc}
83bcdf
%setup -q -n %{name}-%{version}%{?prerel} -T -D -b 3
83bcdf
%endif
83bcdf
cp %{SOURCE2} README.devel
83bcdf
83bcdf
%build
83bcdf
83bcdf
OPENLDAP_FLAG="--with-openldap"
83bcdf
%{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"}
83bcdf
# hack hack hack https://bugzilla.redhat.com/show_bug.cgi?id=833529
83bcdf
NSSARGS="--with-nss-lib=%{_libdir} --with-nss-inc=%{_includedir}/nss3"
83bcdf
83bcdf
%if %{use_asan}
83bcdf
ASAN_FLAGS="--enable-asan --enable-debug"
83bcdf
%endif
83bcdf
83bcdf
%if %{use_rust}
83bcdf
RUST_FLAGS="--enable-rust"
83bcdf
%endif
83bcdf
c384d7
%if %{use_legacy}
c384d7
LEGACY_FLAGS="--enable-legacy --enable-perl"
83bcdf
%else
c384d7
LEGACY_FLAGS="--disable-legacy --disable-perl"
83bcdf
%endif
83bcdf
83bcdf
%if %{use_clang}
83bcdf
export CC=clang
83bcdf
export CXX=clang++
83bcdf
CLANG_FLAGS="--enable-clang"
83bcdf
%endif
83bcdf
83bcdf
%if %{bundle_jemalloc}
83bcdf
# Build jemalloc
83bcdf
pushd ../%{jemalloc_name}-%{jemalloc_ver}
83bcdf
%configure \
83bcdf
        --libdir=%{_libdir}/%{pkgname}/lib \
83bcdf
        --bindir=%{_libdir}/%{pkgname}/bin
83bcdf
make
83bcdf
popd
83bcdf
%endif
83bcdf
83bcdf
# Enforce strict linking
83bcdf
%define _strict_symbol_defs_build 1
83bcdf
83bcdf
# Rebuild the autotool artifacts now.
83bcdf
autoreconf -fiv
83bcdf
83bcdf
%configure --enable-autobind --with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \
83bcdf
           --with-systemd \
83bcdf
           --with-systemdsystemunitdir=%{_unitdir} \
83bcdf
           --with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \
83bcdf
           --with-systemdgroupname=%{groupname}  \
83bcdf
           --libexecdir=%{_libexecdir}/%{pkgname} \
c384d7
           $NSSARGS $ASAN_FLAGS $RUST_FLAGS $LEGACY_FLAGS $CLANG_FLAGS \
83bcdf
           --enable-cmocka 
83bcdf
83bcdf
# lib389
83bcdf
pushd ./src/lib389
83bcdf
%py3_build
83bcdf
popd
83bcdf
# argparse-manpage dynamic man pages have hardcoded man v1 in header,
83bcdf
# need to change it to v8
83bcdf
sed -i  "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dsconf.8
83bcdf
sed -i  "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dsctl.8
83bcdf
sed -i  "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dsidm.8
83bcdf
sed -i  "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dscreate.8
83bcdf
83bcdf
# Generate symbolic info for debuggers
83bcdf
export XCFLAGS=$RPM_OPT_FLAGS
83bcdf
83bcdf
#make %{?_smp_mflags}
83bcdf
make
83bcdf
83bcdf
%install
83bcdf
83bcdf
mkdir -p %{buildroot}%{_datadir}/gdb/auto-load%{_sbindir}
83bcdf
mkdir -p %{buildroot}%{_datadir}/cockpit
83bcdf
make DESTDIR="$RPM_BUILD_ROOT" install
83bcdf
c384d7
# Cockpit file list
83bcdf
find %{buildroot}%{_datadir}/cockpit/389-console -type d | sed -e "s@%{buildroot}@@" | sed -e 's/^/\%dir /' > cockpit.list
83bcdf
find %{buildroot}%{_datadir}/cockpit/389-console -type f | sed -e "s@%{buildroot}@@" >> cockpit.list
83bcdf
83bcdf
# Copy in our docs from doxygen.
83bcdf
cp -r %{_builddir}/%{name}-%{version}%{?prerel}/man/man3 $RPM_BUILD_ROOT/%{_mandir}/man3
83bcdf
83bcdf
# lib389
83bcdf
pushd src/lib389
83bcdf
%py3_install
83bcdf
popd
83bcdf
83bcdf
mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname}
83bcdf
mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname}
83bcdf
mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname}
83bcdf
83bcdf
# for systemd
83bcdf
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants
83bcdf
83bcdf
#remove libtool archives and static libs
83bcdf
find %{buildroot} -type f -name "*.la" -delete
83bcdf
find %{buildroot} -type f -name "*.a" -delete
83bcdf
c384d7
%if %{use_legacy}
83bcdf
# make sure perl scripts have a proper shebang
83bcdf
sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/script-templates/template-*.pl
83bcdf
%endif
83bcdf
83bcdf
%if %{bundle_jemalloc}
83bcdf
pushd ../%{jemalloc_name}-%{jemalloc_ver}
83bcdf
make DESTDIR="$RPM_BUILD_ROOT" install_lib install_bin
83bcdf
cp -pa COPYING ../%{name}-%{version}%{?prerel}/COPYING.jemalloc
83bcdf
cp -pa README ../%{name}-%{version}%{?prerel}/README.jemalloc
83bcdf
popd
83bcdf
%endif
83bcdf
83bcdf
%check
83bcdf
# This checks the code, if it fails it prints why, then re-raises the fail to shortcircuit the rpm build.
83bcdf
if ! make DESTDIR="$RPM_BUILD_ROOT" check; then cat ./test-suite.log && false; fi
83bcdf
83bcdf
%clean
83bcdf
rm -rf $RPM_BUILD_ROOT
83bcdf
83bcdf
%post
83bcdf
if [ -n "$DEBUGPOSTTRANS" ] ; then
83bcdf
    output=$DEBUGPOSTTRANS
83bcdf
    output2=${DEBUGPOSTTRANS}.upgrade
83bcdf
else
83bcdf
    output=/dev/null
83bcdf
    output2=/dev/null
83bcdf
fi
83bcdf
83bcdf
# reload to pick up any changes to systemd files
83bcdf
/bin/systemctl daemon-reload >$output 2>&1 || :
83bcdf
83bcdf
# https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_allocation
83bcdf
# Soft static allocation for UID and GID
83bcdf
USERNAME="dirsrv"
83bcdf
ALLOCATED_UID=389
83bcdf
GROUPNAME="dirsrv"
83bcdf
ALLOCATED_GID=389
83bcdf
HOMEDIR="/usr/share/dirsrv"
83bcdf
83bcdf
getent group $GROUPNAME >/dev/null || /usr/sbin/groupadd -f -g $ALLOCATED_GID -r $GROUPNAME
83bcdf
if ! getent passwd $USERNAME >/dev/null ; then
83bcdf
    if ! getent passwd $ALLOCATED_UID >/dev/null ; then
83bcdf
      /usr/sbin/useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
83bcdf
    else
83bcdf
      /usr/sbin/useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
83bcdf
    fi
83bcdf
fi
83bcdf
83bcdf
# Reload our sysctl before we restart (if we can)
83bcdf
sysctl --system &> $output; true
83bcdf
83bcdf
%preun
83bcdf
if [ $1 -eq 0 ]; then # Final removal
83bcdf
    # remove instance specific service files/links
83bcdf
    rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
83bcdf
fi
83bcdf
83bcdf
%postun
83bcdf
if [ $1 = 0 ]; then # Final removal
83bcdf
    rm -rf /var/run/%{pkgname}
83bcdf
fi
83bcdf
83bcdf
%post snmp
83bcdf
%systemd_post %{pkgname}-snmp.service
83bcdf
83bcdf
%preun snmp
83bcdf
%systemd_preun %{pkgname}-snmp.service %{groupname}
83bcdf
83bcdf
%postun snmp
83bcdf
%systemd_postun_with_restart %{pkgname}-snmp.service
83bcdf
c384d7
%if %{use_legacy}
83bcdf
%post legacy-tools
83bcdf
83bcdf
# START UPGRADE SCRIPT
83bcdf
83bcdf
if [ -n "$DEBUGPOSTTRANS" ] ; then
83bcdf
    output=$DEBUGPOSTTRANS
83bcdf
    output2=${DEBUGPOSTTRANS}.upgrade
83bcdf
else
83bcdf
    output=/dev/null
83bcdf
    output2=/dev/null
83bcdf
fi
83bcdf
83bcdf
# find all instances
83bcdf
instances="" # instances that require a restart after upgrade
83bcdf
ninst=0 # number of instances found in total
83bcdf
83bcdf
echo looking for instances in %{_sysconfdir}/%{pkgname} > $output 2>&1 || :
83bcdf
instbase="%{_sysconfdir}/%{pkgname}"
83bcdf
for dir in $instbase/slapd-* ; do
83bcdf
    echo dir = $dir >> $output 2>&1 || :
83bcdf
    if [ ! -d "$dir" ] ; then continue ; fi
83bcdf
    case "$dir" in *.removed) continue ;; esac
83bcdf
    basename=`basename $dir`
83bcdf
    inst="%{pkgname}@`echo $basename | sed -e 's/slapd-//g'`"
83bcdf
    echo found instance $inst - getting status  >> $output 2>&1 || :
83bcdf
    if /bin/systemctl -q is-active $inst ; then
83bcdf
       echo instance $inst is running >> $output 2>&1 || :
83bcdf
       instances="$instances $inst"
83bcdf
    else
83bcdf
       echo instance $inst is not running >> $output 2>&1 || :
83bcdf
    fi
83bcdf
    ninst=`expr $ninst + 1`
83bcdf
done
83bcdf
if [ $ninst -eq 0 ] ; then
83bcdf
    echo no instances to upgrade >> $output 2>&1 || :
83bcdf
    exit 0 # have no instances to upgrade - just skip the rest
83bcdf
fi
83bcdf
# shutdown all instances
83bcdf
echo shutting down all instances . . . >> $output 2>&1 || :
83bcdf
for inst in $instances ; do
83bcdf
    echo stopping instance $inst >> $output 2>&1 || :
83bcdf
    /bin/systemctl stop $inst >> $output 2>&1 || :
83bcdf
done
83bcdf
echo remove pid files . . . >> $output 2>&1 || :
83bcdf
/bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid
83bcdf
# do the upgrade
83bcdf
echo upgrading instances . . . >> $output 2>&1 || :
83bcdf
DEBUGPOSTSETUPOPT=`/usr/bin/echo $DEBUGPOSTSETUP | /usr/bin/sed -e "s/[^d]//g"`
83bcdf
if [ -n "$DEBUGPOSTSETUPOPT" ] ; then
83bcdf
    %{_sbindir}/setup-ds.pl -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
83bcdf
else
83bcdf
    %{_sbindir}/setup-ds.pl -u -s General.UpdateMode=offline >> $output 2>&1 || :
83bcdf
fi
83bcdf
83bcdf
# restart instances that require it
83bcdf
for inst in $instances ; do
83bcdf
    echo restarting instance $inst >> $output 2>&1 || :
83bcdf
    /bin/systemctl start $inst >> $output 2>&1 || :
83bcdf
done
83bcdf
#END UPGRADE
83bcdf
%endif
83bcdf
83bcdf
exit 0
83bcdf
83bcdf
83bcdf
%files
83bcdf
%if %{bundle_jemalloc}
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.jemalloc
83bcdf
%license COPYING.jemalloc
83bcdf
%else
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl
83bcdf
%endif
83bcdf
%dir %{_sysconfdir}/%{pkgname}
83bcdf
%dir %{_sysconfdir}/%{pkgname}/schema
83bcdf
%config(noreplace)%{_sysconfdir}/%{pkgname}/schema/*.ldif
83bcdf
%dir %{_sysconfdir}/%{pkgname}/config
83bcdf
%dir %{_sysconfdir}/systemd/system/%{groupname}.wants
83bcdf
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/slapd-collations.conf
83bcdf
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/certmap.conf
83bcdf
%{_datadir}/%{pkgname}
83bcdf
%{_datadir}/gdb/auto-load/*
83bcdf
%{_unitdir}
83bcdf
%{_bindir}/dbscan
83bcdf
%{_mandir}/man1/dbscan.1.gz
83bcdf
%{_bindir}/ds-replcheck
83bcdf
%{_mandir}/man1/ds-replcheck.1.gz
83bcdf
%{_bindir}/ds-logpipe.py
83bcdf
%{_mandir}/man1/ds-logpipe.py.1.gz
83bcdf
%{_bindir}/ldclt
83bcdf
%{_mandir}/man1/ldclt.1.gz
83bcdf
%{_sbindir}/ldif2ldap
83bcdf
%{_mandir}/man8/ldif2ldap.8.gz
83bcdf
%{_bindir}/logconv.pl
83bcdf
%{_mandir}/man1/logconv.pl.1.gz
83bcdf
%{_bindir}/pwdhash
83bcdf
%{_mandir}/man1/pwdhash.1.gz
83bcdf
%{_bindir}/readnsstate
83bcdf
%{_mandir}/man1/readnsstate.1.gz
83bcdf
# Remove for now: %caps(CAP_NET_BIND_SERVICE=pe) {_sbindir}/ns-slapd
83bcdf
%{_sbindir}/ns-slapd
83bcdf
%{_mandir}/man8/ns-slapd.8.gz
83bcdf
%{_libexecdir}/%{pkgname}/ds_systemd_ask_password_acl
83bcdf
%{_mandir}/man5/99user.ldif.5.gz
83bcdf
%{_mandir}/man5/certmap.conf.5.gz
83bcdf
%{_mandir}/man5/slapd-collations.conf.5.gz
83bcdf
%{_mandir}/man5/dirsrv.5.gz
83bcdf
%{_mandir}/man5/dirsrv.systemd.5.gz
83bcdf
%{_libdir}/%{pkgname}/python
83bcdf
%dir %{_libdir}/%{pkgname}/plugins
83bcdf
%{_libdir}/%{pkgname}/plugins/*.so
83bcdf
# This has to be hardcoded to /lib - $libdir changes between lib/lib64, but
83bcdf
# sysctl.d is always in /lib.
83bcdf
%{_prefix}/lib/sysctl.d/*
83bcdf
%dir %{_localstatedir}/lib/%{pkgname}
83bcdf
%dir %{_localstatedir}/log/%{pkgname}
83bcdf
%ghost %dir %{_localstatedir}/lock/%{pkgname}
83bcdf
%exclude %{_sbindir}/ldap-agent*
83bcdf
%exclude %{_mandir}/man1/ldap-agent.1.gz
83bcdf
%exclude %{_unitdir}/%{pkgname}-snmp.service
83bcdf
%if %{bundle_jemalloc}
83bcdf
%{_libdir}/%{pkgname}/lib/
83bcdf
%{_libdir}/%{pkgname}/bin/
83bcdf
%exclude %{_libdir}/%{pkgname}/bin/jemalloc-config
83bcdf
%exclude %{_libdir}/%{pkgname}/bin/jemalloc.sh
83bcdf
%exclude %{_libdir}/%{pkgname}/lib/libjemalloc.a
83bcdf
%exclude %{_libdir}/%{pkgname}/lib/libjemalloc.so
83bcdf
%exclude %{_libdir}/%{pkgname}/lib/libjemalloc_pic.a
83bcdf
%exclude %{_libdir}/%{pkgname}/lib/pkgconfig
83bcdf
%endif
83bcdf
83bcdf
%files devel
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
83bcdf
%{_mandir}/man3/*
83bcdf
%{_includedir}/svrcore.h
83bcdf
%{_includedir}/%{pkgname}
83bcdf
%{_libdir}/libsvrcore.so
83bcdf
%{_libdir}/%{pkgname}/libslapd.so
83bcdf
%{_libdir}/%{pkgname}/libns-dshttpd.so
83bcdf
%{_libdir}/%{pkgname}/libsds.so
83bcdf
%{_libdir}/%{pkgname}/libldaputil.so
83bcdf
%{_libdir}/pkgconfig/svrcore.pc
83bcdf
%{_libdir}/pkgconfig/dirsrv.pc
83bcdf
%{_libdir}/pkgconfig/libsds.pc
83bcdf
83bcdf
%files libs
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
83bcdf
%dir %{_libdir}/%{pkgname}
83bcdf
%{_libdir}/libsvrcore.so.*
83bcdf
%{_libdir}/%{pkgname}/libslapd.so.*
83bcdf
%{_libdir}/%{pkgname}/libns-dshttpd-*.so
83bcdf
%{_libdir}/%{pkgname}/libsds.so.*
83bcdf
%{_libdir}/%{pkgname}/libldaputil.so.*
83bcdf
%if %{bundle_jemalloc}
83bcdf
%{_libdir}/%{pkgname}/lib/libjemalloc.so.2
83bcdf
%endif
83bcdf
%if %{use_rust}
83bcdf
%{_libdir}/%{pkgname}/librsds.so
83bcdf
%endif
83bcdf
c384d7
%if %{use_legacy}
83bcdf
%files legacy-tools
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
83bcdf
%{_bindir}/infadd
83bcdf
%{_mandir}/man1/infadd.1.gz
83bcdf
%{_bindir}/ldif
83bcdf
%{_mandir}/man1/ldif.1.gz
83bcdf
%{_bindir}/migratecred
83bcdf
%{_mandir}/man1/migratecred.1.gz
83bcdf
%{_bindir}/mmldif
83bcdf
%{_mandir}/man1/mmldif.1.gz
83bcdf
%{_bindir}/rsearch
83bcdf
%{_mandir}/man1/rsearch.1.gz
c384d7
%{_libexecdir}/%{pkgname}/ds_selinux_enabled
c384d7
%{_libexecdir}/%{pkgname}/ds_selinux_port_query
c384d7
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/template-initconfig
c384d7
%{_mandir}/man5/template-initconfig.5.gz
c384d7
%{_datadir}/%{pkgname}/properties/*.res
c384d7
%{_datadir}/%{pkgname}/script-templates
c384d7
%{_datadir}/%{pkgname}/updates
c384d7
%{_sbindir}/ldif2ldap
c384d7
%{_mandir}/man8/ldif2ldap.8.gz
c384d7
%{_sbindir}/bak2db
c384d7
%{_mandir}/man8/bak2db.8.gz
c384d7
%{_sbindir}/db2bak
c384d7
%{_mandir}/man8/db2bak.8.gz
c384d7
%{_sbindir}/db2index
c384d7
%{_mandir}/man8/db2index.8.gz
c384d7
%{_sbindir}/db2ldif
c384d7
%{_mandir}/man8/db2ldif.8.gz
c384d7
%{_sbindir}/dbverify
c384d7
%{_mandir}/man8/dbverify.8.gz
c384d7
%{_sbindir}/ldif2db
c384d7
%{_mandir}/man8/ldif2db.8.gz
c384d7
%{_sbindir}/restart-dirsrv
c384d7
%{_mandir}/man8/restart-dirsrv.8.gz
c384d7
%{_sbindir}/start-dirsrv
c384d7
%{_mandir}/man8/start-dirsrv.8.gz
c384d7
%{_sbindir}/status-dirsrv
c384d7
%{_mandir}/man8/status-dirsrv.8.gz
c384d7
%{_sbindir}/stop-dirsrv
c384d7
%{_mandir}/man8/stop-dirsrv.8.gz
c384d7
%{_sbindir}/upgradedb
c384d7
%{_mandir}/man8/upgradedb.8.gz
c384d7
%{_sbindir}/vlvindex
c384d7
%{_mandir}/man8/vlvindex.8.gz
83bcdf
%{_sbindir}/monitor
83bcdf
%{_mandir}/man8/monitor.8.gz
83bcdf
%{_sbindir}/dbmon.sh
83bcdf
%{_mandir}/man8/dbmon.sh.8.gz
83bcdf
%{_sbindir}/dn2rdn
83bcdf
%{_mandir}/man8/dn2rdn.8.gz
83bcdf
%{_sbindir}/restoreconfig
83bcdf
%{_mandir}/man8/restoreconfig.8.gz
83bcdf
%{_sbindir}/saveconfig
83bcdf
%{_mandir}/man8/saveconfig.8.gz
83bcdf
%{_sbindir}/suffix2instance
83bcdf
%{_mandir}/man8/suffix2instance.8.gz
83bcdf
%{_sbindir}/upgradednformat
83bcdf
%{_mandir}/man8/upgradednformat.8.gz
83bcdf
%{_mandir}/man1/dbgen.pl.1.gz
83bcdf
%{_bindir}/repl-monitor
83bcdf
%{_mandir}/man1/repl-monitor.1.gz
83bcdf
%{_bindir}/repl-monitor.pl
83bcdf
%{_mandir}/man1/repl-monitor.pl.1.gz
83bcdf
%{_bindir}/cl-dump
83bcdf
%{_mandir}/man1/cl-dump.1.gz
83bcdf
%{_bindir}/cl-dump.pl
83bcdf
%{_mandir}/man1/cl-dump.pl.1.gz
83bcdf
%{_bindir}/dbgen.pl
83bcdf
%{_mandir}/man8/bak2db.pl.8.gz
83bcdf
%{_sbindir}/bak2db.pl
83bcdf
%{_sbindir}/cleanallruv.pl
83bcdf
%{_mandir}/man8/cleanallruv.pl.8.gz
83bcdf
%{_sbindir}/db2bak.pl
83bcdf
%{_mandir}/man8/db2bak.pl.8.gz
83bcdf
%{_sbindir}/db2index.pl
83bcdf
%{_mandir}/man8/db2index.pl.8.gz
83bcdf
%{_sbindir}/db2ldif.pl
83bcdf
%{_mandir}/man8/db2ldif.pl.8.gz
83bcdf
%{_sbindir}/fixup-linkedattrs.pl
83bcdf
%{_mandir}/man8/fixup-linkedattrs.pl.8.gz
83bcdf
%{_sbindir}/fixup-memberof.pl
83bcdf
%{_mandir}/man8/fixup-memberof.pl.8.gz
83bcdf
%{_sbindir}/ldif2db.pl
83bcdf
%{_mandir}/man8/ldif2db.pl.8.gz
83bcdf
%{_sbindir}/migrate-ds.pl
83bcdf
%{_mandir}/man8/migrate-ds.pl.8.gz
83bcdf
%{_sbindir}/ns-accountstatus.pl
83bcdf
%{_mandir}/man8/ns-accountstatus.pl.8.gz
83bcdf
%{_sbindir}/ns-activate.pl
83bcdf
%{_mandir}/man8/ns-activate.pl.8.gz
83bcdf
%{_sbindir}/ns-inactivate.pl
83bcdf
%{_mandir}/man8/ns-inactivate.pl.8.gz
83bcdf
%{_sbindir}/ns-newpwpolicy.pl
83bcdf
%{_mandir}/man8/ns-newpwpolicy.pl.8.gz
83bcdf
%{_sbindir}/remove-ds.pl
83bcdf
%{_mandir}/man8/remove-ds.pl.8.gz
83bcdf
%{_sbindir}/schema-reload.pl
83bcdf
%{_mandir}/man8/schema-reload.pl.8.gz
83bcdf
%{_sbindir}/setup-ds.pl
83bcdf
%{_mandir}/man8/setup-ds.pl.8.gz
83bcdf
%{_sbindir}/syntax-validate.pl
83bcdf
%{_mandir}/man8/syntax-validate.pl.8.gz
83bcdf
%{_sbindir}/usn-tombstone-cleanup.pl
83bcdf
%{_mandir}/man8/usn-tombstone-cleanup.pl.8.gz
83bcdf
%{_sbindir}/verify-db.pl
83bcdf
%{_mandir}/man8/verify-db.pl.8.gz
83bcdf
%{_libdir}/%{pkgname}/perl
83bcdf
%endif
83bcdf
83bcdf
%files snmp
83bcdf
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
83bcdf
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf
83bcdf
%{_sbindir}/ldap-agent*
83bcdf
%{_mandir}/man1/ldap-agent.1.gz
83bcdf
%{_unitdir}/%{pkgname}-snmp.service
83bcdf
83bcdf
%files -n python%{python3_pkgversion}-lib389
83bcdf
%doc LICENSE LICENSE.GPLv3+
83bcdf
%{python3_sitelib}/lib389*
83bcdf
%{_sbindir}/dsconf
83bcdf
%{_mandir}/man8/dsconf.8.gz
83bcdf
%{_sbindir}/dscreate
83bcdf
%{_mandir}/man8/dscreate.8.gz
83bcdf
%{_sbindir}/dsctl
83bcdf
%{_mandir}/man8/dsctl.8.gz
83bcdf
%{_sbindir}/dsidm
83bcdf
%{_mandir}/man8/dsidm.8.gz
83bcdf
%{_sbindir}/dscontainer
83bcdf
83bcdf
%files -n cockpit-389-ds -f cockpit.list
83bcdf
%{_datarootdir}/metainfo/389-console/org.port389.cockpit_console.metainfo.xml
83bcdf
%doc README.md
83bcdf
83bcdf
%changelog
c384d7
* Wed Nov 27 2019 Mark Reynolds <mreynolds@redhat.com> - 1.4.2.4-4
c384d7
- Bump version to 1.4.2.4-4
c384d7
- Resolves: Bug 1685160 - [RFE] 389-DS Health Check Tool
83bcdf
c384d7
* Fri Nov 15 2019 Mark Reynolds <mreynolds@redhat.com> - 1.4.2.4-3
c384d7
- Bump version to 1.4.2.4-3
c384d7
- Issue 50712 - Version comparison doesn't work correctly on git builds (relates to #1748994)
83bcdf
c384d7
* Fri Nov 15 2019 Matus Honek <mhonek@redhat.com> - 1.4.2.4-2
c384d7
- Bump version to 1.4.2.4-2
c384d7
- Fix missing runtime lib389 dependency (relates to #1748994)
83bcdf
c384d7
* Thu Nov 14 2019 Mark Reynolds <mreynolds@redhat.com> - 1.4.2.4-1
c384d7
- Bump verison to 1.4.2.4-1
c384d7
- Resolves: Bug 1748994 - Rebase 389-ds-base to 1.4.2 
83bcdf