222N/A# The contents of this file are subject to the terms of the
222N/A# Common Development and Distribution License, Version 1.0 only
222N/A# (the "License"). You may not use this file except in compliance
222N/A# You can obtain a copy of the license at
222N/A# See the License for the specific language governing permissions
222N/A# and limitations under the License.
222N/A# When distributing Covered Code, include this CDDL HEADER in each
222N/A# file and include the License file at
222N/A# add the following below this CDDL HEADER, with the fields enclosed
873N/A# by brackets "[]" replaced with your own identifying information:
222N/A# Portions Copyright [yyyy] [name of copyright owner]
222N/A# Copyright 2013 ForgeRock AS
222N/A%define _topdir [[ topDir ]]
222N/A%define _prefix [[ prefix ]]
222N/A%define __os_install_post %{nil}
222N/A# =========================
222N/A# =========================
222N/ASummary: [[ shortName ]]
222N/A# Link to Application web site
222N/A# Distributing Organisation
222N/AOpenDJ is an LDAPv3 compliant directory service, developed for the Java
222N/Aplatform, providing a high performance, highly available and secure store
222N/Afor the identities managed by enterprises. Its easy installation process,
222N/Acombined with the power of the Java platform makes OpenDJ one of the
222N/Asimplest and fastest directory servers to deploy and manage.
222N/A# =========================
222N/A# Prepare, Build, Install
222N/A# =========================
222N/Amkdir -p "${RPM_BUILD_ROOT}%{_prefix}"
222N/Acd "${RPM_BUILD_ROOT}%{_prefix}"
222N/A#Moves the doc files to doc folder
222N/Amkdir -p "%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
222N/A mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
222N/A# Removes the excluded files. They shouldn't be a part of this package.
222N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/excludedFiles" | while read excludedFiles
222N/A rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
222N/A[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
222N/A# =========================
222N/A# =========================
2624N/A# If the first argument to %pre is 1, the RPM operation is an initial
222N/A# installation. If the argument to %pre is 2, the operation is an upgrade
2624N/A# from an existing version to a new one.
222N/A# Similarly, the arguments to a %post are 1 and 2 for a new installation
222N/A# and upgrade, respectively. (%pre and %post aren't executed during
222N/A# -------------------------
222N/Aif [ "$1" == "1" ]; then
2624N/A echo "Pre Install - initial install"
2624N/Aelse if [ "$1" == "2" ] ; then
222N/A# Only if the instance has been configured
222N/A echo "Pre Install - upgrade install"
222N/A# If the server is running before upgrade, creates a file flag
222N/A# -------------------------
222N/A# Symlinks to process ID
222N/Aif [ "$1" == "1" ] ; then
222N/A echo "Post Install - initial install"
222N/Aelse if [ "$1" == "2" ] ; then
222N/A echo "Post Install - upgrade install"
222N/A# Only if the instance has been configured
222N/A "%{_prefix}"/./upgrade -n --acceptLicense
222N/A if [ "$?" == "0" ] ; then
222N/A# Checks the server status flag for restart.
1008N/A echo "Restarting server..."
1008N/A# Upgrade fails, needs user interaction (eg. manual mode)
222N/A if [ "$?" == "2" ] ; then
222N/A echo "Instance is not configured. Upgrade aborted."
222N/A# =========================
222N/A# =========================
222N/A# If the first argument to %preun and %postun is 0, the action is
222N/A# If the first argument to %preun and %postun is 1, the action is an upgrade.
222N/A# -------------------------
222N/Aif [ "$1" == "0" ] ; then
222N/A echo "Pre Uninstall - uninstall"
222N/A# Stops the service and delete it.
222N/A # Unlink the symlink to the process ID.
222N/A# Only if the instance has been configured
222N/A "%{_prefix}"/bin/./stop-ds
222N/Aelse if [ "$1" == "1" ] ; then
222N/A echo "Pre Uninstall - upgrade uninstall"
222N/A# -------------------------
222N/Aif [ "$1" == "0" ] ; then
222N/A echo "Post Uninstall - uninstall"
222N/A echo "OpenDJ successfully removed."
222N/Aelse if [ "$1" == "1" ] ; then
222N/A echo "Post Uninstall - upgrade uninstall"
222N/A# =========================
222N/A# =========================
222N/A%files -f "%{_sourcedir}"/files
222N/A%{_defaultdocdir}/%{name}-%{version}/
222N/A# =========================
222N/A# =========================
222N/A* Tue Aug 6 2013 ForgeRock
222N/A* Wed Jul 31 2013 ForgeRock
222N/A- Fixed the doc's section.
222N/A- Target no longer fails when build path contains spaces.
222N/A* Thu Jul 18 2013 ForgeRock
222N/A- Fixed the sections' order and added a new "clean" section.
222N/A- Added '%changelog' at the end of the file.
222N/A- Added license to header's files.
222N/A* Thu Aug 22 2013 ForgeRock