summaryrefslogtreecommitdiffstats
path: root/ldapserver.spec.tmpl
blob: 3b1518a0f62783d0bc779d37fb6221112c9c6b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# BEGIN COPYRIGHT BLOCK
# This Program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 2 of the License.
# 
# This Program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along with
# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# 
# In addition, as a special exception, Red Hat, Inc. gives You the additional
# right to link the code of this Program with code not covered under the GNU
# General Public License ("Non-GPL Code") and to distribute linked combinations
# including the two, subject to the limitations in this paragraph. Non-GPL Code
# permitted under this exception must only link to the code of this Program
# through those well defined interfaces identified in the file named EXCEPTION
# found in the source code files (the "Approved Interfaces"). The files of
# Non-GPL Code may instantiate templates or use macros or inline functions from
# the Approved Interfaces without causing the resulting work to be covered by
# the GNU General Public License. Only Red Hat, Inc. may make changes or
# additions to the list of Approved Interfaces. You must obey the GNU General
# Public License in all respects for all of the Program code and other code used
# in conjunction with the Program except the Non-GPL Code covered by this
# exception. If you modify this file, you may extend this exception to your
# version of the file, but you are not obligated to do so. If you do not wish to
# provide this exception without modification, you must delete this exception
# statement from your version and license this file solely under the GPL without
# exception. 
# 
# 
# Copyright (C) 2005 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
# The way we do packaging seems to leave unpackaged files in the builddir;
# however, we really don't want them
%define _unpackaged_files_terminate_build 0
# override the default build name format - we do not want the arch subdir
%define _build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.%{flavor}.rpm
# don't bother stripping - we already do this for optimized, and we definitely
# want the symbols in the debug builds
%define __os_install_post %{nil}
Summary: @COMPANY-PRODUCT-NAME@
Name: @LCASE-COMPANY-NAME-NOSP@-ds
Version: @NOSP-VERSION@
Release: 1.@PLATFORM@
License: GPL plus extensions
Group: System Environment/Daemons
URL: @COMPANY-URL@
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_builddir}
BuildPreReq: perl, fileutils, make
# Without Autoreq: 0, rpmbuild finds all sorts of crazy
# dependencies that we don't care about, and refuses to install
Autoreq: 0
# Don't automatically generate provides list
AutoProv: 0
# Without Requires: something, rpmbuild will abort!
Requires: perl,httpd,cyrus-sasl >= 2.1.15
Prefix: /opt/%{name}

%description
@COMPANY-PRODUCT-NAME@ is an LDAPv3 compliant server.

# wait! what's going on here?  where are the prep and build sections?
# what kind of a .spec file is this anyway?
# A: one that works well with the current DS build system
# As we move towards a completely open source build
# process, will begin doing things in the more RPM way
# but for now, in order to make our tight deadlines and
# support RHN distribution, this is the way we do it

