mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ludovicp
03.37.2008 5eea85798a7476a490262164c65fb5836d275165
Provide suppport for SMF for the SVR4 packages.
A SMF manifest is delivered in /usr/opends/resources/opends-manifest.xml
The manifest is edited and copied under /var/svc/manifest/network/ldap by the configure command (will be committed later), and imported via svccfg.
start-ds / stop-ds / control-panel can be used to start /stop the server. They temporarily enable/disable the opends service. Use svcadm enable opends to permanently enable OpenDS to start at boot time.
2 files added
6 files modified
253 ■■■■■ changed files
opends/build-svr4.xml 2 ●●● patch | view | raw | blame | history
opends/resource/bin/start-ds 20 ●●●●● patch | view | raw | blame | history
opends/resource/bin/stop-ds 17 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/configurator/Configurator.java 2 ●●● patch | view | raw | blame | history
opends/src/svr4/OpenDS/_svc-opends.sh 63 ●●●●● patch | view | raw | blame | history
opends/src/svr4/OpenDS/layout.xml 48 ●●●● patch | view | raw | blame | history
opends/src/svr4/OpenDS/opends-manifest.xml 99 ●●●●● patch | view | raw | blame | history
opends/build-svr4.xml
@@ -51,7 +51,7 @@
  <property name="pkg.arch"       value="all" />
  <property name="pkg.desc"       value="${product}" />
  <property name="pkg.vendor"     value="Sun Microsystems, Inc." />
  <property name="pkg.basedir"    value="/opt" />
  <property name="pkg.basedir"    value="/usr" />
  <!-- Some others general properties -->
  <property name="svr4.build.dir"        location="${build.dir}/package/svr4/build/${pkg.name}" />
opends/resource/bin/start-ds
@@ -45,6 +45,26 @@
SCRIPT_NAME="start-ds"
export SCRIPT_NAME
# check for presence of lib/_svc-opends.sh file
# If present, we should be on Solaris/OpenSolaris and use SMF to start
# OpenDS.
# Check --exec. If not present, start OpenDS from SMF
if test -f "${INSTALL_ROOT}/lib/_svc-opends.sh"
then
    if [ "$1" == "--exec" ]
    then
        shift
    elif [ -z "$1" -o "$1" == "-L" -o "$1" == "-Q" -o "$1" == "-N" -o \
     "$1" == "--nodetach" -o "$1" == "-useLastKnownGoodConfig" \
     -o "$1" == "--quiet" ]
    then
# these options are only used when trying to start the server
# In this case, start it through the service.
        exec /usr/sbin/svcadm enable -t svc:/network/ldap/server:opends
    fi
fi
# Set environment variables
SCRIPT_UTIL_CMD=set-full-environment-and-test-java
export SCRIPT_UTIL_CMD
opends/resource/bin/stop-ds
@@ -59,6 +59,23 @@
SCRIPT_NAME="stop-ds"
export SCRIPT_NAME
# check for presence of lib/_svc-opends.sh file
# If present, we should be on Solaris/OpenSolaris and use SMF to start
# OpenDS.
# Check --exec. If not present, start OpenDS from SMF
if test -f "${INSTALL_ROOT}/lib/_svc-opends.sh"
then
    if [ "$1" == "--exec" ]
    then
        shift
    elif [ "$1" != "-V" -a "$1" != "--version" -a "$1" != "-?" -a \
        "$1" != "-H" -a "$1" != "--help" ]
#These options are not stopping the server, but checking version and help
    then
        exec /usr/sbin/svcadm disable -t svc:/network/ldap/server:opends
    fi
fi
# Set environment variables
SCRIPT_UTIL_CMD=set-full-environment-and-test-java
export SCRIPT_UTIL_CMD
opends/src/messages/messages/tools.properties
@@ -2424,6 +2424,6 @@
SEVERE_ERR_CONFIGURE_USER_NOT_EXIST_1648=User [%s] does not exist
SEVERE_ERR_CONFIGURE_OPENDSD_NOT_EXIST_1649=User/role [opendsd] does not exist. \
SEVERE_ERR_CONFIGURE_LDAPUSER_NOT_EXIST_1649=User/role [%s] does not exist. \
Create it or use --userName option to specify another user
opends/src/quicksetup/org/opends/quicksetup/configurator/Configurator.java
@@ -209,7 +209,7 @@
        exit = proc.exitValue();
        if (exit != 0) {
          LOG.log(Level.SEVERE, "[" + cmd + "] returns " + exit);
          System.err.println(ERR_CONFIGURE_OPENDSD_NOT_EXIST.get());
          System.err.println(ERR_CONFIGURE_LDAPUSER_NOT_EXIST.get(user));
          System.exit(ReturnCode.APPLICATION_ERROR.getReturnCode());
        }
      }
