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# You can obtain a copy of the license at
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at
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# Copyright 2013 ForgeRock AS
0N/A%define _topdir [[ topDir ]]
0N/A%define _prefix [[ prefix ]]
0N/A%define _pre [[ pre ]]
0N/A%define __os_install_post %{nil}
0N/A# =========================
0N/A# =========================
0N/ASummary: [[ shortName ]]
0N/A# Application Version
0N/AVersion: [[ version ]]
0N/ARelease: [[ release ]]
0N/A# Software Licenced Under
0N/A# Link to Application web site
0N/AURL: [[ referenceURL ]]
0N/A# Distributing Organisation
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# Prepare, Build, Install
0N/A# =========================
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/A mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
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/A rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
0N/A[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
0N/A# =========================
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/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 echo "Pre Install - upgrade install"
0N/A# If the server is running before upgrade, creates a file flag
0N/A "%{_prefix}"/bin/./stop-ds
0N/A# -------------------------
0N/A# Registers the service
0N/A# Symlinks to process ID
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 "%{_prefix}"/./upgrade -n --acceptLicense
0N/A if [ "$?" == "0" ] ; then
0N/A# Checks the server status flag for restart.
0N/A echo "Restarting server..."
0N/A# Upgrade fails, needs user interaction (eg. manual mode)
0N/A if [ "$?" == "2" ] ; then
echo "Instance is not configured. Upgrade aborted."
# =========================
# =========================
# If the first argument to %preun and %postun is 0, the action is
# If the first argument to %preun and %postun is 1, the action is an upgrade.
# -------------------------
if [ "$1" == "0" ] ; then
echo "Pre Uninstall - uninstall"
# Stops the service and delete it.
# Unlink the symlink to the process ID.
# Only if the instance has been configured
"%{_prefix}"/bin/./stop-ds
else if [ "$1" == "1" ] ; then
echo "Pre Uninstall - upgrade uninstall"
# -------------------------
if [ "$1" == "0" ] ; then
echo "Post Uninstall - uninstall"
echo "OpenDJ successfully removed."
else if [ "$1" == "1" ] ; then
echo "Post Uninstall - upgrade uninstall"
# =========================
# =========================
%files -f "%{_sourcedir}"/files
%{_defaultdocdir}/%{name}-%{version}/
# =========================
# =========================
* Thu Aug 22 2013 ForgeRock
* 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 '%changelog' at the end of the file.
- Added license to header's files.