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