opends/src/svr4/OpenDS/_svc-opends.sh
New file
@@ -0,0 +1,63 @@
#! /bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE
# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
#      Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#      Copyright 2008 Sun Microsystems, Inc.
. /lib/svc/share/smf_include.sh
STARTDS="/usr/opends/bin/start-ds --exec"
STOPDS="/usr/opends/bin/stop-ds --exec"
TEST="/usr/bin/test"
case "$1" in
'start')
    OPENDS_JAVA_HOME="${OPENDS_JAVA_HOME}" \
    OPENDS_JAVA_ARGS="${OPENDS_JAVA_ARGS}" ${STARTDS}
    RES=$?
    if ${TEST} ${RES} -ne 0
    then
        if ${TEST} ${RES} -eq 98
        then
# Already started
            exit ${SMF_EXIT_OK}
        else
            exit ${SMF_EXIT_ERR_FATAL}
        fi
    fi
    ;;
'stop')
    OPENDS_JAVA_HOME="${OPENDS_JAVA_HOME}" ${STOPDS}
    if ${TEST} $? -ne 0
    then
        exit ${SMF_EXIT_ERR_FATAL}
    fi
    ;;
*)
    echo "Usage: $0 { start | stop }"
    exit ${SMF_EXIT_ERR_FATAL}
    ;;
esac
exit ${SMF_EXIT_OK}
opends/src/svr4/OpenDS/layout.xml
@@ -67,10 +67,13 @@
    <getsvnrevision property="REVISION_NUMBER" /> 
    <property name="zip.dir"           location="${pkg.dir}/${product}-${pkg.version}" />
    <property name="zip.dir"
        location="${pkg.dir}/${product}-${pkg.version}" />
    
    <echo message="Building layout for ${pkg.name} pkg based on ${zip.dir}" />
    <!-- copy ZIP layout. Use exec instead of copy task to preserve file permissions -->
    <echo
        message="Building layout for ${pkg.name} pkg based on ${zip.dir}" />
    <!-- copy ZIP layout.
        Use exec instead of copy task to preserve file permissions -->
    <mkdir dir="${svr4.layout.dir}"/>
    <exec executable="cp">
        <arg value="-R"/>
@@ -82,7 +85,8 @@
       <fileset dir="${svr4.layout.pkg.dir}" includes="**/*.exe"/>
       <fileset dir="${svr4.layout.pkg.dir}" includes="**/*.bat"/>
       <fileset dir="${svr4.layout.pkg.dir}" includes="**/bat/"/>
       <fileset dir="${svr4.layout.pkg.dir}" includes="**/README_WINDOWS.txt"/>
       <fileset dir="${svr4.layout.pkg.dir}"
               includes="**/README_WINDOWS.txt"/>
    </delete>
    <!-- Remove MacOS specific files  -->
    <delete includeemptydirs="true">
@@ -102,15 +106,30 @@
    <delete file="${svr4.layout.pkg.dir}/install.txt" />
    <delete file="${svr4.layout.pkg.dir}/install.html" />
    <!-- Add SVR4 README / install files -->
    <copy file="${svr4.src.dir}/README" tofile="${svr4.layout.pkg.dir}/README" />
    <copy file="${svr4.src.dir}/install.txt" tofile="${svr4.layout.pkg.dir}/install.txt" />
    <copy file="${svr4.src.dir}/install.html" tofile="${svr4.layout.pkg.dir}/install.html" />
    <copy file="${svr4.src.dir}/README"
        tofile="${svr4.layout.pkg.dir}/README" />
    <copy file="${svr4.src.dir}/install.txt"
        tofile="${svr4.layout.pkg.dir}/install.txt" />
    <copy file="${svr4.src.dir}/install.html"
        tofile="${svr4.layout.pkg.dir}/install.html" />
        <!-- Add svc-opends.sh wrapper -->
        <copy file="${svr4.src.dir}/_svc-opends.sh"
            tofile="${svr4.layout.pkg.dir}/lib/_svc-opends.sh" />
        <chmod file="${svr4.layout.pkg.dir}/lib/_svc-opends.sh" perm="755" />
        <!-- Add the SMF Manifest for OpenDS in a resources directory -->
        <mkdir dir="${svr4.layout.pkg.dir}/resources"/>
        <copy file="${svr4.src.dir}/opends-manifest.xml"
            tofile="${svr4.layout.pkg.dir}/resources/opends-manifest.xml" />
        <chmod file="${svr4.layout.pkg.dir}/resources/opends-manifest.xml"
            perm="644" />
    <!-- Add configure script -->
    <copy file="${resource.dir}/configure" tofile="${svr4.layout.pkg.dir}/configure" />
    <copy file="${resource.dir}/configure"
        tofile="${svr4.layout.pkg.dir}/configure" />
    <chmod file="${svr4.layout.pkg.dir}/configure" perm="744" />
    <!-- Replace zip upgrade script by svr4 upgrade script -->
    <!-- Replace zip upgrade script by svr4 upgrade script -->
    <delete file="${svr4.layout.pkg.dir}/upgrade" />
    <copy file="${resource.dir}/upgrade_svr4" tofile="${svr4.layout.pkg.dir}/upgrade" />
    <copy file="${resource.dir}/upgrade_svr4"
        tofile="${svr4.layout.pkg.dir}/upgrade" />
    <chmod file="${svr4.layout.pkg.dir}/upgrade" perm="755" />
    <!-- Move instance files in ${svr4.layout.pkg.dir}/tmpl_instance  -->
    <mkdir dir="${svr4.layout.pkg.dir}/tmpl_instance"/>
