From 21442dffbd1e127613ff7e47da3d16f1e588209d Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Tue, 08 Feb 2011 12:03:28 +0000
Subject: [PATCH] Add support for SVR4 packages for OpenDJ. Package name is opendj. It's a single package and has integration with SMF. Default installation is /usr/opendj. Once packages are installed, root must run configure to setup the Instance location (/var/opendj) and owner. And the owner must run setup.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java |    6 ++
 opendj-sdk/opends/resource/bin/stop-ds                                                |   15 ++++---
 opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Configurator.java   |    3 +
 opendj-sdk/opends/build.xml                                                           |    2 
 opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java |    3 +
 opendj-sdk/opends/resource/bin/_script-util.sh                                        |    6 +-
 opendj-sdk/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java  |    3 +
 opendj-sdk/opends/resource/bin/start-ds                                               |   11 +++--
 opendj-sdk/opends/resource/configure                                                  |   13 +++---
 opendj-sdk/opends/resource/unconfigure                                                |   11 +++--
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java              |    9 ++--
 11 files changed, 47 insertions(+), 35 deletions(-)

diff --git a/opendj-sdk/opends/build.xml b/opendj-sdk/opends/build.xml
index eb5e651..a589d2a 100644
--- a/opendj-sdk/opends/build.xml
+++ b/opendj-sdk/opends/build.xml
@@ -2594,7 +2594,7 @@
     </javac>
   </target>
 
-  <!-- import file="build-svr4.xml"/ -->
+  <import file="build-svr4.xml"/>
 
   <!-- Copy NDB Backend dependencies to build lib directory -->
   <target name="copyndbdeps" if="ismysqldirpresent"
diff --git a/opendj-sdk/opends/resource/bin/_script-util.sh b/opendj-sdk/opends/resource/bin/_script-util.sh
index ada6122..5410236 100644
--- a/opendj-sdk/opends/resource/bin/_script-util.sh
+++ b/opendj-sdk/opends/resource/bin/_script-util.sh
@@ -24,7 +24,7 @@
 #
 #
 #      Copyright 2008-2010 Sun Microsystems, Inc.
-#      Portions Copyright 2010 ForgeRock AS
+#      Portions Copyright 2010-2011 ForgeRock AS
 
 #
 # Display an error message
@@ -261,7 +261,7 @@
 then
   if [ -f "${INSTALL_ROOT}/configure" ]
   then
-    if [ -f /etc/opends/instance.loc ]
+    if [ -f /etc/opendj/instance.loc ]
     then
       if [ "${SCRIPT_NAME}" = "configure" ]
       then
@@ -272,7 +272,7 @@
           exit 0
 	fi
       fi
-      read INSTANCE_ROOT <  /etc/opends/instance.loc
+      read INSTANCE_ROOT <  /etc/opendj/instance.loc
     else
       if [ "${SCRIPT_NAME}" != "configure" ]
       then
diff --git a/opendj-sdk/opends/resource/bin/start-ds b/opendj-sdk/opends/resource/bin/start-ds
index ee6b0e4..15bbb20 100755
--- a/opendj-sdk/opends/resource/bin/start-ds
+++ b/opendj-sdk/opends/resource/bin/start-ds
@@ -24,6 +24,7 @@
 #
 #
 #      Copyright 2006-2009 Sun Microsystems, Inc.
+#      Portions Copyright 2011 ForgeRock AS
 
 
 # Capture the current working directory so that we can change to it later.
@@ -45,12 +46,12 @@
 SCRIPT_NAME="start-ds"
 export SCRIPT_NAME
 
-# check for presence of lib/_svc-opends.sh file
+# check for presence of lib/_svc-opendj.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
+# OpenDJ. 
+# Check --exec. If not present, start OpenDJ from SMF
 
-if test -f "${INSTALL_ROOT}/lib/_svc-opends.sh"
+if test -f "${INSTALL_ROOT}/lib/_svc-opendj.sh"
 then
     if [ "$1" = "--exec" ]
     then
@@ -61,7 +62,7 @@
     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
+        exec /usr/sbin/svcadm enable -t svc:/network/ldap/server:opendj
     fi
 fi
 
diff --git a/opendj-sdk/opends/resource/bin/stop-ds b/opendj-sdk/opends/resource/bin/stop-ds
index f8b806b..c779b6c 100755
--- a/opendj-sdk/opends/resource/bin/stop-ds
+++ b/opendj-sdk/opends/resource/bin/stop-ds
@@ -24,6 +24,7 @@
 #
 #
 #      Copyright 2006-2009 Sun Microsystems, Inc.
