Changeset 10676


Ignore:
Timestamp:
2005-10-03T15:51:04+13:00 (19 years ago)
Author:
kjdon
Message:

new targets to create the binary release, changed the mysql targets around a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/build.xml

    r10656 r10676  
    161161   
    162162    <!-- Include the axis jar files -->
    163     <fileset dir="${basedir}/comms/soap/axis/lib">
     163    <!--<fileset dir="${basedir}/comms/soap/axis/lib">
    164164      <include name="*.jar"/>
    165     </fileset>
     165    </fileset>-->
    166166   
    167167    <!-- include the jar files from the packages -->
     
    254254<!-- =========== Help targets ===================================  -->
    255255 
     256  <property name="install-command" value="ant [options] prepare install"/>
     257 
    256258  <target name="usage" description="Print a help message">
    257259    <echo message="  Execute 'ant -projecthelp' for a list of targets."/>
    258260    <echo message="  Execute 'ant -help' for Ant help."/>
    259     <echo>To install Greenstone3, run 'ant [options] prepare install'.
     261    <echo>To install Greenstone3, run '${install-command}'.
    260262There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option.
    261263To log the output, use the '-logfile build.log' option.
     
    365367    <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.username}" proxypassword="${proxy.password}"/>
    366368  </target>
    367  
    368   <target name="setup-mysql-root-password" depends="init,init-mysql-vars" if="mysql.islocal">
    369      <condition property="ask.root.password">
    370       <or>
    371     <not>
    372       <isset property="mysql.root.password"/>
    373     </not>
    374     <equals arg1="" arg2="${mysql.root.password}"/>
    375       </or>
    376     </condition>
    377     <getuserandpassword message="Please specify a password for the root mysql user: this is to secure your database." if="ask.root.password" username="root" pwordproperty="mysql.root.password"/>
    378   </target>
    379   <target name="setup-mysql-gsdl3-passwords" depends="init">
    380     <condition property="ask.admin.password">
    381       <or>
    382     <not>
    383       <isset property="mysql.admin.password"/>
    384     </not>
    385     <equals arg1="" arg2="${mysql.admin.password}"/>
    386       </or>
    387     </condition>
    388      <condition property="ask.reader.password">
    389       <or>
    390     <not>
    391       <isset property="mysql.reader.password"/>
    392     </not>
    393     <equals arg1="" arg2="${mysql.reader.password}"/>
    394       </or>
    395     </condition>
    396     <getuserandpassword message="Please specify a password for the gsdl3admin mysql user: this is used by greenstone" if="ask.admin.password" username="gsdl3admin" pwordproperty="mysql.admin.password"/>
    397      <getuserandpassword message="Please specify a password for the gsdl3reader mysql user: this is used by greenstone" if="ask.reader.password" username="gsdl3reader" pwordproperty="mysql.reader.password"/>
    398  </target>
    399    
     369     
    400370 <!-- ========== Web app Targets ================================ -->
    401371 
     
    439409  </target>
    440410 
    441   <target name="configure-web" depends="init,setup-mysql-gsdl3-passwords"
     411  <target name="configure-web" depends="init,get-mysql-gsdl3-passwords"
    442412    description="Configure only the web app config files">
    443413    <!-- we want a unix path in the global.properties file -->
     
    610580
    611581  <!-- this is one target that we only want to run once. -->
    612   <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql-for-setup,setup-mysql,stop-mysql"/>
     582  <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql,setup-mysql,set-mysql-account-passwords,stop-mysql"/>
    613583
    614584  <target name="init-mysql-vars">
     
    620590    </condition>
    621591    <condition property="mysql.islocal.mac">
    622     <and>
    623     <isset property="mysql.islocal"/>
    624     <isset property="current.os.ismac"/>
    625     </and>
     592      <and>
     593    <isset property="mysql.islocal"/>
     594    <isset property="current.os.ismac"/>
     595      </and>
    626596    </condition>       
    627597    <condition property="mysql.islocal.windows">
     
    631601      </and>
    632602    </condition>
     603    <condition property="mysql.islocal.usepassword">
     604      <and>
     605    <isset property="mysql.islocal"/>
     606    <isset property="mysql.use.passwords"/>
     607    <equals arg1="yes" arg2="${mysql.use.passwords}"/>
     608      </and>
     609    </condition>
     610    <condition property="mysql.islocal.usepassword.windows">
     611      <and>
     612    <isset property="mysql.islocal.usepassword"/>
     613    <isset property="current.os.iswindows"/>
     614      </and>
     615    </condition>
     616    <condition property="mysql.islocal.nopassword">
     617      <and>
     618    <isset property="mysql.islocal"/>
     619    <or>
     620      <not>
     621        <isset property="mysql.use.passwords"/>
     622      </not>
     623      <equals arg1="no" arg2="${mysql.use.passwords}"/>
     624    </or>
     625      </and>
     626    </condition>
    633627   </target>
    634628 
     629  <target name="get-mysql-root-password" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
     630     <condition property="ask.root.password">
     631      <or>
     632    <not>
     633      <isset property="mysql.root.password"/>
     634    </not>
     635    <equals arg1="" arg2="${mysql.root.password}"/>
     636      </or>
     637    </condition>
     638    <getuserandpassword message="Please specify the password for the root mysql user: this is to secure your database." if="ask.root.password" username="root" pwordproperty="mysql.root.password"/>
     639  </target>
     640
     641  <target name="get-mysql-gsdl3-passwords" depends="init,init-mysql-vars" if="mysql.islocal.usepassword">
     642    <condition property="ask.admin.password">
     643      <or>
     644    <not>
     645      <isset property="mysql.admin.password"/>
     646    </not>
     647    <equals arg1="" arg2="${mysql.admin.password}"/>
     648      </or>
     649    </condition>
     650     <condition property="ask.reader.password">
     651      <or>
     652    <not>
     653      <isset property="mysql.reader.password"/>
     654    </not>
     655    <equals arg1="" arg2="${mysql.reader.password}"/>
     656      </or>
     657    </condition>
     658    <getuserandpassword message="Please specify the password for the gsdl3admin mysql user: this is used by greenstone" if="ask.admin.password" username="gsdl3admin" pwordproperty="mysql.admin.password"/>
     659     <getuserandpassword message="Please specify the password for the gsdl3reader mysql user: this is used by greenstone" if="ask.reader.password" username="gsdl3reader" pwordproperty="mysql.reader.password"/>
     660 </target>
     661
    635662 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows,install-mysql-mac"/>
    636663 
    637   <!-- install and set up the database -->
     664  <!-- install the database : linux-->
    638665  <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present">
    639666    <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz"
     
    665692
    666693
    667   <!-- install and set up the database -->
     694  <!-- install the database : mac-->
    668695  <target name="install-mysql-mac" depends="init,init-mysql-vars" if="mysql.islocal.mac" unless="mysql.present">
    669696    <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.12-apple-darwin7.9.0-powerpc.tar.gz"
     
    693720  </target>
    694721
     722  <!-- install the database : windows -->
    695723  <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present">
    696724    <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip"
     
    705733  </target>
    706734
    707   <!-- is this just linux or both??. also we probably need to do this for external mysql -->
    708   <!-- had unless mysql.present -->
    709   <target name="setup-mysql" depends="init,init-mysql-vars,setup-mysql-root-password,setup-mysql-gsdl3-passwords" if="mysql.islocal">
    710     <!-- setup the gsdl3 mysql users -->
     735  <target name="setup-mysql" depends="init" if="mysql.islocal">
     736    <!-- setup the gsdl3 accounts -->
    711737    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
    712738      <arg value="--user=root"/>
    713       <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost identified by '${mysql.admin.password}';"/>
     739      <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost"/>
     740    </exec>
     741    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     742      <arg value="--user=root"/>
     743      <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost"/>
    714744    </exec>
    715745    <!--<exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
     
    717747      <arg value="- -execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%';"/>
    718748    </exec>-->
     749
     750    <!-- remove the anonymous user -->
    719751    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
    720752      <arg value="--user=root"/>
    721       <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost identified by '${mysql.reader.password}';"/>
     753      <arg value="--execute=delete from mysql.user where Host='localhost' and User='';"/>
    722754    </exec>
    723755    <!-- load in the demo collection database -->
     
    731763      <arg value="localsite_gs3mgdemo"/>
    732764    </exec>
    733     <!-- remove the anonymous user -->
     765  </target>
     766
     767  <target name="set-mysql-account-passwords" depends="init,init-mysql-vars,get-mysql-root-password,get-mysql-gsdl3-passwords" if="mysql.islocal.usepassword">
    734768    <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
    735769      <arg value="--user=root"/>
    736       <arg value="--execute=delete from mysql.user where Host='localhost' and User='';"/>
    737     </exec>
    738     <!-- finally, set the root password -->
    739      <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}">
    740       <arg value="--user=root"/>
    741       <arg value="--execute=set password for 'root'@'localhost' = PASSWORD('${mysql.root.password}'); flush privileges; "/>
    742     </exec>
    743   </target>
    744  
    745 <!-- this one used initially for setup -->
    746   <target name="start-mysql-for-setup" depends="init,init-mysql-vars" if="mysql.islocal">
    747     <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}"
    748       spawn="true" os="${os.linux},${os.mac}">
    749       <arg value="--datadir=./data"/>
    750       <arg value="--basedir=."/>
    751       <arg value="--pid_file=gsdl3.pid"/>
    752       <arg value="--socket=/tmp/mysql.sock"/>
    753       <arg value="--port=${mysql.port}"/>
    754       <arg value="--err-log=./var/log/mysql.log"/>
    755     </exec>
    756    <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}">
    757     </exec>
    758     <sleep seconds="2"/>
    759     <!-- need to test that the server has started up -->   
    760     <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"
    761       failonerror="true" outputproperty="throw.away">
    762       <arg value="--user=root"/>
    763       <arg value="--execute=show databases;"/>
    764     </exec>
     770      <arg value="--execute=set password for 'root'@'localhost' = PASSWORD('${mysql.root.password}'); set password for 'gsdl3reader'@'localhost' = PASSWORD('${mysql.reader.password}'); set password for 'gsdl3admin'@'localhost' = PASSWORD('${mysql.admin.password}');  flush privileges;"/>
     771    </exec>   
    765772  </target>
    766773
     
    783790  </target>
    784791
    785     <target name="stop-mysql" depends="init,setup-mysql-root-password" if="mysql.islocal"
     792  <target name="stop-mysql" depends="init,init-mysql-vars,stop-mysql-use-password-linux,stop-mysql-use-password-windows,stop-mysql-no-password" if="mysql.islocal"
    786793    description="Shutdown only mysql">
    787     <echo>Shutting down the mysql server. At the password prompt (linux only), enter the mysql root password.</echo>
     794    <echo>MYSQL database server shutdown successfully</echo>
     795  </target>
     796 
     797  <target name="stop-mysql-no-password" depends="init" if="mysql.islocal.nopassword">
     798    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
     799      failonerror="true" os="${os.linux},{os.mac}">
     800      <arg value="--user=root"/>
     801      <arg value="--socket=/tmp/mysql.sock"/>
     802      <arg value="shutdown"/>
     803    </exec>
     804    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
     805      failonerror="true" os="${os.windows}">
     806      <arg value="--user=root"/>
     807      <arg value="shutdown"/>
     808    </exec>
     809  </target>
     810 
     811  <target name="stop-mysql-use-password-linux" depends="init" if="mysql.islocal.usepassword">
     812    <echo>At the password prompt, enter the mysql root password.</echo>
    788813    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
    789814      failonerror="true" os="${os.linux},{os.mac}">
     
    793818      <arg value="shutdown"/>
    794819    </exec>
     820  </target>
     821 
     822  <target name="stop-mysql-use-password-windows" depends="init" if="mysql.islocal.usepassword.windows">
     823    <andcall target="get-mysql-root-password"/>
    795824    <!-- on windows it doesn't work unless the password is specified here -->
    796825    <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}"
     
    800829      <arg value="shutdown"/>
    801830    </exec>
    802     <echo>MYSQL database server shutdown successfully</echo>
    803831  </target>
    804832
     
    13491377
    13501378
    1351 
    1352 
     1379<!-- ====================== DISTRIBUTION Targets ========================= -->
     1380
     1381  <target name="prepare-for-dist" depends="init">
     1382    <cvs command="export -D '1 second ago'" package="mgpp"
     1383      dest="${basedir}/packages/"
     1384      cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
     1385    <cvs command="export -D '1 second ago'" package="gs2build"
     1386      cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
     1387    <cvs command="export -D '1 second ago'" package="gli"
     1388      cvsRoot=":pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src" />
     1389    <antcall target="rename-gs2build-files"/>
     1390    <antcall target="unzip-windows-packages"/>
     1391    <antcall target="get-windows-binaries"/>
     1392    <antcall target="install-mysql"/>
     1393    <antcall target="start-mysql"/>
     1394    <antcall target="setup-mysql"/>
     1395    <antcall target="stop-mysql-no-password"/>
     1396    <antcall target="prepare-tomcat"/>
     1397    <antcall target="configure-tomcat"/>
     1398    <antcall target="prepare-axis"/>
     1399    <!-- delete old axis dir -->
     1400    <delete dir="${basedir}/comms/soap/axis"/>
     1401    <antcall target="prepare-web"/>
     1402    <antcall target="configure-c++"/>
     1403    <antcall target="compile"/>
     1404    <antcall target="deploy-localsite"/>
     1405    <xslt in="build.xml" out="dist-build.xml" style="dist-resources/convert-build-xml.xsl"/>
     1406    <delete dir="${basedir}/dist-resources"/>
     1407  </target>
     1408 
     1409  <target name="get-perl-for-windows" if="current.os.iswindows">
     1410    <get src="http://www.greenstone.org/gs3files/perl-for-windows.zip"
     1411      dest="${gs2build.home}/bin/windows/perl-for-windows.zip"
     1412      usetimestamp="true"/>
     1413    <unzip src="${gs2build.home}/bin/windows/perl-for-windows.zip"
     1414      dest="${gs2build.home}/bin/windows"/>
     1415  </target>
     1416
     1417  <target name="install-for-dist" depends="accept-properties,init,start-mysql,set-mysql-account-passwords,stop-mysql,configure,configure-tomcat">
     1418   
     1419  </target>
    13531420</project>
    13541421
Note: See TracChangeset for help on using the changeset viewer.