root/trunk/build/quickstart/install.xml

Revision 3333 (checked in by douglm, 2 years ago)

Move a number of property files into a common subdirectory of the configs.

Include the overrides first from the actual config and then the common properties.

Line 
1 <?xml version="1.0"?>
2
3 <!-- Install the bedework Calendar quickstart.
4
5      This is imported by the quickstart build.xml ensuring all changes to this file
6      appear in the repository.
7
8      Authors: Mike Douglass   douglm - rpi.edu
9 -->
10
11 <project name="quickstart-install" default="run.init" basedir=".">
12   <target name="run.init">
13     <property name="org.bedework.project.bedework"
14               location="${basedir}/bedework" />
15
16     <property name="org.bedework.directory.dir"
17               location="${org.bedework.project.bedework}/../apacheds-1.5.3.fixed" />
18   </target>
19
20   <!-- =================================================================
21        The "install" target does the install
22
23        1. Copy bwbuild into the users home directory
24        2. If a new directory is needed
25             a. init the directory
26             b. Create a caladmin user with supplied password
27             c. Create a test user
28           If an ldap directory is to be copied from a previous quickstart, copy the
29           directory server files.
30        ================================================================= -->
31
32   <target name="install-configs" depends="run.init"
33           description="Install the build configuration files">
34     <echo message="Create bwbuild in user home"/>
35
36     <if>
37       <available file="${user.home}/bwbuild" type="dir" />
38       <then>
39         <echo message="========================================================" />
40         <echo message="You already have a bwbuild in user home ${user.home}" />
41         <echo message="Enter 'yes' to continue with the directory unchanged" />
42         <echo message="(you may need to update it afterwards)" />
43         <echo message="Enter anything else to terminate the install allowing " />
44         <echo message="you to rename or destroy it." />
45         <echo message="========================================================" />
46
47         <input message="Continue? yes/no"
48                addproperty="org.bedework.install.bwbuild.reply" />
49
50         <if>
51           <not>
52             <equals arg1="${org.bedework.install.bwbuild.reply}" arg2="yes" />
53           </not>
54           <then>
55             <fail />
56           </then>
57         </if>
58       </then>
59       <else>
60         <copy toDir="${user.home}/bwbuild" >
61           <fileset dir="${org.bedework.project.bedework}/config/bwbuild" />
62         </copy>
63       </else>
64     </if>
65
66     <!-- =================================================================
67          Some final reminders
68          =================================================================
69
70     This should go into some sort of summary file we echo at the end.
71     <if>
72       <isset property="org.bedework.install.bwbuild.reply" />
73       <then>
74         <echo message="========================================================" />
75         <echo message="Note:" />
76         <echo message="${user.home}/bwbuild was left unchanged. You may need" />
77         <echo message="to update it for this release." />
78         <echo message="========================================================" />
79       </then>
80     </if>-->
81   </target>
82
83   <target name="install-ldap" depends="run.init"
84           description="Install the ldap directory server">
85     <echo message="========================================================" />
86     <echo message="We need to create a new ldap directory for the quickstart" />
87     <!-- This after 3.5
88     <echo message="or copy a previous quickstart directory into the new quickstart" />
89     -->
90     <echo message="========================================================" />
91
92     <echo message="Creating a new ldap directory for the quickstart" />
93     <parallel>
94       <daemons>
95         <antcall target="dirstart" inheritrefs="true" />
96       </daemons>
97       <sequential>
98         <echo message="Pausing to let the ldap server start" />
99         <sleep seconds="10" />
100         <antcallback target="initDirForQuickstart" inheritrefs="true"
101                      return="org.bedework.directory.init.status" />
102         <if>
103           <equals arg1="${org.bedework.directory.init.status}" arg2="0" />
104           <then>
105             <echo message="Initialisation went OK" />
106             <property name="org.bedework.install.dirinit.reply" value="yes" />
107           </then>
108           <elseif>
109             <equals arg1="${org.bedework.directory.init.status}" arg2="1" />
110             <then>
111               <echo message="========================================================" />
112               <echo message="The directory appears to be initialised already" />
113               <echo message="========================================================" />
114             </then>
115           </elseif>
116           <else>
117             <echo message="Initialisation failed" />
118           </else>
119         </if>
120
121         <antcall target="dirstop" inheritrefs="true" />
122       </sequential>
123     </parallel>
124   </target>
125
126   <target name="create-newsys" depends="run.init"
127           description="Create the new empty bedework system">
128     <!-- This target assumes an unwrapped dump/restore at dist/temp/dumpres -->
129
130     <!-- Remove the hsqldb data file. It wil create an empty one -->
131
132     <delete dir="${org.bedework.hsqldb.dir}/demo" verbose="yes" />
133
134     <property name="org.bedework.dumpres.unzipdir"
135               location="${org.bedework.project.bedework}/dist/temp/dumpres" />
136
137     <parallel>
138       <daemons>
139         <antcall target="hsqldb" inheritrefs="true" />
140       </daemons>
141       <sequential>
142         <echo message="Wait for the db to start" />
143         <sleep seconds="5" />
144
145         <path id="dumpres.class.path">
146           <pathelement location="${org.bedework.dumpres.unzipdir}/classes/"/>
147           <pathelement location="${org.bedework.dumpres.unzipdir}/resources/"/>
148           <fileset dir="${org.bedework.dumpres.unzipdir}/lib">
149             <include name="**/*"/>
150           </fileset>
151         </path>
152
153         <java fork="true" dir="${org.bedework.dumpres.unzipdir}"
154               classname="org.hibernate.tool.hbm2ddl.SchemaExport">
155           <classpath refid="dumpres.class.path" />
156           <arg value="--create"/>
157           <arg value="--format"/>
158           <arg value="--delimiter=;"/>
159           <arg value="--config=/hibernate.cfg.xml"/>
160           <arg value="--output=schema.sql"/>
161         </java>
162
163         <java fork="true" dir="${org.bedework.dumpres.unzipdir}"
164               classname="org.bedework.dumprestore.restore.Restore">
165           <classpath refid="dumpres.class.path" />
166           <arg value="-appname"/>
167           <arg value="dumpres"/>
168           <arg value="-newSystem"/>
169           <arg value="-rootid"/>
170           <arg value="${org.bedework.newsys.rootid}"/>
171         </java>
172       </sequential>
173     </parallel>
174   </target>
175
176   <target name="getUserInfo">
177     <input message="Account name:"
178            addproperty="org.bedework.install.user.account" />
179
180     <input message="First name:"
181            defaultValue="First"
182            addproperty="org.bedework.install.user.firstname" />
183
184     <input message="Last name:"
185            defaultValue="Last"
186            addproperty="org.bedework.install.user.lastname" />
187
188     <input message="Account password:"
189            addproperty="org.bedework.install.user.password" />
190
191     <var name="org.bedework.install.user.info"
192          value="${org.bedework.install.user.account}" />
193
194     <var name="org.bedework.install.user.info"
195          value="${org.bedework.install.user.info} ${org.bedework.install.user.firstname}" />
196
197     <var name="org.bedework.install.user.info"
198          value="${org.bedework.install.user.info} ${org.bedework.install.user.lastname}" />
199
200     <var name="org.bedework.install.user.info"
201          value="${org.bedework.install.user.info} ${org.bedework.install.user.password}" />
202   </target>
203
204   <macrodef name="initDirectory">
205     <sequential>
206       <var name="org.bedework.directory.account" value="@{account}" />
207       <var name="org.bedework.directory.firstname"  value="@{firstName}" />
208       <var name="org.bedework.directory.lastname"  value="@{lastName}" />
209       <var name="org.bedework.directory.password"  value="@{password}" />
210
211       <echo message="======== Add user ${org.bedework.directory.account} =======" />
212
213       <ant antfile="${bedework.build.file}" inheritrefs="true"
214              target="addUser" />
215     </sequential>
216   </macrodef></project>
Note: See TracBrowser for help on using the browser.