+#      Portions Copyright 2011 ForgeRock AS
 
 
 # This script may be used to request that the Directory Server shut down.
@@ -59,11 +60,11 @@
 SCRIPT_NAME="stop-ds"
 export SCRIPT_NAME
 
-# check for presence of lib/_svc-opends.sh file
+# check for presence of lib/_svc-opendj.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"
+# OpenDJ. 
+# Check --exec. If not present, start OpenDJ from SMF
+if test -f "${INSTALL_ROOT}/lib/_svc-opendj.sh"
 then
     if [ "$1" = "--exec" ]
     then
@@ -74,15 +75,15 @@
     then
         if [ "$1" = "-R" -o "$1" = "--restart" ]
         then
-            /usr/sbin/svcadm disable -t svc:/network/ldap/server:opends
+            /usr/sbin/svcadm disable -t svc:/network/ldap/server:opendj
             RETURN_CODE=$?
             if test ${RETURN_CODE} -ne 0
             then
                 exit ${RETURN_CODE}
             fi
-            exec /usr/sbin/svcadm enable -t svc:/network/ldap/server:opends
+            exec /usr/sbin/svcadm enable -t svc:/network/ldap/server:opendj
         else
-            exec /usr/sbin/svcadm disable -t svc:/network/ldap/server:opends
+            exec /usr/sbin/svcadm disable -t svc:/network/ldap/server:opendj
         fi
     fi
 fi
diff --git a/opendj-sdk/opends/resource/configure b/opendj-sdk/opends/resource/configure
index 5bbde7c..cdccedd 100755
--- a/opendj-sdk/opends/resource/configure
+++ b/opendj-sdk/opends/resource/configure
@@ -24,6 +24,7 @@
 #
 #
 #      Copyright 2006-2008 Sun Microsystems, Inc.
+#      Portions Copyright 2011 ForgeRock AS
 
 
 # Capture the current working directory so that we can change to it later.
@@ -70,7 +71,7 @@
   if test ${RETURN_CODE} -eq 0
   then
     # Retrieve INSTANCE_ROOT
-    INSTANCE_ROOT=`cat /etc/opends/instance.loc`
+    INSTANCE_ROOT=`cat /etc/opendj/instance.loc`
     # Now update SMF manifest, cp it to the right place and import it
     OWNER=`ls -ld ${INSTANCE_ROOT}`
     CURRENT_IFS=${IFS}
@@ -81,13 +82,13 @@
     IFS=${CURRENT_IFS}
     if test "${USERNAME}" = "ldap" -a "$GROUPNAME" = "ldap"
     then
-        cp ${INSTALL_ROOT}/resources/opends-manifest.xml /var/svc/manifest/network/ldap/
+        cp ${INSTALL_ROOT}/resources/opendj-manifest.xml /var/svc/manifest/network/ldap/
     else
-        cat ${INSTALL_ROOT}/resources/opends-manifest.xml | sed -e "s/user='ldap/user='${USERNAME}/;s/group='ldap/group='${GROUPNAME}/" > /tmp/opends-manifest.$$
-        cp /tmp/opends-manifest.$$ /var/svc/manifest/network/ldap/opends-manifest.xml
-        rm /tmp/opends-manifest.$$
+        cat ${INSTALL_ROOT}/resources/opendj-manifest.xml | sed -e "s/user='ldap/user='${USERNAME}/;s/group='ldap/group='${GROUPNAME}/" > /tmp/opendj-manifest.$$
+        cp /tmp/opendj-manifest.$$ /var/svc/manifest/network/ldap/opendj-manifest.xml
+        rm /tmp/opendj-manifest.$$
     fi
-    /usr/sbin/svccfg import /var/svc/manifest/network/ldap/opends-manifest.xml
+    /usr/sbin/svccfg import /var/svc/manifest/network/ldap/opendj-manifest.xml
   fi
   exit ${RETURN_CODE}
 fi
diff --git a/opendj-sdk/opends/resource/unconfigure b/opendj-sdk/opends/resource/unconfigure
index abf3f69..c8df403 100755
--- a/opendj-sdk/opends/resource/unconfigure
+++ b/opendj-sdk/opends/resource/unconfigure
@@ -24,6 +24,7 @@
 #
 #
 #      Copyright 2008-2009 Sun Microsystems, Inc.
