specFile revision f0b6cf809372fb29ae063b49359fd18c8b425830
136N/A#
1451N/A# CDDL HEADER START
136N/A#
136N/A# The contents of this file are subject to the terms of the
136N/A# Common Development and Distribution License, Version 1.0 only
136N/A# (the "License"). You may not use this file except in compliance
136N/A# with the License.
136N/A#
136N/A# You can obtain a copy of the license at
136N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt
136N/A# or http://forgerock.org/license/CDDLv1.0.html.
136N/A# See the License for the specific language governing permissions
136N/A# and limitations under the License.
136N/A#
136N/A# When distributing Covered Code, include this CDDL HEADER in each
136N/A# file and include the License file at
136N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
136N/A# add the following below this CDDL HEADER, with the fields enclosed
553N/A# by brackets "[]" replaced with your own identifying information:
553N/A# Portions Copyright [yyyy] [name of copyright owner]
553N/A#
136N/A# CDDL HEADER END
136N/A#
136N/A# Copyright 2013 ForgeRock AS
136N/A#
136N/A%define _topdir [[ topDir ]]
136N/A%define _arch noarch
136N/A%define _prefix [[ prefix ]]
136N/A%define _pre [[ pre ]]
1451N/A%define __os_install_post %{nil}
1451N/A
136N/A# =========================
136N/A# Header
136N/A# =========================
136N/A# Short Description
136N/ASummary: [[ shortName ]]
136N/A# Application Name
136N/AName: [[ pkgName ]]
136N/A# Application Version
136N/AVersion: [[ version ]]
136N/A# Packaging Revision
136N/ARelease: [[ release ]]
136N/A# Software Licenced Under
136N/ALicense: CDDL
136N/A# RPM Group
136N/AGroup: Productivity/Networking/LDAP/Servers
136N/A# Link to Application web site
136N/AURL: [[ referenceURL ]]
136N/A# Distributing Organisation
136N/AVendor: ForgeRock AS
136N/A# Build Architecture
136N/ABuildArch: noarch
136N/A
136N/ARequires: jre >= 1.6
136N/A
136N/A# Long Description
136N/A%Description
136N/AOpenDJ LDAP Server
136N/AOpenDJ is an LDAPv3 compliant directory service, developed for the Java
136N/Aplatform, providing a high performance, highly available and secure store
136N/Afor the identities managed by enterprises. Its easy installation process,
136N/Acombined with the power of the Java platform makes OpenDJ one of the
136N/Asimplest and fastest directory servers to deploy and manage.
136N/A
136N/A
136N/A# =========================
136N/A# Prepare, Build, Install
136N/A# =========================
136N/A# %prep
136N/A
136N/A# %build
136N/A
136N/A%install
136N/Amkdir -p "${RPM_BUILD_ROOT}%{_prefix}"
136N/Acd "${RPM_BUILD_ROOT}%{_prefix}"
136N/A# [[ installRpmFiles ]]
136N/A#Moves the doc files to doc folder
136N/Amkdir -p "%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
136N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/docFiles" | while read docFiles
136N/Ado
136N/A mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
136N/Adone
136N/A
136N/A# Removes the excluded files. They shouldn't be a part of this package.
136N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/excludedFiles" | while read excludedFiles
136N/Ado
136N/A rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
136N/Adone
136N/A
136N/A%clean
136N/A[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
136N/A
136N/A# =========================
136N/A# Pre & Post Install
136N/A# =========================
136N/A# If the first argument to %pre is 1, the RPM operation is an initial
136N/A# installation. If the argument to %pre is 2, the operation is an upgrade
136N/A# from an existing version to a new one.
136N/A# Similarly, the arguments to a %post are 1 and 2 for a new installation
136N/A# and upgrade, respectively. (%pre and %post aren't executed during
136N/A# an uninstallation.)
136N/A
136N/A# -------------------------
136N/A# Pre Install
136N/A%pre
136N/Aif [ "$1" == "1" ]; then
136N/A echo "Pre Install - initial install"
136N/Aelse if [ "$1" == "2" ] ; then
136N/A# Only if the instance has been configured
136N/A if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
524N/A then
echo "Pre Install - upgrade install"
# If the server is running before upgrade, creates a file flag
if [ -f "%{_prefix}"/logs/server.pid ]
then
touch "%{_prefix}"/logs/status
fi
"%{_prefix}"/bin/./stop-ds
fi
fi
fi
# -------------------------
# Post Install
%post
if [ "$1" == "1" ] ; then
echo "Post Install - initial install"
else if [ "$1" == "2" ] ; then
echo "Post Install - upgrade install"
# Only if the instance has been configured
if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
then
"%{_prefix}"/./upgrade -n --acceptLicense
# Upgrade ok
if [ "$?" == "0" ] ; then
# Checks the server status flag for restart.
if [ -f "%{_prefix}"/logs/status ]
then
echo ""
echo "Restarting server..."
"%{_prefix}"/./bin/start-ds
echo ""
rm -f "%{_prefix}"/logs/status
fi
fi
# Upgrade fails, needs user interaction (eg. manual mode)
if [ "$?" == "2" ] ; then
exit "0"
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"
# 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
* 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.