5462cd5
%global pkgname   dirsrv
5462cd5
# for a pre-release, define the prerel field - comment out for official release
4f2637a
%global prerel .rc1
31c893f
# also need the relprefix 0. field for a pre-release - also comment out for official release
31c893f
%global relprefix 0.
31c893f
31c893f
%global selinux_variants mls targeted
54cf04a
abf6aec
Summary:          389 Administration Server (admin)
abf6aec
Name:             389-admin
31c893f
Version:          1.1.11
4f2637a
Release:          %{?relprefix}5%{?prerel}%{?dist}
abf6aec
License:          GPLv2 and ASL 2.0
abf6aec
URL:              http://port389.org/
abf6aec
Group:            System Environment/Daemons
abf6aec
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
abf6aec
Provides:         fedora-ds-admin = %{version}-%{release}
abf6aec
Obsoletes:        fedora-ds-admin < 1.1.8-1
63e6027
Obsoletes:        %{name}-selinux
abf6aec
abf6aec
BuildRequires:    nspr-devel
abf6aec
BuildRequires:    nss-devel
abf6aec
BuildRequires:    svrcore-devel
abf6aec
BuildRequires:    mozldap-devel
abf6aec
BuildRequires:    cyrus-sasl-devel
abf6aec
BuildRequires:    icu
abf6aec
BuildRequires:    libicu-devel
abf6aec
BuildRequires:    httpd-devel
abf6aec
BuildRequires:    apr-devel
abf6aec
BuildRequires:    mod_nss
b1c4213
BuildRequires:    389-adminutil-devel
abf6aec
31c893f
# The following are needed to build the SELinux policy
31c893f
BuildRequires:    checkpolicy
31c893f
BuildRequires:    selinux-policy-devel
31c893f
BuildRequires:    /usr/share/selinux/devel/Makefile
31c893f
BuildRequires:    389-ds-base-selinux-devel
31c893f
abf6aec
Requires:         389-ds-base
abf6aec
Requires:         mod_nss
3ca1810
3ca1810
# this is needed for using semanage from our setup scripts
3ca1810
Requires:         policycoreutils-python
3ca1810
63e6027
# this is needed to load and unload the policy module
63e6027
Requires(post):         policycoreutils
63e6027
Requires(preun):        policycoreutils
63e6027
Requires(postun):       policycoreutils
63e6027
abf6aec
# the following are needed for some of our scripts
abf6aec
Requires:         perl-Mozilla-LDAP
abf6aec
Requires:         nss-tools
abf6aec
abf6aec
# for the init script
abf6aec
Requires(post): /sbin/chkconfig
abf6aec
Requires(preun): /sbin/chkconfig
abf6aec
Requires(preun): /sbin/service
abf6aec
5462cd5
Source0:          http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
abf6aec
# 389-admin-git.sh should be used to generate the source tarball from git
abf6aec
Source1:          %{name}-git.sh
abf6aec
Patch1:           f11-httpd.patch
abf6aec
abf6aec
%description
abf6aec
389 Administration Server is an HTTP agent that provides management features
abf6aec
for 389 Directory Server.  It provides some management web apps that can
abf6aec
be used through a web browser.  It provides the authentication, access control,
abf6aec
and CGI utilities used by the console.
abf6aec
abf6aec
%prep
5462cd5
%setup -q -n %{name}-%{version}%{?prerel}
abf6aec
%patch1
abf6aec
abf6aec
%build
31c893f
%configure --disable-rpath --with-selinux
abf6aec
abf6aec
# Generate symbolic info for debuggers
abf6aec
export XCFLAGS=$RPM_OPT_FLAGS
abf6aec
abf6aec
%ifarch x86_64 ppc64 ia64 s390x sparc64
abf6aec
export USE_64=1
abf6aec
%endif
abf6aec
abf6aec
make %{?_smp_mflags}
abf6aec
31c893f
# Build the SELinux policy module for each variant
31c893f
cd selinux-built
31c893f
cp %{_datadir}/%{pkgname}-selinux/%{pkgname}.if .
31c893f
cp %{_datadir}/%{pkgname}-selinux/%{pkgname}.te .
31c893f
for selinuxvariant in %{selinux_variants}
31c893f
do
31c893f
  make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
