-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.msi +
winget
package initial support
- Loading branch information
Showing
20 changed files
with
1,410 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ release_notes.md | |
*nupkg | ||
*.sqlite3 | ||
packaging/ | ||
build/package/winget/Tgstation.Server.Host.Service.Msi/Release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
src/Tgstation.Server.Host/manifest.xml → build/manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
|
||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<requestedExecutionLevel level="highestAvailable" uiAccess="false"/> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
</assembly> | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
|
||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<requestedExecutionLevel level="highestAvailable" uiAccess="false"/> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
</assembly> |
File renamed without changes.
96 changes: 96 additions & 0 deletions
96
build/package/winget/Tgstation.Server.Host.Service.Configure/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using var process = new Process(); | ||
|
||
var installDir = Path.GetDirectoryName( | ||
Assembly.GetExecutingAssembly().Location)!; | ||
|
||
process.StartInfo.WorkingDirectory = installDir; | ||
process.StartInfo.FileName = Path.Combine( | ||
process.StartInfo.WorkingDirectory, | ||
"Tgstation.Server.Host.Service.exe"); | ||
|
||
/* | ||
https://www.roelvanlisdonk.nl/2009/11/13/how-to-detect-unattended-installation-msiexec-quit-or-qn-in-youre-custom-action-with-c/ | ||
msiUILevelNoChange 0 Does not change UI level. | ||
msiUILevelDefault 1 Uses default UI level. | ||
msiUILevelNone 2 Silent installation. | ||
msiUILevelBasic 3 Simple progress and error handling. | ||
msiUILevelReduced 4 Authored UI and wizard dialog boxes suppressed. | ||
msiUILevelFull 5 Authored UI with wizards, progress, and errors. | ||
msiUILevelHideCancel 32 If combined with the msiUILevelBasic value, the installer shows progress dialog boxes but does not display a Cancel button on the dialog box to prevent users from canceling the installation. | ||
msiUILevelProgressOnly 64 If combined with the msiUILevelBasic value, the installer displays progress dialog boxes but does not display any modal dialog boxes or error dialog boxes. | ||
msiUILevelEndDialog 128 If combined with any above value, the installer displays a modal dialog box at the end of a successful installation or if there has been an error. No dialog box is displayed if the user cancels. | ||
*/ | ||
var uiLevel = Int32.Parse(args[0]); | ||
|
||
// leave it to MS to overcomplicate things | ||
var interactive = uiLevel switch | ||
{ | ||
0 or 1 or 4 or 5 => true, | ||
_ => false, | ||
}; | ||
|
||
var silent = uiLevel == 2; | ||
|
||
var uninstall = args | ||
.Any(arg => arg.Equals("--uninstall", StringComparison.OrdinalIgnoreCase)); | ||
|
||
var shortcut = uiLevel == 42069; | ||
|
||
process.StartInfo.Arguments = uninstall | ||
? "-u" | ||
: shortcut | ||
? "-c" | ||
: $"-i -f {(interactive ? "-c" : String.Empty)} {(silent ? "-s" : String.Empty)}"; | ||
|
||
process.Start(); | ||
|
||
await process.WaitForExitAsync(CancellationToken.None); // DCT: None available | ||
|
||
foreach (var installLogFile in Directory.EnumerateFiles(installDir, "*.log")) | ||
File.Delete(installLogFile); | ||
|
||
if (uninstall) | ||
{ | ||
Directory.Delete( | ||
Path.Combine(installDir, "lib"), | ||
true); | ||
} | ||
|
||
if(shortcut && process.ExitCode == 0) | ||
{ | ||
Console.WriteLine(); | ||
Console.Write("tgstation-server is now configured. Would you like to (re)start the service? (Y/n): "); | ||
var keyInfo = Console.ReadKey(); | ||
Console.WriteLine(); | ||
if (keyInfo.Key == ConsoleKey.Y || keyInfo.Key == ConsoleKey.Enter) | ||
{ | ||
using (var stopService = new Process()) | ||
{ | ||
stopService.StartInfo.FileName = "sc"; | ||
stopService.StartInfo.Arguments = "stop tgstation-server"; | ||
stopService.Start(); | ||
await stopService.WaitForExitAsync(CancellationToken.None); // DCT: None available | ||
} | ||
|
||
using var startService = new Process(); | ||
startService.StartInfo.FileName = "sc"; | ||
startService.StartInfo.Arguments = "start tgstation-server"; | ||
startService.Start(); | ||
await startService.WaitForExitAsync(CancellationToken.None); // DCT: None available | ||
} | ||
|
||
Console.WriteLine("Press any key to exit this program..."); | ||
Console.ReadKey(); | ||
Console.WriteLine(); | ||
} | ||
|
||
// returning non-zero can make the installation uninstallable, no thanks | ||
return uninstall ? 0 : process.ExitCode; |
14 changes: 14 additions & 0 deletions
14
...et/Tgstation.Server.Host.Service.Configure/Tgstation.Server.Host.Service.Configure.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ApplicationManifest>../../../manifest.xml</ApplicationManifest> | ||
<ApplicationIcon>../../../tgs.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<AdditionalFiles Include="../../../manifest.xml" /> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.