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