SDA-3102 Added support for LAUNCH_ON_INSTALL installation parameter

This commit is contained in:
Mattias Gustavsson 2021-04-21 11:56:58 +02:00
parent 7b5fe05ef6
commit 4e1d4186c4
2 changed files with 50 additions and 1 deletions

View File

@ -166,6 +166,7 @@ class Script
new PublicProperty("DEV_TOOLS_ENABLED", "true"),
new PublicProperty("FULL_SCREEN", "true"),
new PublicProperty("LOCATION", "true"),
new PublicProperty("LAUNCH_ON_INSTALL", "true"),
new PublicProperty("MEDIA", "true"),
new PublicProperty("MIDI_SYSEX", "true"),
new PublicProperty("MINIMIZE_ON_CLOSE", "ENABLED"),
@ -220,7 +221,10 @@ class Script
new ManagedAction(CustomActions.CleanRegistryCurrentUser, Return.ignore, When.After, Step.RemoveFiles, Condition.BeingUninstalled ),
// Start Symphony after installation is complete
new InstalledFileAction(new Id("symphony_exe"), "", Return.asyncNoWait, When.After, Step.InstallFinalize, Condition.NOT_BeingRemoved)
new ManagedAction(CustomActions.StartAfterInstall, Return.ignore, When.After, Step.InstallFinalize, Condition.NOT_BeingRemoved )
{
UsesProperties = "INSTALLDIR,LAUNCH_ON_INSTALL"
},
};
// Use our own Symphony branded bitmap for installation dialogs
@ -470,4 +474,25 @@ public class CustomActions
}
return ActionResult.Success;
}
// StartAfterInstall custom action
[CustomAction]
public static ActionResult StartAfterInstall(Session session)
{
try
{
if (session.Property("LAUNCH_ON_INSTALL")=="true")
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = System.IO.Path.Combine(session.Property("INSTALLDIR"), "Symphony.exe");
process.Start();
}
}
catch (System.Exception e)
{
session.Log("Error executing StartAfterInstall: " + e.ToString() );
return ActionResult.Failure;
}
return ActionResult.Success;
}
}

View File

@ -209,6 +209,30 @@ or
-------------------------------------------------------------------
### LAUNCH_ON_INSTALL
Expected values:
* "true"
Symphony will be launched automatically after installation has completed (default)
* "false"
Symphony will not be launched after installation has completed
#### Example, install with launch on install enabled
msiexec /i Symphony.msi LAUNCH_ON_INSTALL="true"
or
msiexec /i Symphony.msi /q
#### Example, install with launch on install disabled
msiexec /i Symphony.msi LAUNCH_ON_INSTALL="false"
-------------------------------------------------------------------
### LOCATION