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

chebrard
02.40.2009 b93421949d966358137e65e4a43bdcfb2d69cf58
Fix for 3907: Provide pkg(5) delivery

This modification implements a factory to build a pkg(5) delivery (aka IPS multi-platform) for OpenDS. This factory adds the following targets:

* package-pkg-make-image: build a pre-installed installation image
* package-publish: publish OpenDS into an IPS repository


The pre-installed installation image contains

* OpenDS core runtime
* OpenDS Directory Services Markup Language (DSML) Gateway as add-on


3 files added
4 files modified
516 ■■■■■ changed files
opends/build-pkg.xml 281 ●●●●● patch | view | raw | blame | history
opends/build.properties 1 ●●●● patch | view | raw | blame | history
opends/build.xml 1 ●●●● patch | view | raw | blame | history
opends/src/pkg/opends-dsml-gateway_proto.py 49 ●●●●● patch | view | raw | blame | history
opends/src/pkg/opends_proto.py 86 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/configurator/CheckInstance.java 95 ●●●●● patch | view | raw | blame | history
opends/build-pkg.xml
New file
@@ -0,0 +1,281 @@
<!--
 ! 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 2006-2009 Sun Microsystems, Inc.
 ! -->
<project name="Directory Server pkg(5) Packaging" basedir="." default="package-pkg-image">
    <description>
        This is a build script that extends the OpenDS build script by adding
        the generation of pkg(5) format packages and a pkg(5)-based installation image.
        To make use of this build script, ensure that this file is placed in the same
        directory as your build.xml file and add an import of this file at the top
        of the build.xml file.
    </description>
    <condition property="ispkgtoolkitpresent">
     <and>
       <available file="${pkg.toolkit.dir}/pkg/lib/pkg-ant-tasks.xml"/>
     </and>
    </condition>
            <import file="${pkg.toolkit.dir}/pkg/lib/pkg-ant-tasks.xml" optional="true"/>
  <target name="pkg5messagebuild" if="ispkgtoolkitpresent">
      <echo message="pkg(5) delivery will be built."/>
  </target>
  <target name="pkg5messageNotbuild" unless="ispkgtoolkitpresent">
      <echo message="No pkg(5) delivery built."/>
      <echo message="To build with pkg(5) delivery set pkg.toolkit.dir build property"/>
      <echo message="to indicate the location of pkg(5) toolkit"/>
  </target>
  <target name="pkg5echo" depends="pkg5messageNotbuild,pkg5messagebuild"/>
    <target name="-pkg-init" if="ispkgtoolkitpresent" depends="pkg5echo">