31c893f
  mv %{pkgname}-admin.pp %{pkgname}-admin.pp.${selinuxvariant}
31c893f
  make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
31c893f
done
31c893f
cd -
31c893f
abf6aec
%install
abf6aec
rm -rf $RPM_BUILD_ROOT 
abf6aec
abf6aec
make DESTDIR="$RPM_BUILD_ROOT" install
abf6aec
abf6aec
# make console jars directory
abf6aec
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/html/java
abf6aec
abf6aec
#remove libtool and static libs
abf6aec
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
abf6aec
rm -f $RPM_BUILD_ROOT%{_libdir}/*.so
abf6aec
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
abf6aec
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/modules/*.a
abf6aec
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/modules/*.la
abf6aec
31c893f
# Install the SELinux policy
31c893f
cd selinux-built
31c893f
for selinuxvariant in %{selinux_variants}
31c893f
do
31c893f
  install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
31c893f
  install -p -m 644 %{pkgname}-admin.pp.${selinuxvariant} \
31c893f
    %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{pkgname}-admin.pp
31c893f
done
31c893f
cd -
31c893f
abf6aec
%clean
abf6aec
rm -rf $RPM_BUILD_ROOT
abf6aec
e89a822
%pre -p <lua>
e89a822
-- save ownership/permissions on the dirs/files that rpm changes
e89a822
-- if these don't exist, the vars will be nil
e89a822
%{pkgname}admin_adminserv = posix.stat('%{_sysconfdir}/%{pkgname}/admin-serv')
e89a822
%{pkgname}admin_consoleconf = posix.stat('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf')
e89a822
-- save the run level configuration, if any
e89a822
rc = os.execute('rpm --quiet -q fedora-ds-admin')
e89a822
if rc == 0 then
e89a822
    %{pkgname}admin_exists = true
e89a822
    %{pkgname}admin_savelinks = {}
e89a822
    for dir in posix.files("%{_sysconfdir}/rc.d") do
e89a822
        if string.find(dir, "rc%d.d") then
e89a822
--          print("looking in %{_sysconfdir}/rc.d/"..dir)
e89a822
            for link in posix.files("%{_sysconfdir}/rc.d/"..dir) do
e89a822
                if string.find(link, "[SK]%d%d%{pkgname}-admin") then
e89a822
                    fullname = "%{_sysconfdir}/rc.d/"..dir.."/"..link
e89a822
                    linked = posix.readlink(fullname)
e89a822
--                  print(fullname.." is linked to "..linked)
e89a822
                    %{pkgname}_savelinks[fullname] = linked
e89a822
                end
e89a822
            end
e89a822
        end
e89a822
    end
e89a822
end
e89a822
e89a822
%post -p <lua>
e89a822
-- do the usual daemon post setup stuff
e89a822
os.execute('/sbin/chkconfig --add %{pkgname}-admin')
e89a822
os.execute('/sbin/ldconfig')
e89a822
-- restore permissions if upgrading
e89a822
if %{pkgname}admin_adminserv then
e89a822
    posix.chmod('%{_sysconfdir}/%{pkgname}/admin-serv', %{pkgname}admin_adminserv.mode)
e89a822
    posix.chown('%{_sysconfdir}/%{pkgname}/admin-serv', %{pkgname}admin_adminserv.uid, %{pkgname}admin_adminserv.gid)
e89a822
end
e89a822
if %{pkgname}admin_consoleconf then
e89a822
    posix.chmod('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf', %{pkgname}admin_consoleconf.mode)
e89a822
    posix.chown('%{_sysconfdir}/%{pkgname}/admin-serv/console.conf', %{pkgname}admin_consoleconf.uid, %{pkgname}admin_consoleconf.gid)
e89a822
end
63e6027
-- load the selinux policy module
63e6027
variants = "%{selinux_variants}"
63e6027
for selinuxvariant in string.gfind(variants, "%a+") do
63e6027
  os.execute('semodule -s '..selinuxvariant..' -i %{_datadir}/selinux/'..selinuxvariant..'/%{pkgname}-admin.pp > /dev/null 2>&1')
63e6027
end
63e6027
-- label the files installed by this package
63e6027
os.execute('fixfiles -R %{name} restore > /dev/null 2>&1')
abf6aec
abf6aec
%preun
abf6aec
if [ $1 = 0 ]; then
abf6aec
        /sbin/service %{pkgname}-admin stop >/dev/null 2>&1 || :
abf6aec
        /sbin/chkconfig --del %{pkgname}-admin
63e6027
        for selinuxvariant in %{selinux_variants}
63e6027
        do
63e6027
          semodule -s ${selinuxvariant} -r %{pkgname}-admin 2>/dev/null || :
63e6027
        done
abf6aec
fi
abf6aec
63e6027
%postun
63e6027
/sbin/ldconfig
63e6027
if [ "$1" -ge "1" ]; then # Upgrade
63e6027
for selinuxvariant in %{selinux_variants}
63e6027
do
63e6027
  semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/%{pkgname}-admin.pp 2>/dev/null || :
63e6027
done
63e6027
fi
abf6aec
e89a822
%posttrans -p <lua>
e89a822
-- if we saved the run level configuration in %pre, restore it now
e89a822
-- we can get rid of this code once Fedora 11 becomes obsolete
e89a822
if %{pkgname}admin_savelinks then
e89a822
    for fullpath,link in pairs(%{pkgname}admin_savelinks) do
e89a822
        posix.symlink(link,fullpath)
e89a822
--        print("posttrans - restored run level "..fullpath.." to "..link)
e89a822
    end
e89a822
end
e89a822
if %{pkgname}admin_exists then
e89a822
    os.execute('/sbin/service %{pkgname}-admin start >/dev/null 2>&1')
e89a822
end
e89a822
31c893f
abf6aec
%files
abf6aec
%defattr(-,root,root,-)
abf6aec
%doc LICENSE
abf6aec
%dir %{_sysconfdir}/%{pkgname}/admin-serv
abf6aec
%config(noreplace)%{_sysconfdir}/%{pkgname}/admin-serv/*.conf
abf6aec
%{_datadir}/%{pkgname}
63e6027
%{_datadir}/selinux/*/%{pkgname}-admin.pp
abf6aec
%{_sysconfdir}/rc.d/init.d/%{pkgname}-admin
abf6aec
%config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}-admin
abf6aec
%{_sbindir}/*
abf6aec
%{_libdir}/*.so.*
abf6aec
%{_libdir}/%{pkgname}
abf6aec
%{_mandir}/man8/*
abf6aec
abf6aec
%changelog
4f2637a
* Wed Jun  9 2010 Rich Megginson <rmeggins@redhat.com> - 1.1.11-0.5.rc1
4f2637a
- 1.1.11.rc1 release
4f2637a
13ae0df
* Wed May 26 2010 Rich Megginson <rmeggins@redhat.com> - 1.1.11-0.4.a4
13ae0df
- 1.1.11.a4 release
13ae0df
63e6027
* Tue Apr  7 2010 Nathan Kinder <nkinder@redhat.com> - 1.1.11-0.3.a3
3ca1810
- 1.1.11.a3 release
3ca1810
- Bug 570912 - dirsrv-admin SELinux module fails to install
3ca1810
- Change parsing of start-slapd for instance name
63e6027
- Bug 574233 - Updated requirements for selinux policy
63e6027
- Moved selinux subpackage into base package
3ca1810
8194cf1
* Fri Feb 26 2010 Rich Megginson <rmeggins@redhat.com> - 1.1.11.a2-0.2
8194cf1
- the 1.1.11.a2 release
8194cf1
- Bug 460162 - FedoraDS "with-FHS" installs init.d StartupScript in wrong location
8194cf1
- Bug 460209 - Correct configure help message
8194cf1
- Bug 560827 - Admin Server: DistinguishName validation fails
8194cf1
- Make check for threaded httpd work with Apache 2.0
8194cf1
31c893f
* Thu Jan 21 2010 Nathan Kinder <nkinder@redhat.com> - 1.1.11.a1-0.1
31c893f
- the 1.1.11.a1 release
31c893f
- added SELinux subpackage
31c893f
3eb9c39
* Wed Jan 20 2010 Rich Megginson <rmeggins@redhat.com> - 1.1.10-1
3eb9c39
- the 1.1.10 release
3eb9c39
- allow server to run unconfined if not built with selinux support
54cf04a
db21b43
* Thu Jan 14 2010 Rich Megginson <rmeggins@redhat.com> - 1.1.10.a3-0.3
db21b43
- the 1.1.10.a3 release
db21b43
- make sure we can find ICU genrb on all platforms
db21b43
def76e0
* Fri Dec 18 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.10.a2-0.2
def76e0
- the 1.1.10.a2 release
def76e0
- fix problem with genrb path on F-12 and later
def76e0
5462cd5
* Thu Oct  8 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.10.a1-1
5462cd5
- the 1.1.10.a1 release
5462cd5
18e9a9a
* Mon Sep 14 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.9-1
18e9a9a
- the 1.1.9 release
18e9a9a
e89a822
* Tue Aug 25 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.8-4
e89a822
- resolves 518418 -  Package rename shuts down server, results in unconfigured package
e89a822
- rewrite perm/owner preservation code to use lua
e89a822
- add lua code to save run level configuration
e89a822
453defe
* Wed Aug 12 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.8-3
453defe
- final rebuild for 1.1.8 release
453defe
19faebe
* Tue Jul 21 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.8-2
b1c4213
- change adminutil to 389-adminutil
b1c4213
abf6aec
* Thu Jun 18 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.8-1
abf6aec
- bump version to 1.1.8
abf6aec
- change license to GPLv2 + ASL 2.0
abf6aec
- changed files that were incorrectly licensed as GPLv2+ to plain GPLv2
abf6aec
abf6aec
* Wed May 13 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.7-5
abf6aec
- rename to 389
abf6aec
abf6aec
* Thu Apr  9 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.7-4
abf6aec
- Resolves: bug 493424
abf6aec
- Description: dirsrv-admin initscript looks for nonexistent library
abf6aec
- Added patch to remove those modules from the httpd.conf
abf6aec
abf6aec
* Wed Apr  8 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.7-3
abf6aec
- Resolves: bug 494980
abf6aec
- Description: setup-ds-admin.pl -u and silent setup complain about ServerIpAddress
abf6aec
- CVS tag FedoraDirSrvAdmin_1_1_7_RC3 FedoraDirSrvAdmin_1_1_7_RC3_20090408
abf6aec
abf6aec
* Fri Apr  3 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.7-2
abf6aec
- Resolves: bug 493989
abf6aec
- Description: Admin Server: valgrind invalid read in security.c when installing CRL
abf6aec
abf6aec
* Tue Mar 31 2009 Rich Megginson <rmeggins@redhat.com> - 1.1.7-1
abf6aec
- this is the 1.1.7 release
abf6aec
- added man pages for setup, migration, remove commands
abf6aec
- better error handling for command line utilities
abf6aec
- fixed remove from console
abf6aec
- added remove-ds-admin.pl
abf6aec
- added pre and post sections in order to preserve the permissions and ownerships
abf6aec
- CVS tag FedoraDirSrvAdmin_1_1_7_RC1 FedoraDirSrvAdmin_1_1_7_RC1_20090331
abf6aec
abf6aec
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.6-3
abf6aec
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
abf6aec
abf6aec
* Mon Sep 15 2008 Rich Megginson <rmeggins@redhat.com> - 1.1.6-2
abf6aec
- patch for bug 451702 not required anymore - in upstream now
abf6aec
abf6aec
* Wed Jul  2 2008 Rich Megginson <rmeggins@redhat.com> - 1.1.6-1
abf6aec
- add patch for bug 451702
abf6aec
- The 1.1.6 release
abf6aec
abf6aec
* Fri Jun  6 2008 Rich Megginson <rmeggins@redhat.com> - 1.1.5-1
abf6aec
- Resolves: Bug 448366
abf6aec
- genrb no longer supports -p option
abf6aec
abf6aec
* Tue Apr 15 2008 Rich Megginson <rmeggins@redhat.com> - 1.1.4-1
abf6aec
- Resolves: Bug 437301
abf6aec
- Directory Server: shell command injection in CGI replication monitor
abf6aec
- Fix: rewrite the perl script to ignore all input parameters - replmon.conf
abf6aec
- file will have to be hard coded to be in the admin-serv directory
abf6aec
- Resolves: Bug 437320
abf6aec
- Directory Server: unrestricted access to CGI scripts
abf6aec
- Fix: remove script alias for /bin/admin/admin/bin/
abf6aec
abf6aec
* Wed Jan  9 2008 Rich Megginson <rmeggins@redhat.com> - 1.1.2-1
abf6aec
- Fix issues associated with Fedora pkg review bug 249548
abf6aec
abf6aec
* Tue Dec 11 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.1-1
abf6aec
- this is the final GA candidate
abf6aec
abf6aec
* Tue Nov  6 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.16
abf6aec
- fix several beta blocker issues
abf6aec
abf6aec
* Mon Oct 15 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.15
abf6aec
- fix bogus dist macro
abf6aec
- change mozldap6 to mozldap
abf6aec
abf6aec
* Thu Oct 11 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.14
abf6aec
- make admin server work with SELinux enabled
abf6aec
- fix wording errors in setup
abf6aec
abf6aec
* Mon Oct  8 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.13
abf6aec
- added /etc/sysconfig/dirsrv-admin the file that allows you to set
abf6aec
- the environment used to start up the admin server (e.g. keytab, ulimit, etc.)
abf6aec
- the initscript and admin start script use this file now
abf6aec
- This version also has a fix to print the correct error message if the admin
abf6aec
- server cannot be contacted during setup or migration.
abf6aec
abf6aec
* Thu Sep 27 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.12
abf6aec
- fix a couple of migration issues, including the rpath $libdir problem
abf6aec
- allow ds_remove from console to remove instances
abf6aec
abf6aec
* Wed Sep 19 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.11
abf6aec
- one line fix to fix of 295001 - console.conf clobbered
abf6aec
abf6aec
* Tue Sep 18 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.10
abf6aec
- fixed migration issue bugzilla 295001 - console.conf clobbered
abf6aec
abf6aec
* Fri Sep 14 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.9
abf6aec
- fix several more migration problems
abf6aec
abf6aec
* Fri Sep 14 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.8
abf6aec
- fix migration - servers are started as they are migrated now
abf6aec
abf6aec
* Tue Aug 21 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.7
abf6aec
- Fix the with-fhs-opt configure flag
abf6aec
abf6aec
* Fri Aug 17 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.6
abf6aec
- remove curses
abf6aec
- make mod_admserv link against sasl
abf6aec
- add the usual .m4 files to mod_admserv instead of having all of
abf6aec
- the component logic in configure.in
abf6aec
abf6aec
* Thu Aug 16 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.5
abf6aec
- incorporate Noriko's migration fix
abf6aec
abf6aec
* Wed Aug 15 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.4
abf6aec
- address several migration issues
abf6aec
abf6aec
* Mon Aug 13 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.3
abf6aec
- there is no devel package, so remove unused .so files
abf6aec
abf6aec
* Mon Aug 13 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.2
abf6aec
- forgot to tag the modules
abf6aec
abf6aec
* Fri Aug 10 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-1.1
abf6aec
- get rid of cvsdate
abf6aec
- use pkgname of dirsrv for filesystem path naming
abf6aec
- get rid of devel package
abf6aec
- simplify files section
abf6aec
abf6aec
* Fri Aug 10 2007 Noriko Hosoi <nhosoi@redhat.com> - 1.1.0-0.3.20070810
abf6aec
- updated to latest sources
abf6aec
- upgraded the mozldap6 version to 6.0.4
abf6aec
abf6aec
* Wed Aug  8 2007 Noriko Hosoi <nhosoi@redhat.com> - 1.1.0-0.2.20070808
abf6aec
- updated to latest sources -- bug fixes in the setup scripts
abf6aec
abf6aec
* Mon Aug  6 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.1.20070806
abf6aec
- updated to latest sources
abf6aec
abf6aec
* Thu Aug  2 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.4.20070802
abf6aec
- There are no files in bindir anymore
abf6aec
abf6aec
* Thu Aug  2 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.3.20070802
abf6aec
- forgot to prepend build root to java dir creation
abf6aec
abf6aec
* Thu Aug  2 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.2.20070802
abf6aec
- forgot to add mod_admserv and mod_restartd to source
abf6aec
abf6aec
* Thu Aug  2 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.1.20070802
abf6aec
- updated to latest sources - fix build breakage
abf6aec
- add console jars dir under html
abf6aec
abf6aec
* Mon Jul 23 2007 Rich Megginson <rmeggins@redhat.com> - 1.1.0-0.1.20070725
abf6aec
- Initial version based on fedora-ds-base.spec