+#      Portions Copyright 2011 ForgeRock AS
 
 
 # Capture the current working directory so that we can change to it later.
@@ -98,11 +99,11 @@
 
 echo "Disabling SMF service ..."
 # Now update SMF manifest, delete it and remove the file from  /var/svc/manifest
-echo select network/ldap/server >  /tmp/opends-unconfigure.$$
-echo delete opends >> /tmp/opends-unconfigure.$$
-/usr/sbin/svccfg -f /tmp/opends-unconfigure.$$
-rm /tmp/opends-unconfigure.$$
-rm /var/svc/manifest/network/ldap/opends-manifest.xml
+echo select network/ldap/server >  /tmp/opendj-unconfigure.$$
+echo delete opendj >> /tmp/opendj-unconfigure.$$
+/usr/sbin/svccfg -f /tmp/opendj-unconfigure.$$
+rm /tmp/opendj-unconfigure.$$
+rm /var/svc/manifest/network/ldap/opendj-manifest.xml
 
 echo "Resetting instance location ..."
 # Launch the unconfigure process.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index 7957aa9..5b139ba 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 
 package org.opends.quicksetup;
@@ -50,10 +51,10 @@
 public class Installation {
 
   /**
-   * Relative path to OpenDS jar files.
+   * Relative path to OpenDJ jar files.
    */
   public static final String[] OPEN_DS_JAR_RELATIVE_PATHS =
-          {"lib/quicksetup.jar", "lib/OpenDS.jar", "lib/je.jar"};
+          {"lib/quicksetup.jar", "lib/OpenDJ.jar", "lib/je.jar"};
 
   /**
    * The relative path where all the Windows binaries (batch files) are.
@@ -156,7 +157,7 @@
   /**
    * The path to the default instance.
    */
-  public static final String DEFAULT_INSTANCE_PATH = "/var/opends";
+  public static final String DEFAULT_INSTANCE_PATH = "/var/opendj";
 
   /**
    * The relative path to the instance.loc file.
@@ -167,7 +168,7 @@
   /**
    * The path to the instance.loc file.
    */
-  public static final String INSTANCE_LOCATION_PATH = "/etc/opends/" +
+  public static final String INSTANCE_LOCATION_PATH = "/etc/opendj/" +
     INSTANCE_LOCATION_PATH_RELATIVE;
 
   /**
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index 28c9d45..d02bc56 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 
 package org.opends.quicksetup.installer;
@@ -1129,6 +1130,8 @@
   /**
    * Writes the set-java-home file that is used by the scripts to set the
    * java home and the java arguments.
+   * Since the set-java-home file is created and may be changed,
+   * it's created under the instancePath.
    * @param installPath the install path of the server.
    * @param javaHome the java home to be used.
    * @param arguments a Map containing as key the name of the script and as
@@ -1169,7 +1172,8 @@
     writer.close();
 
     String destinationFile;
-    String libDir = Utils.getPath(installPath,
+    String libDir = Utils.getPath(Utils
+        .getInstancePathFromInstallPath(installPath),
         Installation.LIBRARIES_PATH_RELATIVE);
     if (Utils.isWindows())
     {
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
index 7c9474c..280d895 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 package org.opends.server.tools.configurator;
 
@@ -62,7 +63,7 @@
           CheckInstance.class.getName());
 
   /** Prefix for log files. */
-  static public final String LOG_FILE_PREFIX = "opends-checkinstance-";
+  static public final String LOG_FILE_PREFIX = "opendj-checkinstance-";
 
   private static String installRootFromSystem;
   private static String instanceRootFromSystem;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Configurator.java b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Configurator.java
index 2340683..3ca210c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Configurator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Configurator.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 package org.opends.server.tools.configurator;
 
@@ -60,7 +61,7 @@
     Configurator.class.getName());
 
   /** Prefix for log files. */
-  static public final String LOG_FILE_PREFIX = "opends-configure-";
+  static public final String LOG_FILE_PREFIX = "opendj-configure-";
 
   private String installRootFromSystem;
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java
index a749f6f..ab3178a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/configurator/Unconfigurator.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 package org.opends.server.tools.configurator;
 
@@ -56,7 +57,7 @@
     Unconfigurator.class.getName());
 
   /** Prefix for log files. */
-  static public final String LOG_FILE_PREFIX = "opends-unconfigure-";
+  static public final String LOG_FILE_PREFIX = "opendj-unconfigure-";
 
   private String installRootFromSystem;
 

--
Gitblit v1.10.0