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