specFile revision adfc98dec8688552a8976711b4a10f56a9317fe0
222N/A#
222N/A# CDDL HEADER START
222N/A#
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# with the License.
222N/A#
222N/A# You can obtain a copy of the license at
222N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt
222N/A# or http://forgerock.org/license/CDDLv1.0.html.
222N/A# See the License for the specific language governing permissions
222N/A# and limitations under the License.
222N/A#
222N/A# When distributing Covered Code, include this CDDL HEADER in each
222N/A# file and include the License file at
222N/A# trunk/opendj3/legal-notices/CDDLv1_0.txt. If applicable,
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#
222N/A# CDDL HEADER END
222N/A#
222N/A# Copyright 2013 ForgeRock AS
3232N/A#
222N/A%define _topdir [[ topDir ]]
222N/A%define _arch noarch
222N/A%define _prefix [[ prefix ]]
222N/A%define _pre [[ pre ]]
222N/A%define __os_install_post %{nil}
222N/A
222N/A# =========================
222N/A# Header
222N/A# =========================
222N/A# Short Description
222N/ASummary: [[ shortName ]]
222N/A# Application Name
222N/AName: [[ pkgName ]]
1008N/A# Application Version
1008N/AVersion: [[ version ]]
1008N/A# Packaging Revision
1008N/ARelease: [[ release ]]
1008N/A# Software Licenced Under
222N/ALicense: CDDL
222N/A# RPM Group
222N/AGroup: Productivity/Networking/LDAP/Servers
222N/A# Link to Application web site
222N/AURL: [[ referenceURL ]]
222N/A# Distributing Organisation
222N/AVendor: ForgeRock AS
222N/A# Build Architecture
222N/ABuildArch: noarch
222N/A
222N/ARequires: jre >= 1.6
222N/A
338N/A# Long Description
222N/A%Description
222N/AOpenDJ LDAP Server
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
222N/A# =========================
222N/A# Prepare, Build, Install
222N/A# =========================
222N/A# %prep
222N/A
222N/A# %build
222N/A
222N/A%install
222N/Amkdir -p "${RPM_BUILD_ROOT}%{_prefix}"
222N/Acd "${RPM_BUILD_ROOT}%{_prefix}"
222N/A# [[ installRpmFiles ]]
222N/A#Moves the doc files to doc folder
222N/Amkdir -p "%{buildroot}%{_defaultdocdir}/%{name}-%{version}"
222N/A/bin/grep -v '^#' "${RPM_SOURCE_DIR}/docFiles" | while read docFiles
222N/Ado
222N/A mv "$RPM_BUILD_ROOT"%{_prefix}$docFiles "$RPM_BUILD_ROOT"%{_defaultdocdir}/%{name}-%{version}/
222N/Adone
222N/A
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/Ado
222N/A rm -r "${RPM_BUILD_ROOT}"%{_prefix}$excludedFiles
222N/Adone
222N/A
222N/A# Moves the init.d script.
222N/Amkdir -p "$RPM_BUILD_ROOT"/etc/init.d/
222N/Ainstall -m 755 "$RPM_SOURCE_DIR"/opendj "$RPM_BUILD_ROOT"/etc/init.d/opendj
222N/A
222N/A%clean
222N/A[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
222N/A
222N/A# =========================
222N/A# Pre & Post Install
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# an uninstallation.)
222N/A
222N/A# -------------------------
222N/A# Pre Install
2624N/A%pre
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 if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
222N/A then
222N/A echo "Pre Install - upgrade install"
222N/A# If the server is running before upgrade, creates a file flag
222N/A if [ -f "%{_prefix}"/logs/server.pid ]
2624N/A then
222N/A touch "%{_prefix}"/logs/status
2624N/A fi
2624N/A "%{_prefix}"/bin/./stop-ds
222N/A fi
222N/A fi
222N/Afi
222N/A
222N/A# -------------------------
222N/A# Post Install
222N/A%post
222N/A# Registers the service
222N/A/sbin/chkconfig --add opendj
222N/A# Symlinks to process ID
222N/Atest -h "/var/run/opendj.pid" || ln -s /opt/opendj/logs/server.pid /var/run/opendj.pid
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 if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
222N/A then
222N/A "%{_prefix}"/./upgrade -n --acceptLicense
222N/A# Upgrade ok
222N/A if [ "$?" == "0" ] ; then
222N/A# Checks the server status flag for restart.
222N/A if [ -f "%{_prefix}"/logs/status ]
222N/A then
222N/A echo ""
1008N/A echo "Restarting server..."
1008N/A "%{_prefix}"/./bin/start-ds
1008N/A echo ""
1008N/A rm -f "%{_prefix}"/logs/status
222N/A fi
222N/A fi
1008N/A# Upgrade fails, needs user interaction (eg. manual mode)
222N/A if [ "$?" == "2" ] ; then
222N/A exit "0"
222N/A fi
222N/A else
222N/A echo "Instance is not configured. Upgrade aborted."
222N/A exit -1
222N/A fi
222N/A fi
222N/Afi
222N/A
222N/A# =========================
222N/A# Pre & Post Uninstall
222N/A# =========================
222N/A# If the first argument to %preun and %postun is 0, the action is
222N/A# uninstallation.
222N/A# If the first argument to %preun and %postun is 1, the action is an upgrade.
222N/A# -------------------------
222N/A# Pre Uninstall
222N/A%preun
222N/Aif [ "$1" == "0" ] ; then
222N/A echo "Pre Uninstall - uninstall"
222N/A# Stops the service and delete it.
222N/A /etc/init.d/opendj stop >/dev/null 2>&1
222N/A /sbin/chkconfig --del opendj
222N/A # Unlink the symlink to the process ID.
222N/A test -h "/var/run/opendj.pid" && unlink /var/run/opendj.pid
222N/A# Only if the instance has been configured
222N/A if [ -e "%{_prefix}"/config/buildinfo ] && [ "$(ls -A "%{_prefix}"/config/archived-configs)" ]
222N/A then
222N/A "%{_prefix}"/bin/./stop-ds
222N/A fi
222N/Aelse if [ "$1" == "1" ] ; then
222N/A echo "Pre Uninstall - upgrade uninstall"
222N/A fi
222N/Afi
222N/A# -------------------------
222N/A# Post Uninstall
222N/A%postun
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 fi
222N/Afi
222N/A
222N/A# =========================
222N/A# Files section
222N/A# =========================
222N/A%files -f "%{_sourcedir}"/files
222N/A%defattr(-,root,root)
222N/A%{_defaultdocdir}/%{name}-%{version}/
222N/A
222N/A# =========================
222N/A# Changelog
222N/A# =========================
222N/A%changelog
222N/A* Tue Aug 6 2013 ForgeRock
222N/A- Added init.d service script.
222N/A
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.
549N/A
222N/A* Thu Jul 18 2013 ForgeRock
222N/A- Fixed the sections' order and added a new "clean" section.
222N/A- Added '%doc' section.
222N/A- Added '%changelog' at the end of the file.
222N/A- Added license to header's files.
222N/A
222N/A* Thu Aug 22 2013 ForgeRock
222N/A- Modified init.d script.
222N/A