Executing External Scripts and Executables via Custom Code Action

Here is a simple custom code action that allows you to extract the exit code and output produced when executing a command or target file during install time.

 package com.zerog.ia.customcode.actions; import com.zerog.ia.api.pub.*; import java.net.*; import java.io.*; public class EnhancedExecuteTargetFile extends CustomCodeAction { public void install(InstallerProxy ip) throws InstallException { try { String fileToExecute = ip.substitute("$FILE_TO_EXECUTE$"); String executeString = ""; if(fileToExecute.endsWith(".sh") || fileToExecute.endsWith(".bin")) { System.err.println("Shell script found - using /bin/sh"); executeString = "/bin/sh "+fileToExecute; } else { executeString = ...

Get InstallAnywhere Tutorial and Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.