@@ -118,7 +137,8 @@
        <mkdir dir="${svr4.layout.pkg.dir}/tmpl_instance/lib"/>
        <chmod dir="${svr4.layout.pkg.dir}/tmpl_instance/lib" perm="755"/>
        <mkdir dir="${svr4.layout.pkg.dir}/tmpl_instance/lib/extensions"/>
        <chmod dir="${svr4.layout.pkg.dir}/tmpl_instance/lib/extensions" perm="755"/>
        <chmod dir="${svr4.layout.pkg.dir}/tmpl_instance/lib/extensions"
            perm="755"/>
    <move todir="${svr4.layout.pkg.dir}/tmpl_instance/bak">
      <fileset dir="${svr4.layout.pkg.dir}/bak"/>
    </move>
@@ -137,7 +157,8 @@
      <fileset dir="${svr4.layout.pkg.dir}/tmpl_instance/config/schema"/>
    </move>
        <mkdir dir="${svr4.layout.pkg.dir}/tmpl_instance/config/schema"/>
        <chmod dir="${svr4.layout.pkg.dir}/tmpl_instance/config/schema" perm="755"/>
        <chmod dir="${svr4.layout.pkg.dir}/tmpl_instance/config/schema"
            perm="755"/>
    <move todir="${svr4.layout.pkg.dir}/tmpl_instance/db">
      <fileset dir="${svr4.layout.pkg.dir}/db"/>
    </move>
@@ -154,7 +175,8 @@
      <fileset dir="${svr4.layout.pkg.dir}/logs"/>
    </move>
        <!-- Create buildinfo file -->
    <echo message="${pkg.version}.${REVISION_NUMBER}" file="${svr4.layout.pkg.dir}/tmpl_instance/config/buildinfo" />
    <echo message="${pkg.version}.${REVISION_NUMBER}"
        file="${svr4.layout.pkg.dir}/tmpl_instance/config/buildinfo" />
  </target>
</project>
opends/src/svr4/OpenDS/opends-manifest.xml
New file
@@ -0,0 +1,99 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
 CDDL HEADER START
 The contents of this file are subject to the terms of the
 Common Development and Distribution License, Version 1.0 only
 (the "License").  You may not use this file except in compliance
 with the License.
 You can obtain a copy of the license at
 trunk/opends/resource/legal-notices/OpenDS.LICENSE
 or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 See the License for the specific language governing permissions
 and limitations under the License.
 When distributing Covered Code, include this CDDL HEADER in each
 file and include the License file at
 trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 add the following below this CDDL HEADER, with the fields enclosed
 by brackets "[]" replaced with your own identifying information:
      Portions Copyright [yyyy] [name of copyright owner]
 CDDL HEADER END
      Copyright 2008 Sun Microsystems, Inc.
-->
<service_bundle type='manifest' name='opends'>
    <service name='network/ldap/server' type='service' version='1'>
        <!--
            Because we may have multiple instances of network/ldap/server
            provided by different implementations, we keep dependencies
            and methods within the instance.
        -->
        <instance name='opends' enabled='false'>
        <!--
        Wait for network interfaces to be initialized.
        -->
            <dependency
           name='network'
           grouping='require_all'
           restart_on='error'
           type='service'>
                <service_fmri value='svc:/milestone/network:default' />
            </dependency>
        <!--
           Wait for all local filesystems to be mounted.
        -->
            <dependency
           name='filesystem-local'
           grouping='require_all'
           restart_on='none'
           type='service'>
                <service_fmri value='svc:/system/filesystem/local:default' />
            </dependency>
            <exec_method
            type='method'
            name='start'
            exec='/usr/opends/lib/_svc-opends.sh start'
            timeout_seconds='60'>
                <method_context>
                    <method_credential
                   user='ldap' group='ldap'
privileges='basic,net_privaddr,sys_resource,!proc_info,!file_link_any'
limit_privileges='basic,net_privaddr,sys_resource,!proc_info,!file_link_any'
               />
                </method_context>
            </exec_method>
            <exec_method
            type='method'
            name='stop'
            exec='/usr/opends/lib/_svc-opends.sh stop'
            timeout_seconds='60'>
                <method_context>
                    <method_credential user='ldap' group='ldap' />
                </method_context>
            </exec_method>
            <property_group name='startd' type='framework'>
            <!-- core dumps shouldn't restart session -->
                <propval name='ignore_error' type='astring'
                value='core,signal' />
            </property_group>
            <template>
                <common_name>
                    <loctext xml:lang='C'>
                        OpenDS LDAP directory server
                    </loctext>
                </common_name>
                <documentation>
                    <doc_link name='OpenDS Documentation Wiki'
                              uri='https://www.opends.org/wiki/' />
                </documentation>
            </template>
        </instance>
        <stability value='Evolving' />
    </service>
</service_bundle>