Ubaid
Posts: 4
Joined: Tue Sep 16, 2014 9:00 am

Adding Liferay as a prerequisite

Hi,

Can I add Liferay as a prerequisite. I want to do it by checking the environment variable LIFERAY_HOME, if installer found it then it will proceed else it will download it form: http://sourceforge.net/projects/lportal ... p/download and extract it and then set environment variable LIFERAY_HOME and proceed further.

Please tell me if there is any other way to do this.

Thanks in advance for helping.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Adding Liferay as a prerequisite

Hello and welcome to Advanced Installer forums,

Since your prerequisite is a .zip archive, I'm afraid you cannot use our predefined support of prerequisites.

However, you can create your own custom action that implements this scenario. For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

Please take a look on the Options to integrate and debug custom actions article which may be useful to you.

So, in this custom action, you can check if the related evironment variable exist. For this you can use the Environment.GetEnvironmentVariable method.
If the environment variable does not exist, you should download the related zip archive. For this you can use the WebClient.DownloadFile method.
Since the download file is a zip archive, in order to extract the files you can take a look on the How to: Compress and Extract Files article.
Then you can set the environment variable with the desired value using the Environment.SetEnvironmentVariable method.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”