installer.xml revision 455
2976N/A<!--
2976N/A ! CDDL HEADER START
2976N/A !
2976N/A ! The contents of this file are subject to the terms of the
2976N/A ! Common Development and Distribution License, Version 1.0 only
2976N/A ! (the "License"). You may not use this file except in compliance
2976N/A ! with the License.
2976N/A !
2976N/A ! You can obtain a copy of the license at
2976N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
2976N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2976N/A ! See the License for the specific language governing permissions
2976N/A ! and limitations under the License.
2976N/A !
2976N/A ! When distributing Covered Code, include this CDDL HEADER in each
2976N/A ! file and include the License file at
2976N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2976N/A ! add the following below this CDDL HEADER, with the fields enclosed
2976N/A ! by brackets "[]" replaced with your own identifying * information:
2976N/A ! Portions Copyright [yyyy] [name of copyright owner]
2976N/A !
2976N/A ! CDDL HEADER END
2976N/A !
2976N/A !
2976N/A ! Portions Copyright 2006 Sun Microsystems, Inc.
3215N/A ! -->
2976N/A
2976N/A<project name="opends-tests-installer" basedir="." default="usage">
2976N/A <description>
2976N/A Installer ant file for the server
2976N/A This allows tests that need a running instance of the product to easily
2976N/A get one.
2976N/A </description>
2976N/A <!-- this one has to be loaded first since it's used in
2976N/A default.installer.properties
2976N/A -->
2976N/A <property file="product.properties" />
2976N/A <!-- this is an optional file if you want to pass custom values -->
2976N/A <property file="installer.properties" />
3824N/A <!-- this is the file where the default values are defined -->
3824N/A <property file="default.installer.properties" />
2976N/A <!-- Define default values for mandatory properties in case the
2976N/A property files would not be found
3488N/A -->
2976N/A
2976N/A <target name="usage">
2976N/A <echo>Installer usage:
3824N/A status : reports if product is installed and/or running
3824N/Amain target=
3824N/A bootstrap : installs and configure the product
3824N/A wipeout : stops and uninstalls the product
3824N/Asubtargets=
3824N/A install : installs the product
3824N/A configure : set the server up to listen on a given port
3824N/A start : start the product unless it is already running
3824N/A stop : stop the product if it is already running
3824N/A stop.force : stop no matter what
3824N/A uninstall : uninstall the product if it is installed
3824N/A </echo>
2976N/A </target>
2976N/A
2976N/A <!-- Installation -->
2976N/A <target name="install.do"
2976N/A description="deploy the product bits"
2976N/A unless="product.installed" >
2976N/A <echo message="Installing ${product.name} ${product.version}..." />
3262N/A <property name="config.file"
3262N/A location="${full.install.dir}/config/config.ldif"/>
3262N/A <mkdir dir="${install.dir}"/>
3262N/A <unzip dest="${install.dir}">
3262N/A <fileset dir="${project.home}/build/package">
3262N/A <include name="*.zip"/>
2976N/A </fileset>
2976N/A </unzip>
2976N/A <chmod perm="755">
3824N/A <fileset dir="${full.install.dir}/bin">
2976N/A <include name="*.sh"/>
2976N/A </fileset>
2976N/A </chmod>
2976N/A </target>
2976N/A
2976N/A <target name="install" >
2976N/A <available file="${full.install.dir}"
2976N/A type="dir"
2976N/A property="product.installed" />
2976N/A <antcall target="install.do" />
2976N/A </target>
2976N/A <!-- end of install related targets -->
2976N/A
2976N/A <!-- Uninstallation -->
2976N/A <target name="uninstall.do"
2976N/A description="Uninstall the product"
2976N/A if="product.installed" >
2976N/A <echo message="Uninstalling ${product.name} ${product.version}..." />
3262N/A <delete dir="${install.dir}" />
3262N/A </target>
3262N/A <target name="uninstall">
3262N/A <available file="${full.install.dir}"
3262N/A type="dir"
3262N/A property="product.installed" />
3262N/A <antcall target="uninstall.do" />
2976N/A </target>
2976N/A <!-- end of uninstall related targets -->
2976N/A
3824N/A <!-- configuration -->
2976N/A <target name="configure.do"
2976N/A description="configures product to listen on the right port number"
2976N/A if="product.installed" >
2976N/A <echo message="basedir=[${basedir}]" />
2976N/A <echo message="configuring ${product.name} ${product.version}..." />
2976N/A <java classname="org.opends.server.tools.ConfigureDS">
2976N/A <!-- building the classpath to run the configurator -->
2976N/A <classpath>
2976N/A <fileset dir="${full.install.dir}/lib">
2976N/A <include name="*.jar"/>
3440N/A </fileset>
3440N/A </classpath>
3440N/A
2976N/A <!-- provide the arguments here -->
2976N/A <arg value="--configClass" />
2976N/A <arg value="org.opends.server.extensions.ConfigFileHandler" />
2976N/A <arg value="--configFile" />
2976N/A <arg value="${full.install.dir}/config/config.ldif" />
2976N/A <arg line="-p ${port.ldap}" />
2976N/A <arg value="-D"/>
2976N/A <arg value="${bind.dn}"/>
2976N/A <arg value="-w"/>
2976N/A <arg value="${bind.pwd}"/>
2976N/A </java>
2976N/A </target>
2976N/A
<target name="configure">
<available file="${full.install.dir}"
type="dir"
property="product.installed" />
<antcall target="configure.do" />
</target>
<!-- end of config related targets -->
<!-- start -->
<target name="start.do"
description="start the product"
if="product.installed"
unless="product.running" >
<echo message="Starting ${product.name} ${product.version}... on ${os.name}" />
<exec
os="${windows.list}"
executable="${full.install.dir}\bin\start-ds.bat"
spawn="true" />
<exec
os="${unix.list}"
executable="${full.install.dir}/bin/start-ds.sh"
spawn="true" />
</target>
<target name="start">
<available file="${full.install.dir}"
type="dir"
property="product.installed" />
<condition property="product.running">
<socket port="${port.ldap}" server="${host.name}"/>
</condition>
<antcall target="start.do" />
</target>
<!-- end of start related targets -->
<!-- stop -->
<target name="stop.force"
description="stop the server">
<echo message="Stopping ${product.name} ${product.version}..." />
<exec
os="${windows.list}"
executable="${full.install.dir}\bin\stop-ds.bat"
spawn="true">
<arg line="-h ${host.name}"/>
<arg line="-p ${port.ldap}"/>
<arg line="-w ${bind.pwd}" />
<arg value="-D" />
<arg value="${bind.dn}" />
</exec>
<exec
os="${unix.list}"
executable="${full.install.dir}/bin/stop-ds.sh"
spawn="true" >
<arg line="-h ${host.name}"/>
<arg line="-p ${port.ldap}"/>
<arg line="-w ${bind.pwd}" />
<arg value="-D" />
<arg value="${bind.dn}" />
</exec>
</target>
<target name="stop.do" if="product.running">
<antcall target="stop.force" />
</target>
<target name="stop" >
<condition property="product.running">
<socket port="${port.ldap}" server="${host.name}"/>
</condition>
<antcall target="stop.do" />
</target>
<target name="sleep" if="product.running">
<echo message="Give the server some time to shut down and release locks..." />
<sleep seconds="10" />
</target>
<target name="stop.sleep" >
<condition property="product.running">
<socket port="${port.ldap}" server="${host.name}"/>
</condition>
<antcall target="stop.do" />
<antcall target="sleep" />
</target>
<!-- end of stop related targets -->
<!-- status -->
<!-- Installation status -->
<target name="is-product-installed?" if="product.installed">
<echo message="Found ${product.name} installed in [${full.install.dir}]" />
</target>
<target name="is-product-not-installed?" unless="product.installed">
<echo message="Could not find ${product.name} installation." />
</target>
<!-- end of installation status -->
<!-- Running status -->
<target name="is-product-running?" if="product.running">
<echo message="${product.name} is listening on port [${port.ldap}]"/>
</target>
<target name="is-product-not-running?" unless="product.running">
<echo message="${product.name} is NOT running"/>
</target>
<!-- end of running status -->
<target name="status">
<available file="${full.install.dir}"
type="dir"
property="product.installed" />
<condition property="product.running">
<socket port="${port.ldap}" server="${host.name}"/>
</condition>
<antcall target="is-product-installed?" />
<antcall target="is-product-not-installed?" />
<antcall target="is-product-running?" />
<antcall target="is-product-not-running?" />
</target>
<!-- end of status related tasks -->
<!-- macros - chained operations -->
<target name="bootstrap">
<echo message="Bootstrap: wipe the plate clean in case there is a previous install"/>
<antcall target="wipeout" />
<echo message="Bootstrap: install the product" />
<antcall target="install" />
<antcall target="configure" />
<antcall target="start" />
</target>
<target name="wipeout">
<echo message="Wipeout: removing product" />
<antcall target="stop.sleep" />
<antcall target="uninstall" />
</target>
<!-- end of macros related targets-->
</project>