<echo message="pkg.toolkit.dir is ${pkg.toolkit.dir}" />
        <property name="pkg.build.dir" location="${package.dir}/pkg"/>
        <property name="pkg.reference.install.dir" location="${pkg.build.dir}/reference-install"/>
        <property name="pkg.repo.dir" location="${pkg.build.dir}/repo"/>
        <property name="pkg.image.container.dir" location="${pkg.build.dir}/image/"/>
        <property name="pkg.image.dir" location="${pkg.image.container.dir}/${SHORT_NAME}"/>
        <property name="pkg.authority" value="dev.sun.com"/>
        <property name="pkg.toolkit.repo.url" value="http://pkg.sun.com/layered-collection/dev"/>
        <property name="pkg.java.name" value="pkg-java"/>
    </target>
    <target name="package-pkg-make-packages" if="ispkgtoolkitpresent" depends="dynamicconstants, -pkg-init" description="Publish pkg(5)-based packages to a new repository.">
        <!-- Copy OpenDS content to the reference installlation area from which the package
             content will be published.
             The reason we're copying the existing "package/OpenDS<version>/" area
             is that we need we need to insert an opends/ umbrella directory as
             the base relative directory within the packages.
             The OpenDS project team will ultimately decide how many packages they
             want to create and where the content of those packages will be installed.
        -->
        <!-- First copy the DSML content into the reference installation area.
             The OpenDS project team will decide the most appropriate location
             for the DSML component.  In this example, we package the DSML
             component in a separate package.
        -->
        <delete dir="${pkg.reference.install.dir}"/>
        <copy tofile="${pkg.reference.install.dir}/opends/dsml/opends-dsml.war" file="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}-DSML.war"/>
        <copy tofile="${pkg.reference.install.dir}/opends/dsml/legal-notices/OpenDS.LICENSE" file="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}/legal-notices/OpenDS.LICENSE"/>
        <!-- Copy the core OpenDS content to the reference installation area.
             Copy on Unix platforms entails the use of a copy approach that
             preserves execution bit settings that are already in effect
             by virtue of the main OpenDS build.xml.
        -->
        <antcall target="-pkg-copy-windows"/>
        <antcall target="-pkg-copy-unix"/>
        <antcall target="create-tmpl-instance"/>
        <delete dir="${pkg.repo.dir}"/>
        <!-- Publish the OpenDS packages to an empty repository. -->
        <makepkgs repourl="file://${pkg.repo.dir}" basedir="${pkg.reference.install.dir}" version="${VERSION_NUMBER_STRING},0-0.${REVISION_NUMBER}">
            <fileset dir="src/pkg">
                <include name="opends_proto.py"/>
                <include name="opends-dsml-gateway_proto.py"/>
            </fileset>
        </makepkgs>
        <zip destfile="${package.dir}/pkg/${SHORT_NAME}-${VERSION_NUMBER_STRING}-repo.zip" basedir="${pkg.repo.dir}"/>
    </target>
    <target name="package-publish" if="ispkgtoolkitpresent" description="Publish packages" depends="dynamicconstants, -pkg-init">
        <!-- Publish the OpenDS packages to current repository. -->
 <echo message="pkg.repo.url=${pkg.repo.url}" />
        <!--
        <makepkgs repourl="${pkg.repo.url}" basedir="${pkg.reference.install.dir}" version="${VERSION_NUMBER_STRING},0-0.${REVISION_NUMBER}">
            <fileset dir="src/pkg">
                <include name="opends_proto.py"/>
                <include name="opends-dsml-gateway_proto.py"/>
            </fileset>
        </makepkgs>
        -->
    </target>
    <target name="package-pkg-make-image" if="ispkgtoolkitpresent" depends="package-pkg-make-packages" description="Assemble pre-installed pkg(5)-based image.">
        <!-- Assemble a universal image containing the core OpenDS package and the
             package containing the pkg(5) Java client API and bootstrap facility.
             We are only pre-installing the ones of interest for the initial download.
             The other packages will be available for installation from the repository
             later on after the initial installation takes place. -->
        <delete dir="${pkg.image.dir}"/>
        <!-- First, create the pre-installed image and add the product-specific
             packages. -->
        <makeimage repourl="file://${pkg.repo.dir}" imagedir="${pkg.image.dir}" authority="${pkg.authority}" title="${SHORT_NAME}" description="OpenDS is comprehensive next generation directory service. OpenDS is designed to address large deployments, to provide high performance, to be highly extensible, and to be easy to deploy, manage and monitor. ">
           <packages>
              <package name="opends"/>
           </packages>
        </makeimage>
        <!-- Now add the "pkg-java" Java bootstrap for pkg(5) package to the
             pre-installed image.  -->
        <makeimage repourl="${pkg.toolkit.repo.url}" imagedir="${pkg.image.dir}" authority="${pkg.authority}" title="${SHORT_NAME}" description="OpenDS is comprehensive next generation directory service. OpenDS is designed to address large deployments, to provide high performance, to be highly extensible, and to be easy to deploy, manage and monitor. ">
           <packages>
              <package name="${pkg.java.name}"/>
           </packages>
        </makeimage>
        <!-- Copy bootstub scripts to the image.  When a user executes one of these
             commands, the user will be asked if he wants to dynamically complete the
             installation of the pkg(5) and Update Tool packages. If the user answers
             'yes', then the bootstucb scripts will invoke the pkg(5) Java Bootstrap
             facility to use Java to install these packages. -->
        <mkdir dir="${pkg.image.dir}/bin"/>
        <copy tofile="${pkg.image.dir}/bin/pkg" file="${pkg.toolkit.dir}/pkg/lib/pkg-bootstub.sh"/>
        <copy tofile="${pkg.image.dir}/bin/pkg.bat" file="${pkg.toolkit.dir}/pkg/lib/pkg-bootstub.bat"/>
        <copy tofile="${pkg.image.dir}/bin/updatetool" file="${pkg.toolkit.dir}/pkg/lib/pkg-bootstub.sh"/>
        <copy tofile="${pkg.image.dir}/bin/updatetool.bat" file="${pkg.toolkit.dir}/pkg/lib/pkg-bootstub.bat"/>
        <chmod file="${pkg.image.dir}/bin/pkg" perm="ugo+rwx"/>
        <chmod file="${pkg.image.dir}/bin/updatetool" perm="ugo+rwx"/>
        <!-- Edit the cfg_cache file to specify the repository URL that the
             image will use. -->
        <replace file="${pkg.image.dir}/.org.opensolaris,pkg/cfg_cache">
            <replacefilter token="http://localhost:10001/" value="${pkg.repo.url}"/>
        </replace>
        <makezip basedir="${pkg.image.container.dir}" destfile="${pkg.build.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}-image.zip" include="${SHORT_NAME}"/>
    </target>
    <target name="-pkg-copy-windows" if="os.windows">
        <copy todir="${pkg.reference.install.dir}/opends">
            <fileset dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}"/>
        </copy>
    </target>
    <target name="-pkg-copy-unix" unless="os.windows">
        <exec dir="${package.dir}/${SHORT_NAME}-${VERSION_NUMBER_STRING}" executable="cp">
            <arg line="-r . ${pkg.reference.install.dir}/opends"/>
        </exec>
    </target>
    <target name="create-tmpl-instance">
    <!-- Replace zip upgrade script by pkg upgrade script -->
    <delete file="${pkg.reference.install.dir}/opends/upgrade" />
    <copy file="${resource.dir}/upgrade_svr4"
        tofile="${pkg.reference.install.dir}/opends/upgrade" />
    <chmod file="${pkg.reference.install.dir}/opends/upgrade" perm="755" />
    <!-- Copy instance files in ${pkg.reference.install.dir}/tmpl_instance  -->
    <mkdir dir="${pkg.reference.install.dir}/opends/tmpl_instance"/>
    <chmod dir="${pkg.reference.install.dir}/opends/tmpl_instance" perm="755"/>
        <mkdir dir="${pkg.reference.install.dir}/opends/tmpl_instance/lib"/>
        <chmod dir="${pkg.reference.install.dir}/opends/tmpl_instance/lib" perm="755"/>
        <mkdir dir="${pkg.reference.install.dir}/opends/tmpl_instance/lib/extensions"/>
        <chmod dir="${pkg.reference.install.dir}/opends/tmpl_instance/lib/extensions"
            perm="755"/>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/bak">
      <fileset dir="${pkg.reference.install.dir}/opends/bak"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/changelogDb">
      <fileset dir="${pkg.reference.install.dir}/opends/changelogDb"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/classes">
      <fileset dir="${pkg.reference.install.dir}/opends/classes"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/config">
      <fileset dir="${pkg.reference.install.dir}/opends/config"/>
    </copy>
        <mkdir dir="${pkg.reference.install.dir}/opends/config"/>
        <chmod dir="${pkg.reference.install.dir}/opends/config" perm="755"/>
    <copy todir="${pkg.reference.install.dir}/opends/config/schema">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/config/schema"/>
    </copy>
        <mkdir dir="${pkg.reference.install.dir}/opends/tmpl_instance/config/schema"/>
        <chmod dir="${pkg.reference.install.dir}/opends/tmpl_instance/config/schema"
            perm="755"/>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/db">
      <fileset dir="${pkg.reference.install.dir}/opends/db"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/import-tmp">
      <fileset dir="${pkg.reference.install.dir}/opends/import-tmp"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/ldif">
      <fileset dir="${pkg.reference.install.dir}/opends/ldif"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/locks">
      <fileset dir="${pkg.reference.install.dir}/opends/locks"/>
    </copy>
    <copy todir="${pkg.reference.install.dir}/opends/tmpl_instance/logs">
      <fileset dir="${pkg.reference.install.dir}/opends/logs"/>
    </copy>
        <!-- Create buildinfo files -->
    <echo message="${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.${REVISION_NUMBER}"
          file="${pkg.reference.install.dir}/opends/tmpl_instance/config/buildinfo" />
    <echo message="${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.${REVISION_NUMBER}"
          file="${pkg.reference.install.dir}/opends/config/buildinfo" />
        <!-- Remove config/upgrade files -->
        <delete file="${pkg.reference.install.dir}/opends/config/upgrade/config.ldif.${REVISION_NUMBER}" />
        <delete file="${pkg.reference.install.dir}/opends/config/upgrade/schema.ldif.${REVISION_NUMBER}" />
        </target>
    <target name="configure-instance">
    <!-- Copy instance files in ${pkg.image.dir}   -->
    <copy todir="${pkg.image.dir}/opends/bak">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/bak"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/changelogDb">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/changelogDb"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/classes">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/classes"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/config">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/config"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/db">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/db"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/import-tmp">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/import-tmp"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/ldif">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/ldif"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/locks">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/locks"/>
    </copy>
    <copy todir="${pkg.image.dir}/opends/logs">
      <fileset dir="${pkg.reference.install.dir}/opends/tmpl_instance/logs"/>
    </copy>
   </target>
