Skip to content

Commit

Permalink
update support, 64bit support, better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdisaster committed Mar 1, 2019
1 parent fd2affb commit b7fb7ff
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
10 changes: 10 additions & 0 deletions docs/using/squirrel-command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ Options:
installation
-n, --signWithParams=VALUE Sign the installer via SignTool.exe with the
parameters given
--setupIcon=VALUE Path to an ICO file that will be used for the
Setup executable's icon
-b --baseUrl=VALUE Provides a base URL to prefix the RELEASES file
packages with
--no-msi Don't generate an MSI package
--msi-win64 Mark the MSI as 64-bit, which is useful in
Enterprise deployment scenarios
--no-delta Don't generate delta packages to save time
--framework-version=VALUE
Set the required .NET framework version, e.g. net461
```

## See Also
Expand Down
15 changes: 10 additions & 5 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ int executeCommandLine(string[] args)
bool shouldWait = false;
bool noMsi = (Environment.OSVersion.Platform != PlatformID.Win32NT); // NB: WiX doesn't work under Mono / Wine
bool noDelta = false;
bool packageAs64Bit = false;

opts = new OptionSet() {
"Usage: Squirrel.exe command [OPTS]",
Expand Down Expand Up @@ -134,6 +135,7 @@ int executeCommandLine(string[] args)
{ "no-msi", "Don't generate an MSI package", v => noMsi = true},
{ "no-delta", "Don't generate delta packages to save time", v => noDelta = true},
{ "framework-version=", "Set the required .NET framework version, e.g. net461", v => frameworkVersion = v },
{ "msi-win64", "Mark the MSI as 64-bit, which is useful in Enterprise deployment scenarios", _ => packageAs64Bit = true},
};

opts.Parse(args);
Expand Down Expand Up @@ -184,7 +186,7 @@ int executeCommandLine(string[] args)
break;
#endif
case UpdateAction.Releasify:
Releasify(target, releaseDir, packagesDir, bootstrapperExe, backgroundGif, signingParameters, baseUrl, setupIcon, !noMsi, frameworkVersion, !noDelta);
Releasify(target, releaseDir, packagesDir, bootstrapperExe, backgroundGif, signingParameters, baseUrl, setupIcon, !noMsi, packageAs64Bit, frameworkVersion, !noDelta);
break;
}
}
Expand Down Expand Up @@ -343,7 +345,7 @@ public async Task Uninstall(string appName = null)
}
}

public void Releasify(string package, string targetDir = null, string packagesDir = null, string bootstrapperExe = null, string backgroundGif = null, string signingOpts = null, string baseUrl = null, string setupIcon = null, bool generateMsi = true, string frameworkVersion = null, bool generateDeltas = true)
public void Releasify(string package, string targetDir = null, string packagesDir = null, string bootstrapperExe = null, string backgroundGif = null, string signingOpts = null, string baseUrl = null, string setupIcon = null, bool generateMsi = true, bool packageAs64Bit = false, string frameworkVersion = null, bool generateDeltas = true)
{
ensureConsole();

Expand Down Expand Up @@ -466,7 +468,7 @@ public void Releasify(string package, string targetDir = null, string packagesDi
}

if (generateMsi) {
createMsiPackage(targetSetupExe, new ZipPackage(package)).Wait();
createMsiPackage(targetSetupExe, new ZipPackage(package), packageAs64Bit).Wait();

if (signingOpts != null) {
signPEFile(targetSetupExe.Replace(".exe", ".msi"), signingOpts).Wait();
Expand Down Expand Up @@ -720,7 +722,7 @@ static async Task setPEVersionInfoAndIcon(string exePath, IPackage package, stri
}
}

static async Task createMsiPackage(string setupExe, IPackage package)
static async Task createMsiPackage(string setupExe, IPackage package, bool packageAs64Bit)
{
var pathToWix = pathToWixTools();
var setupExeDir = Path.GetDirectoryName(setupExe);
Expand All @@ -736,7 +738,10 @@ static async Task createMsiPackage(string setupExe, IPackage package)
{ "Author", company },
{ "Version", Regex.Replace(package.Version.ToString(), @"-.*$", "") },
{ "Summary", package.Summary ?? package.Description ?? package.Id },
{ "Codepage", $"{culture}" }
{ "Codepage", $"{culture}" },
{ "Platform", packageAs64Bit ? "x64" : "x86" },
{ "ProgramFilesFolder", packageAs64Bit ? "ProgramFiles64Folder" : "ProgramFilesFolder" },
{ "Win64YesNo", packageAs64Bit ? "yes" : "no" }
};

// NB: We need some GUIDs that are based on the package ID, but unique (i.e.
Expand Down
19 changes: 10 additions & 9 deletions vendor/wix/template.wxs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="{{Title}} Machine-Wide Installer" Language="1033" Codepage="{{Codepage}}" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}">
<Product Id="*" Name="{{Title}} Deployment Tool" Language="1033" Codepage="{{Codepage}}" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}">

<Package Description="#Description" Comments="Comments" InstallerVersion="200" Compressed="yes"/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<Package Description="This package installs a deployment tool for {{Title}}. Not {{Title}} itself. {{Title}} is only installed if a user logs into the machine." Comments="Comments" InstallerVersion="200" Compressed="yes" Platform="{{Platform}}"/>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A later version of this product is already installed. Setup will now exit."/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>

<PropertyRef Id="NETFRAMEWORK45" />

Expand All @@ -11,21 +12,21 @@
</Condition>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="{{Title}} Installer" />
<Directory Id="{{ProgramFilesFolder}}">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="{{Title}} Deployment" />
</Directory>
</Directory>

<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="{{Id}}.exe" Guid="{{IdAsGuid2}}">
<File Id="{{Id}}.exe" Name="{{Id}}.exe" Source="./Setup.exe" KeyPath="yes" />
<Component Id="{{Id}}.exe" Guid="{{IdAsGuid2}}" Win64="{{Win64YesNo}}">
<File Id="{{Id}}.exe" Name="{{Id}}DeploymentTool.exe" Source="./Setup.exe" KeyPath="yes"/>
</Component>
</DirectoryRef>

<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="{{IdAsGuid3}}">
<Component Id="RegistryEntries" Guid="{{IdAsGuid3}}" Win64="{{Win64YesNo}}">
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Run">
<RegistryValue Type="expandable" Name="{{Id}}MachineInstaller" Value="%ProgramFiles%\{{Title}} Installer\{{Id}}.exe --checkInstall" />
<RegistryValue Type="expandable" Name="{{Id}}MachineInstaller" Value="%ProgramFiles%\{{Title}} Deployment\{{Id}}DeploymentTool.exe --checkInstall" />
</RegistryKey>
</Component>
</DirectoryRef>
Expand Down

0 comments on commit b7fb7ff

Please sign in to comment.