You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

155 lines
6.0 KiB

##
## apacheds.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_major 1.5
%define V_minor 7
# package information
Name: apacheds
Summary: Apache Directory Server
URL: http://directory.apache.org/
Vendor: Apache Software Foundation
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: LDAP
License: Apache
Version: %{V_major}.%{V_minor}
Release: 20120715
# list of sources
Source0: http://www.apache.org/dist/directory/apacheds/unstable/%{V_major}/%{V_major}.%{V_minor}/apacheds-%{V_major}.%{V_minor}.tar.gz
Source1: apacheds-tools.sh
Source2: apacheds-passwd.sh
Source3: rc.apacheds
Patch0: apacheds.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101, java, JAVA-JDK
%description
The Apache Directory Server is an LDAP server which has been
certified as LDAPv3 compliant by the Open Group.
%track
prog apacheds = {
version = %{version}
url = http://www.apache.org/dist/directory/apacheds/unstable/
regex = (\d+\.\d+)/
url = http://www.apache.org/dist/directory/apacheds/unstable/__NEWVER__/
regex = (\d+\.\d+\.\d+)/
}
%prep
%setup -q -n apacheds_%{V_major}.%{V_minor}
%patch -p0
%build
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/apacheds \
$RPM_BUILD_ROOT%{l_prefix}/etc/apacheds/ldif \
$RPM_BUILD_ROOT%{l_prefix}/libexec/apacheds \
$RPM_BUILD_ROOT%{l_prefix}/var/apacheds/log \
$RPM_BUILD_ROOT%{l_prefix}/var/apacheds/run \
$RPM_BUILD_ROOT%{l_prefix}/var/apacheds/db
# install default configuration files
%{l_shtool} install -c -m 644 \
-e 's;WARN, stdout, R;WARN, R;' \
-e 's;MaxBackupIndex=5;MaxBackupIndex=10;' \
-e 's;apacheds-rolling\.log;%{l_prefix}/var/apacheds/log/apacheds.daemon.log;' \
conf/log4j.properties $RPM_BUILD_ROOT%{l_prefix}/etc/apacheds/
%{l_shtool} install -c -m 644 \
-e 's;\(workingDirectory="\)example\.com;\1%{l_prefix}/var/apacheds/db;' \
-e 's;<value>ldif</value>;<value>%{l_prefix}/etc/apacheds/ldif</value>;' \
conf/server.xml $RPM_BUILD_ROOT%{l_prefix}/etc/apacheds/
%{l_shtool} install -c -m 644 \
conf/apacheds.conf $RPM_BUILD_ROOT%{l_prefix}/etc/apacheds/
# install program
%{l_shtool} install -c -m 755 \
bin/*.jar lib/*.jar $RPM_BUILD_ROOT%{l_prefix}/libexec/apacheds/
# install tools script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE apacheds-tools.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/apacheds-tools
# install passwd script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE apacheds-passwd.sh} $RPM_BUILD_ROOT%{l_prefix}/sbin/apacheds-passwd
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.apacheds} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/apacheds/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/apacheds/*'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# after initial install, give hint about setup
( echo "Please change the server administrator (\"uid=admin,ou=system\")"
echo "password from the default (\"secret\") to a more secure one"
echo "as soon as you have started ApacheDS with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc apacheds start"
echo ""
echo "For this connect to ApacheDS at 127.0.0.1:10389 and modify the"
echo "\"userPassword\" field of the DN \"uid=admin,ou=system\" with"
echo "your preferred LDAP client."
echo ""
echo "If you have OpenLDAP installed (even with \"with_server=no\")"
echo "you can run the following command for an automated procedure:"
echo " \$ $RPM_INSTALL_PREFIX/sbin/apacheds-passwd \\"
echo " \"setup\" \"<new-admin-password>\""
) | %{l_rpmtool} msg -b -t notice
elif [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} apacheds status 2>/dev/null`
[ ".$apacheds_active" = .yes ] && %{l_rc} apacheds restart
fi
exit 0
%preun
# before erase, stop service and remove log files
if [ $1 -eq 0 ]; then
%{l_rc} apacheds stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/apacheds/log/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/apacheds/run/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/apacheds/db/* >/dev/null 2>&1 || true
fi
exit 0