</project>
opends/build.properties
@@ -1,4 +1,5 @@
opendmk.lib.dir=
pkg.toolkit.dir=
opends/build.xml
@@ -2548,4 +2548,5 @@
    </concat>
  </target>
  <import file="build-pkg.xml"/>
</project>
opends/src/pkg/opends-dsml-gateway_proto.py
New file
@@ -0,0 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 2009 Sun Microsystems, Inc.
#
pkg = {
    "name" : "opends-dsml-gateway",
    "version" : "@{version}",
    "attributes"    : {
                        "pkg.summary" : "OpenDS DSML Gateway",
                        "info.classification" : "Directory Services",
                        "pkg.description" : "OpenDS DSML Gateway WAR File"
                      },
    "dirs"          : {
                        "opends"      : {"mode" : "0755"},
                        "opends/dsml" : {"mode" : "0755"},
                      },
    "dirtrees" : [ "opends/dsml" ],
    "licenses" : {
                    "opends/dsml/legal-notices/OpenDS.LICENSE"  : {"license" : "CDDLv1.0" },
                 }
}
opends/src/pkg/opends_proto.py
New file
@@ -0,0 +1,86 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 2009 Sun Microsystems, Inc.
#
pkg = {
    "name" : "opends",
    "version" : "@{version}",
    "attributes"    : {
                        "pkg.summary" : "OpenDS",
                        "info.classification" : "Directory Services",
                        "pkg.description" : "OpenDS is an open source community project\
building a free and comprehensive\
next generation directory service,\
based on LDAP and DSML standards."
                      },
    "dirs"          : {
                       "opends"                    : {"mode" : "0755"},
                      },
    "excludefiles" :  [
                         "opends/dsml/opends-dsml.war",
                         "opends/dsml/legal-notices/OpenDS.LICENSE",
              ],
    "files": {
               "opends/config/messages/password-reset.template"             :   {"preserve":"strawberry"},
               "opends/config/messages/account-unlocked.template"           :   {"preserve":"strawberry"},
               "opends/config/messages/password-expired.template"           :   {"preserve":"strawberry"},
               "opends/config/messages/account-expired.template"            :   {"preserve":"strawberry"},
               "opends/config/messages/account-temporarily-locked.template" :   {"preserve":"strawberry"},
               "opends/config/messages/account-permanently-locked.template" :   {"preserve":"strawberry"},
               "opends/config/messages/password-expiring.template"          :   {"preserve":"strawberry"},
               "opends/config/messages/account-idle-locked.template"        :   {"preserve":"strawberry"},
               "opends/config/messages/account-disabled.template"           :   {"preserve":"strawberry"},
               "opends/config/messages/account-enabled.template"            :   {"preserve":"strawberry"},
               "opends/config/messages/password-changed.template"           :   {"preserve":"strawberry"},
               "opends/config/messages/account-reset-locked.template"       :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/cities"                              :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/first.names"                         :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/last.names"                          :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/states"                              :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/example.template"                    :   {"preserve":"strawberry"},
               "opends/config/MakeLDIF/streets"                             :   {"preserve":"strawberry"},
               "opends/config/config.ldif"                                  :   {"preserve":"strawberry"},
               "opends/config/admin-backend.ldif"                           :   {"preserve":"strawberry"},
               "opends/config/java.properties"                              :   {"preserve":"strawberry"},
               "opends/config/wordlist.txt"                                 :   {"preserve":"strawberry"},
               "opends/config/tools.properties"                             :   {"preserve":"strawberry"},
               "opends/config/buildinfo"                                    :   {"preserve":"strawberry"},
             },
    "dirtrees" : [
                  "opends"
                 ],
    "licenses" : {
                  "opends/legal-notices/OpenDS.LICENSE"        : {"license" : "CDDLv1.0" },
                  "opends/legal-notices/THIRDPARTYREADME.txt"  : {"license" : "Third party" },
                 }
}
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -165,7 +165,8 @@
    "upgrade",
    "upgrade.bat",
    "QuickSetup.app",
    "Uninstall.app"
    "Uninstall.app",
    "tmpl_instance"
  };
  // Files that will be ignored during backup
