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