I am trying BitRock installer, and am stuck at almost the first hurdle :(

We have several components we install - Java, database, war file - that come our of our existing build process.

How should I set up BitRock to include these files? I tried adding a component, but am stuck adding the files to it eg the jre zip. I looked at the example project, built and installed it, and it didn't install any files.

Confused. Can someone point me in the right direction?

thanks.

asked 01 Mar '12, 13:31

wildcatz's gravatar image

wildcatz
16141417
accept rate: 0%

The files are not just plain files that can simply be copied into Program Files.

Rather, they are a mixture of zip files and exe's.

So...

1) what is the best way to get InstallBuilder to UNZIP files into Program Files? Can I tell InstallBuilder to do that, or do I have to tell it to copy it into the ${system_temp_directory} and then add a post-install action to unzip it? It would seem that InstallBuilder should know how to handle zip files packaged in the installer, and be able to unzip them into the right place itself.

2) what is the best way to get InstallBuilder to run an exe I package in the installer? Do I again have to copy it into the ${system_temp_directory} and run it from there as a post-install action?

The problem I had with the demo projects is that they don't show the above. In fact, the really confusing part for a newbie was the "Creating Multiple Components" demo, which doesn't install any files!!!!!

Thanks for the help.

(01 Mar '12, 21:00) wildcatz

Adding files to InstallBuilder can be easily done from the GUI. For new projects, files can be added by going to Files section of the builder GUI, selecting Program Files (All Platforms) and selecting Add Files or Add Directory Tree. Those files will be installed for all platforms.

You can find more information about it in Select the files section of InstallBuilder UserGuide.

The demo projects provided with InstallBuilder show how files can be deployed, both using a single component and multiple components.

You can find more information about it in Sample installers bundled with InstallBuilder section of InstallBuilder UserGuide.

link

answered 01 Mar '12, 15:48

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Embedding zip files can be done in two ways. You can <unzip> the files in <preBuildActionList> and package the unzipped contents. This approach is better since the unzipping is done when building the installer and unpacked files are shipped.

InstallBuilder's compression is also better than zip, especially when LZMA is enabled, so this should also reduce the overall size of the installer.

A complete example to package two zip archives is as follows:

<project>
  <componentList>
    <!-- other components -->

    <component>
      <name>archive</name>
      <folderList>
        <folder>
          <destination>${installdir}</destination>
          <name>archive1</name>
          <platforms>all</platforms>
          <distributionFileList>
            <distributionDirectory>
              <allowWildcards>1</allowWildcards>
              <origin>${system_temp_directory}/archive1/*</origin>
            </distributionDirectory>
          </distributionFileList>
        </folder>
        <folder>
          <destination>${installdir}</destination>
          <name>archive2</name>
          <platforms>all</platforms>
          <distributionFileList>
            <distributionDirectory>
              <allowWildcards>1</allowWildcards>
              <origin>${system_temp_directory}/archive2/*</origin>
            </distributionDirectory>
          </distributionFileList>
        </folder>
      </folderList>
    </component>
  </componentList>

  <!-- unpack zip archives -->
  <preBuildActionList>
    <deleteFile>
      <path>${system_temp_directory}/build_zip_contents</path>
    </deleteFile>
    <createDirectory>
      <path>${system_temp_directory}/build_zip_contents</path>
    </createDirectory>
    <unzip>
      <destinationDirectory>${system_temp_directory}/archive1</destinationDirectory>
      <zipFile>path/to/archive1.zip</zipFile>
    </unzip>
    <unzip>
      <destinationDirectory>${system_temp_directory}/archive2</destinationDirectory>
      <zipFile>path/to/archive2.zip</zipFile>
    </unzip>
  </preBuildActionList>

  <!-- delete temporary directory -->
  <postBuildActionList>
    <deleteFile>
      <path>${system_temp_directory}/build_zip_contents</path>
    </deleteFile>
  </postBuildActionList>
  <!-- remaining parts of project -->
</project>

An alternative is to ship the zip files and run <unzip> action after installation. You do not need to unpack the files, what you can do is unpack it after installation. The below unzips the archive and removes the file, also removing it from list of files to delete by uninstaller:

<postInstallationActionList>
  <unzip>
    <destinationDirectory>${installdir}</destinationDirectory>
    <zipFile>${installdir}/archive1.zip</zipFile>
  </unzip>
  <deleteFile>
    <path>${installdir}/archive1.zip</path>
  </deleteFile>
  <removeFilesFromUninstaller>
    <files>${installdir}/archive1.zip</files>
  </removeFilesFromUninstaller>
</postInstallationActionList>

The last step is not needed (uninstaller will simply skip the file if it is not present), but is a good practice to avoid deleting files customers may copy that would just have the same name.

As for running the binary, if it is done after installation, you can simply invoke the <runProgram> action. If it has to be done before running the installation (i.e. to validate a serial number), you need to use <unpackFile> or <unpackDirectory> action.

You can find more information on this in Unpacking Before Installation Time section of our documentation.

link

answered 02 Mar '12, 04:10

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

I tried the first way, it throws an error on the prebuild action -

Executing pre build actions Checking output directory Error creating directory C:/Program Files/BitRock InstallBuilder Enterprise 8.0.2/bin/unknown variable system_temp_directory/build_zip_contents Build time: 0 seconds Build failed! Built with an evaluation version of InstallBuilder

Looks like it can't resolve ${system_temp_directory}? Per your instructions, xml is:

    <createDirectory>
        <path>${system_temp_directory}/build_zip_contents</path>
    </createDirectory>
(02 Mar '12, 12:29) wildcatz

It seems

${system_temp_directory}

is only defined at runtime, not at build time and that is why it did not work. There is no reason probably why it needs to be that way, so we will be changing that. In the mean time, can you just hardcode the value?

You can also add the following at beginning of <preBuildActionList>:

<preBuildActionList>
 <setInstallerVariable>
  <name>system_temp_directory</name>
  <value>${env(TEMP)}</value>
 </setInstallerVariable>
 <!-- remaining actions -->
</preBuildActionList>
link

answered 02 Mar '12, 13:34

ridruejo's gravatar image

ridruejo ♦♦
57238
accept rate: 27%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×38
×19

Asked: 01 Mar '12, 13:31

Seen: 8,808 times

Last updated: 02 Mar '12, 13:48