opends/src/server/org/opends/server/tools/configurator/CheckInstance.java
@@ -29,7 +29,10 @@
import java.io.File;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import org.opends.quicksetup.ReturnCode;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
@@ -89,6 +92,53 @@
  private static int VERSION_ERROR = 3;
  /**
   * Creates a copy of the specified file.
   *
   * @param  from  The source file to be copied.
   * @param  to    The destination file to be created.
   *
   * @throws  IOException  If a problem occurs.
   */
  private static void copyFile(File from, File to)
          throws IOException
  {
    byte[]           buffer        = new byte[4096];
    FileInputStream  inputStream   = null;
    FileOutputStream outputStream  = null;
    try
    {
      inputStream  = new FileInputStream(from);
      outputStream = new FileOutputStream(to, false);
      int bytesRead = inputStream.read(buffer);
      while (bytesRead > 0)
      {
        outputStream.write(buffer, 0, bytesRead);
        bytesRead = inputStream.read(buffer);
      }
    }
    finally
    {
      if (inputStream != null)
      {
        try
        {
          inputStream.close();
        }
        catch (Exception e)
        {
        }
      }
      if (outputStream != null)
      {
        outputStream.close();
      }
    }
  }
  /**
   * The main method which is called by the configure command lines.
   *
   * @param args the arguments passed by the command line.
@@ -254,6 +304,18 @@
            } catch (Exception e) {
            }
          }
          // For pkg(5) delivery: update the file to avoid overwrite
          // during upgrade
          FileWriter fwriter  = new FileWriter(bif, true);
          try {
            fwriter.append('\n');
          } finally {
            try {
              fwriter.close();
            } catch (Exception e) {
            }
          }
        }
      } catch (Exception e) {
        LOG.log(Level.SEVERE, "error getting build information for " +
@@ -267,6 +329,39 @@
    } else {
      LOG.log(Level.FINEST, "checkVersion not specified");
    }
    // For pkg(5) delivery: if config/upgrade/*.ldif.REV does not exist
    try {
      File upgradeDir = new File(confDir, Installation.UPGRADE_PATH);
      File tmplUpgradeDir = new File(installRootFromSystem + File.separator +
              Installation.TMPL_INSTANCE_RELATIVE_PATH +
              File.separator + Installation.CONFIG_PATH_RELATIVE +
              File.separator + Installation.UPGRADE_PATH);
      File concatenatedSchema = new File(upgradeDir,
              "schema.ldif." + REVISION_NUMBER);
      if (!concatenatedSchema.exists()) {
        File tmplConcatenatedSchema = new File(tmplUpgradeDir,
                "schema.ldif." + REVISION_NUMBER);
        copyFile(tmplConcatenatedSchema, concatenatedSchema);
      } else {
        LOG.log(Level.INFO, concatenatedSchema.getAbsolutePath() +
                "already exists");
      }
      File initialConfig = new File(upgradeDir,
              "config.ldif." + REVISION_NUMBER);
      if (!initialConfig.exists()) {
        File tmplInitialConfig = new File(tmplUpgradeDir,
                "config.ldif." + REVISION_NUMBER);
        copyFile(tmplInitialConfig, initialConfig);
      } else {
        LOG.log(Level.INFO, initialConfig.getAbsolutePath() + "already exists");
      }
    } catch (Exception e) {
      LOG.log(Level.SEVERE, "error initializing config/upgrade files", e);
    }
    System.exit(SUCCESS);
  }