diff --git a/src/com/inet/gradle/setup/abstracts/Service.java b/src/com/inet/gradle/setup/abstracts/Service.java index cd023502..e0983fe9 100644 --- a/src/com/inet/gradle/setup/abstracts/Service.java +++ b/src/com/inet/gradle/setup/abstracts/Service.java @@ -22,9 +22,10 @@ * Definition of a service to be installed on the target system. */ public class Service extends Application { + private boolean startOnBoot = true, keepAlive = false; - private String id, wrapper, logPath, logPrefix, logLevel, pidFile, stdError, stdOutput, libraryPath, javaHome, jvm; + private String id, wrapper, logPath, logPrefix, logLevel, pidFile, stdError, stdOutput, libraryPath, javaHome, jvm, winStartupMode; /** * Create a new Service @@ -38,6 +39,7 @@ public Service( SetupBuilder setup ) { /** * Returns a boolean flag indicating whether the service is started when the system is booted. * + * @see #getWinStartupMode() * @return boolean flag indicating whether the service is started when the system is booted */ public boolean isStartOnBoot() { @@ -47,12 +49,26 @@ public boolean isStartOnBoot() { /** * Sets a boolean flag indicating whether the service is started when the system is booted. * + * @see #setWinStartupMode(String) * @param startOnBoot boolean flag indicating whether the service is started when the system is booted */ public void setStartOnBoot( boolean startOnBoot ) { this.startOnBoot = startOnBoot; } + /** + * Gets the startup mode for Windows. One of "delayed", "auto", or "manual". Overrides {@link #isStartOnBoot()} + * if set. + */ + public String getWinStartupMode() { + return winStartupMode; + } + + /** Service startup mode can be either "delayed", "auto", or "manual". Overrides {@link #setStartOnBoot(boolean)} */ + public void setWinStartupMode( String winStartupMode ) { + this.winStartupMode = winStartupMode; + } + /** * Returns the serviceID which should be a short version of the application name * diff --git a/src/com/inet/gradle/setup/msi/WxsFileBuilder.java b/src/com/inet/gradle/setup/msi/WxsFileBuilder.java index 95c79cb4..6d7d19ab 100644 --- a/src/com/inet/gradle/setup/msi/WxsFileBuilder.java +++ b/src/com/inet/gradle/setup/msi/WxsFileBuilder.java @@ -690,7 +690,8 @@ private void addServices() throws IOException { if( !service.getDescription().isEmpty() ) { addAttributeIfNotExists( install, "Description", service.getDescription() ); } - addAttributeIfNotExists( install, "Start", service.isStartOnBoot() ? "auto" : "demand" ); + addAttributeIfNotExists( install, "Start", service.getWinStartupMode() != null ? service.getWinStartupMode() + : service.isStartOnBoot() ? "auto" : "demand" ); addAttributeIfNotExists( install, "Type", "ownProcess" ); addAttributeIfNotExists( install, "ErrorControl", "normal" ); addAttributeIfNotExists( install, "Arguments", " \"//RS//" + name + "\"");