%install
# all we do here is run setup -b to unpack the binaries
# into the BuildRoot
# the echo yes is for dsktune to continue
# the second echo yes is for some platforms that need it
(echo yes ; echo yes) | ./setup -b $RPM_BUILD_ROOT/%{prefix}
# remove the setup log files so they aren't packaged
rm -f $RPM_BUILD_ROOT/%{prefix}/setup/*/*.log

%clean
if [ -z "$RPM_INSTALL_PREFIX" ]; then
	RPM_INSTALL_PREFIX=%{prefix}
fi
rm -rf $RPM_BUILD_ROOT/$RPM_INSTALL_PREFIX

%files
# rather than listing individual files, we just package (and own)
# the entire ldapserver directory - if we change this to put
# files in different places, we won't be able to do this anymore
%defattr(-,root,root,-)
%{prefix}

%pre
# in case upgrade, need to shutdown the servers before the installation
ls $RPM_INSTALL_PREFIX/slapd-* > /dev/null 2>&1
if [ $? -eq 0 ]; then
  for instance in `ls -d $RPM_INSTALL_PREFIX/slapd-*`
  do
    if [ -f $instance/logs/pid ]; then
      pid=`cat $instance/logs/pid`
      psval=`ps -ef | egrep $pid`
      if [ "$psval" != "" ]; then
        $instance/stop-slapd
      fi
    fi
  done
fi
if [ -f $RPM_INSTALL_PREFIX/admin-serv/logs/pid ]; then
  pid=`cat $RPM_INSTALL_PREFIX/admin-serv/logs/pid`
  psval=`ps -ef | egrep $pid`
  if [ "$psval" != "" ]; then
    $RPM_INSTALL_PREFIX/stop-admin
  fi
fi

%post
echo ""
if [ -z "$RPM_INSTALL_PREFIX" ]; then
	RPM_INSTALL_PREFIX=%{prefix}
fi
# patch file to fix console ld libpath
if [ -f $RPM_INSTALL_PREFIX/setup/console-ld-libpath.patch ] ; then
    patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/console-ld-libpath.patch > /dev/null 2>&1
fi
if [ "$1" -gt 1 ] ; then
# patch file to upgrade admin server from 1.0 to 1.0.1
    if [ -f $RPM_INSTALL_PREFIX/setup/adminserver10to101.patch ] ; then
        patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/adminserver10to101.patch > /dev/null 2>&1
    fi
# patch file to fix start-admin on Fedora Core 2
    if [ -f $RPM_INSTALL_PREFIX/setup/adminserver-start-admin.patch ] ; then
        patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/adminserver-start-admin.patch > /dev/null 2>&1
    fi
# patch file to fix module load order
    if [ -f $RPM_INSTALL_PREFIX/setup/adminserver-httpd-moduleorder.patch ] ; then
        patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/adminserver-httpd-moduleorder.patch > /dev/null 2>&1
    fi
# patch file to fix use of admpw for basic auth in the template file
    if [ -f $RPM_INSTALL_PREFIX/setup/admserv-conf-tmpl.patch ] ; then
        patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/admserv-conf-tmpl.patch > /dev/null 2>&1
    fi
# patch file to fix use of admpw for basic auth in the real config file
    if [ -f $RPM_INSTALL_PREFIX/setup/admserv-conf-admpw.patch ] ; then
        patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/admserv-conf-admpw.patch > /dev/null 2>&1
    fi
# fix up file permissions
    testfile=$RPM_INSTALL_PREFIX/admin-serv/config/nss.conf
    if [ ! -f $testfile ] ; then
        testfile=$RPM_INSTALL_PREFIX/admin-serv/config/adm.conf
    fi
    if [ -f $testfile ] ; then
        usergroup=`ls -l $testfile | awk '{print $3":"$4}'`
        if [ -d $RPM_INSTALL_PREFIX/admin-serv/config ] ; then
            chown $usergroup $RPM_INSTALL_PREFIX/admin-serv/config
        fi
        if [ -d $RPM_INSTALL_PREFIX/bin/slapd/authck ] ; then
            chown $usergroup $RPM_INSTALL_PREFIX/bin/slapd/authck
        fi
        if [ -d $RPM_INSTALL_PREFIX/alias ] ; then
            chown $usergroup $RPM_INSTALL_PREFIX/alias
        fi
    fi
    echo "Upgrade finished.  Please run $RPM_INSTALL_PREFIX/setup/setup to complete the upgrade." 
else
    echo "Install finished.  Please run $RPM_INSTALL_PREFIX/setup/setup to complete installation and set up the servers."
fi

%preun
# only run uninstall if this is the last version of the package
if [ "$1" = 0 ] ; then
	if [ -z "$RPM_INSTALL_PREFIX" ]; then
		RPM_INSTALL_PREFIX=%{prefix}
	fi
	cd $RPM_INSTALL_PREFIX
	./uninstall -s -force
fi

%changelog
* Wed Mar  1 2006 Rich Megginson <rmeggins@redhat.com> - 1.0.2-1
- Added admserv-conf-tmpl.patch and admserv-conf-admpw.patch to fix the use of admpw for basic auth

* Wed Feb 22 2006 Rich Megginson <rmeggins@redhat.com> - 1.0.2-1
- Add patch to fix admin server httpd module load order; you
- must now run setup after an upgrade; copy in the new 00core.ldif
- schema file to the server instances

* Tue Dec  6 2005 Rich Megginson <rmeggins@redhat.com> - 1.0.1-1
- Use nosp version instead of gen version to get patch version numbers
- Patch the admin server in the post install section
- Remove the unnecessary log files after setup so they aren't packaged

* Wed Nov 09 2005 Nathan Kinder <nkinder@redhat.com> 7.1-2
- Changed cyrus-sasl dependency to >= 2.1.15 for RHEL3 compatibility

* Fri Nov 04 2005 Noriko Hosoi <nhosoi@redhat.com> 7.1-2
- Added a dependency: cyrus-sasl >= 2.1.19

* Wed Sep 14 2005 Nathan Kinder <nkinder@redhat.com> 7.1-2
- Added a dependency on the java-1.4.2-ibm package

* Tue May 10 2005 Richard Megginson <rmeggins@redhat.com> 7.1-2
- Change release to 2

* Fri Apr  8 2005 Rich Megginson <rmeggins@redhat.com> 7.1-1
- check for last version removal in preun

* Tue Apr  5 2005 Rich Megginson <rmeggins@redhat.com> 7.1-1
- make rpm name .flavor.rpm - flavor must be defined in rpmbuild

* Tue Apr  5 2005 Rich Megginson <rmeggins@redhat.com> 7.1-1
- Removed all of the setup and build stuff - just use the regular DS build process for that

* Tue Apr  5 2005 Rich Megginson <rmeggins@redhat.com> 7.1-1
- use platform specific packaging directory; add preun to do uninstall

* Fri Apr  1 2005 Rich Megginson <rmeggins@redhat.com> 7.1-1
- use setup -q to suppress tar output

* Tue Mar 29 2005 Richard Megginson <rmeggins@redhat.com> 7.1-1
- use INTERNAL_BUILD=1 for internal builds - change rev to 1

* Tue Mar  8 2005 Richard Megginson <rmeggins@redhat.com> 7.1-0
- use ${prefix} instead of /opt/ldapserver - prefix is defined as /opt/%{name}

* Thu Jan 20 2005 Richard Megginson <rmeggins@redhat.com>
- Initial build.