root/releases/bedework-3.7/build/quickstart/install.xml

Revision 2012 (checked in by douglm, 4 years ago)

Install now runs to completion with a fresh empty system installed

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