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