specFile revision 4e95684128298fc5acbb93a3edf7cd94aa56bebf
0N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License, Version 1.0 only
0N/A# (the "License"). You may not use this file except in compliance
0N/A# with the License.
0N/A#
0N/A# You can obtain a copy of the license at
0N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt
0N/A# or http://forgerock.org/license/CDDLv1.0.html.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at
0N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
0N/A# add the following below this CDDL HEADER, with the fields enclosed
0N/A# by brackets "[]" replaced with your own identifying information:
0N/A# Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
0N/A# Copyright 2013 ForgeRock AS
0N/A#
0N/A%define _topdir [[ topDir ]]
0N/A%define _arch noarch
0N/A%define _prefix [[ prefix ]]
0N/A%define _pre [[ pre ]]
0N/A%define __os_install_post %{nil}
0N/A
0N/A# =========================
0N/A# Header
0N/A# =========================
0N/A# Short Description
0N/ASummary: [[ shortName ]]
0N/A# Application Name
0N/AName: [[ pkgName ]]
0N/A# Application Version
0N/AVersion: [[ version ]]
0N/A# Packaging Revision
0N/ARelease: [[ release ]]
0N/A# Software Licenced Under
0N/ALicense: CDDL
0N/A# RPM Group
0N/AGroup: Productivity/Networking/LDAP/Servers
0N/A# Link to Application web site
0N/AURL: [[ referenceURL ]]
0N/A# Distributing Organisation
0N/AVendor: ForgeRock AS
0N/A# Build Architecture
0N/ABuildArch: noarch
0N/A
0N/ARequires: jre >= 1.6
0N/A
0N/A# Long Description
0N/A%Description
0N/AOpenDJ LDAP Server
0N/AOpenDJ is an LDAPv3 compliant directory service, developed for the Java
0N/Aplatform, providing a high performance, highly available and secure store
0N/Afor the identities managed by enterprises. Its easy installation process,
0N/Acombined with the power of the Java platform makes OpenDJ one of the
0N/Asimplest and fastest directory servers to deploy and manage.
0N/A
0N/A
0N/A# =========================
0N/A# Prepare, Build, Install
0N/A# =========================
0N/A# %prep
0N/A
0N/A# %build
0N/A
0N/A%install
0N/Amkdir -p "${RPM_BUILD_ROOT}%{_prefix}"
0N/Acd "${RPM_BUILD_ROOT}%{_prefix}"
0N/A# [[ installRpmFiles ]]
0N/A#Moves the doc files to doc folder
0N/Amkdir -p "%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
0N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/docFiles" | while read docFiles
0N/Ado
0N/A mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
0N/Adone
0N/A
0N/A# Removes the excluded files. They shouldn't be a part of this package.
0N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/excludedFiles" | while read excludedFiles
0N/Ado
0N/A rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
0N/Adone
0N/A
0N/A# Moves the init.d script.
0N/Amkdir -p "$RPM_BUILD_ROOT"/etc/init.d/
0N/Ainstall -m 755 "$RPM_SOURCE_DIR"/opendj "$RPM_BUILD_ROOT"/etc/init.d/opendj
0N/A
0N/A%clean
0N/A[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
0N/A
0N/A# =========================
0N/A# Pre & Post Install
0N/A# =========================
0N/A# If the first argument to %pre is 1, the RPM operation is an initial
0N/A# installation. If the argument to %pre is 2, the operation is an upgrade
0N/A# from an existing version to a new one.
0N/A# Similarly, the arguments to a %post are 1 and 2 for a new installation
0N/A# and upgrade, respectively. (%pre and %post aren't executed during
0N/A# an uninstallation.)
0N/A
0N/A# -------------------------
0N/A# Pre Install
0N/A%pre
0N/Aif [ "$1" == "1" ]; then
0N/A echo "Pre Install - initial install"
0N/Aelse if [ "$1" == "2" ] ; then
0N/A# Only if the instance has been configured
0N/A if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
0N/A then
0N/A echo "Pre Install - upgrade install"
0N/A# If the server is running before upgrade, creates a file flag
0N/A if [ -f "%{_prefix}"/logs/server.pid ]
0N/A then
0N/A touch "%{_prefix}"/logs/status
0N/A fi
0N/A "%{_prefix}"/bin/./stop-ds
0N/A fi
0N/A fi
0N/Afi
0N/A
0N/A# -------------------------
0N/A# Post Install
0N/A%post
0N/A# Registers the service
0N/A/sbin/chkconfig --add opendj
0N/A# Symlinks to process ID
0N/Atest -h "/var/run/opendj.pid" || ln -s /opt/opendj/logs/server.pid /var/run/opendj.pid
0N/Aif [ "$1" == "1" ] ; then
0N/A echo "Post Install - initial install"
0N/Aelse if [ "$1" == "2" ] ; then
0N/A echo "Post Install - upgrade install"
0N/A# Only if the instance has been configured
0N/A if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
0N/A then
0N/A "%{_prefix}"/./upgrade -n --acceptLicense
0N/A# Upgrade ok
0N/A if [ "$?" == "0" ] ; then
0N/A# Checks the server status flag for restart.
0N/A if [ -f "%{_prefix}"/logs/status ]
0N/A then
0N/A echo ""
0N/A echo "Restarting server..."
0N/A "%{_prefix}"/./bin/start-ds
0N/A echo ""
0N/A rm -f "%{_prefix}"/logs/status
0N/A fi
0N/A fi
0N/A# Upgrade fails, needs user interaction (eg. manual mode)
0N/A if [ "$?" == "2" ] ; then
0N/A exit "0"
0N/A fi
else
echo "Instance is not configured. Upgrade aborted."
exit -1
fi
fi
fi
# =========================
# Pre & Post Uninstall
# =========================
# If the first argument to %preun and %postun is 0, the action is
# uninstallation.
# If the first argument to %preun and %postun is 1, the action is an upgrade.
# -------------------------
# Pre Uninstall
%preun
if [ "$1" == "0" ] ; then
echo "Pre Uninstall - uninstall"
# Stops the service and delete it.
/etc/init.d/opendj stop >/dev/null 2>&1
/sbin/chkconfig --del opendj
# Unlink the symlink to the process ID.
test -h "/var/run/opendj.pid" && unlink /var/run/opendj.pid
# Only if the instance has been configured
if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
then
"%{_prefix}"/bin/./stop-ds
fi
else if [ "$1" == "1" ] ; then
echo "Pre Uninstall - upgrade uninstall"
fi
fi
# -------------------------
# Post Uninstall
%postun
if [ "$1" == "0" ] ; then
echo "Post Uninstall - uninstall"
echo "OpenDJ successfully removed."
else if [ "$1" == "1" ] ; then
echo "Post Uninstall - upgrade uninstall"
fi
fi
# =========================
# Files section
# =========================
%files -f "%{_sourcedir}"/files
%defattr(-,root,root)
%{_defaultdocdir}/%{name}-%{version}/
# =========================
# Changelog
# =========================
%changelog
* Thu Aug 22 2013 ForgeRock
- Modified init.d script.
* Tue Aug 6 2013 ForgeRock
- Added init.d service script.
* Wed Jul 31 2013 ForgeRock
- Fixed the doc's section.
- Target no longer fails when build path contains spaces.
* Thu Jul 18 2013 ForgeRock
- Fixed the sections' order and added a new "clean" section.
- Added '%doc' section.
- Added '%changelog' at the end of the file.
- Added license to header's files.