Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add property winStartupMode to allow "delayed" on Windows #80

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/com/inet/gradle/setup/abstracts/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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
*
Expand Down
3 changes: 2 additions & 1 deletion src/com/inet/gradle/setup/msi/WxsFileBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "\"");
Expand Down