ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Darragh" <dbai...@hp.com>
Subject Apply argument wrapping with msiexec
Date Tue, 09 Nov 2010 14:53:05 GMT

I have the following target in a project

  <target name="extract-msi" depends="init" if="target.os.windows" >
    <mkdir dir="${build.dir}/extract/msi" />
    <apply executable="msiexec" failonerror="true" >
      <arg value="/a" /> <!-- administrative install -->
      <srcfile/>
      <arg value='TARGETDIR="${build.dir}\extract\msi"' />
      <fileset dir="${src.dir}" >
        <include name="**/*.msi" />
      </fileset>
    </apply>
  </target>

Basically the problem appears to be with the TARGETDIR line. If I remove that line, then the
msiexec command will run just fine, but will extract the msi contents to the wrong location
(C:\). It seems that despite the claims in the console:
The ' characters around the executable and arguments are
not part of the command.

It seems that the command is in fact executed with them wrapped around it, since running the
following at the command prompt will fail (subsituted in some values):
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' 'TARGETDIR="C:\Documents and
Settings\<basedir>\build\extract\msi"'

While this works:
msiexec '/a' 'C:\Documents and Settings\<filename>.msi' TARGETDIR="C:\Documents and
Settings\<basedir>\build\extract\msi"


I've got the following to work, but it's only useful as long as there is only 1 msi to be
processed.
  <target name="extract-msi" depends="init" if="target.os.windows" >
    <mkdir dir="${build.dir}/extract/msi" />
    <fileset dir="${src.dir}" id="files.msi" >
      <include name="**/*.msi" />
    </fileset>
    <exec executable="cmd" failonerror="true" >
      <arg value="/c" />
      <arg value='msiexec /a "${src.dir}\${toString:files.msi}" /qn TARGETDIR="${build.dir}\extract\msi"
/l*v "${build.dir}\msi.log"' />
    </exec>
  </target>


Any suggestions on how to utilise the apply task to have this work for when dealing with multiple
msi's as opposed to only being able to handle one?

I've tried experimenting with the line, file, value versions of the arg element, all produce
the same result.

--
Regards,
Darragh Bailey

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message