Added support for the Agent MSI

This commit is contained in:
Kenneth Skovhede
2024-11-07 23:05:55 +01:00
parent 55453677cb
commit 24bc2defd0
21 changed files with 239 additions and 16 deletions
+2 -1
View File
@@ -19,4 +19,5 @@ changelog-news.txt
.vs/
/publish/
ReleaseBuilder/build-temp/
ReleaseBuilder/Resources/Windows/binfiles.wxs
ReleaseBuilder/Resources/Windows/TrayIcon/binfiles.wxs
ReleaseBuilder/Resources/Windows/Agent/binfiles.wxs
@@ -5,6 +5,7 @@
<TargetFramework>net8.0</TargetFramework>
<Description>The Duplicati Agent implementation</Description>
<Copyright>Copyright © 2024 Team Duplicati, MIT license</Copyright>
<ApplicationIcon>..\..\..\Duplicati\GUI\Duplicati.GUI.TrayIcon\Duplicati.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
+2
View File
@@ -27,6 +27,8 @@
"--targets", "win-x86-gui.msi",
"--targets", "win-x64-gui.msi",
"--targets", "win-x64-gui.zip",
"--targets", "win-x64-agent.msi",
"--targets", "win-arm64-agent.msi",
"--targets", "linux-x64-gui.zip",
"--targets", "linux-arm64-gui.zip",
"--targets", "osx-x64-gui.dmg",
+10 -3
View File
@@ -242,6 +242,13 @@ public static partial class Command
static async Task BuildMsiPackage(string baseDir, string buildRoot, string msiFile, PackageTarget target, RuntimeConfig rtcfg)
{
var resourcesDir = Path.Combine(baseDir, "ReleaseBuilder", "Resources", "Windows");
var resourcesSubDir = Path.Combine(resourcesDir,
target.Interface switch
{
InterfaceType.GUI => "TrayIcon",
InterfaceType.Agent => "Agent",
_ => throw new Exception($"Unsupported interface type: {target.Interface}")
});
var buildTmp = Path.Combine(buildRoot, "tmp-msi");
if (Directory.Exists(buildTmp))
@@ -254,7 +261,7 @@ public static partial class Command
if (!sourceFiles.EndsWith(Path.DirectorySeparatorChar))
sourceFiles += Path.DirectorySeparatorChar;
var binFiles = Path.Combine(resourcesDir, "binfiles.wxs");
var binFiles = Path.Combine(resourcesSubDir, "binfiles.wxs");
if (File.Exists(binFiles))
File.Delete(binFiles);
@@ -275,9 +282,9 @@ public static partial class Command
"--define", $"HarvestPath={sourceFiles}",
"--arch", msiArch,
"--output", msiFile,
Path.Combine(resourcesDir, "Shortcuts.wxs"),
Path.Combine(resourcesSubDir, "Shortcuts.wxs"),
binFiles,
Path.Combine(resourcesDir, "Duplicati.wxs")
Path.Combine(resourcesSubDir, "Duplicati.wxs")
], workingDirectory: buildRoot);
if (rtcfg.UseAuthenticodeSigning)
+16 -4
View File
@@ -676,17 +676,29 @@ public static partial class Command
regex.Replace(File.ReadAllText(file), $"?v={releaseInfo.Version}")
);
var wixFile = Path.Combine(baseDir, "ReleaseBuilder", "Resources", "Windows", "UpgradeData.wxi");
var wixFileGUI = Path.Combine(baseDir, "ReleaseBuilder", "Resources", "Windows", "TrayIcon", "UpgradeData.wxi");
File.WriteAllText(
wixFile,
wixFileGUI,
Regex.Replace(
File.ReadAllText(wixFile),
File.ReadAllText(wixFileGUI),
@"\<\?define ProductVersion\=\""" + versionre + @"\"" \?\>",
$"<?define ProductVersion=\"{releaseInfo.Version}\" ?>"
)
);
targetfiles.Add(wixFile);
targetfiles.Add(wixFileGUI);
var wixFileAgent = Path.Combine(baseDir, "ReleaseBuilder", "Resources", "Windows", "Agent", "UpgradeData.wxi");
File.WriteAllText(
wixFileAgent,
Regex.Replace(
File.ReadAllText(wixFileAgent),
@"\<\?define ProductVersion\=\""" + versionre + @"\"" \?\>",
$"<?define ProductVersion=\"{releaseInfo.Version}\" ?>"
)
);
targetfiles.Add(wixFileAgent);
return targetfiles;
}
+2 -2
View File
@@ -18,8 +18,8 @@ class Program
"win-x86-gui.msi",
"win-arm64-gui.zip",
"win-arm64-gui.msi",
// "win-x64-agent.msi", // Need to add support for building without trayicon + window service support
// "win-arm64-agent.msi", // Need to add support for building without trayicon + window service support
"win-x64-agent.msi", // Missing window service support
"win-arm64-agent.msi", // Missing window service support
"win-x64-agent.zip",
"win-arm64-agent.zip",
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<?include UpgradeData.wxi ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Various nice-to-have shorthands for x64/x32 -->
<?if $(sys.BUILDARCH) = "x64" ?>
<?define SystemFolder = "System64Folder" ?>
<?define SystemFolderX86 = "SystemFolder" ?>
<?define SoftwareKey = "Software" ?>
<?define SoftwareKeyX86 = "Software\Wow6432Node" ?>
<?define ProgramFilesFolder = "ProgramFiles64Folder" ?>
<?define ProgramFilesFolderX86 = "ProgramFilesFolder" ?>
<?define Suffix = "_X64" ?>
<?else?>
<?define SystemFolder = "SystemFolder" ?>
<?define SystemFolderX86 = "SystemFolder" ?>
<?define SoftwareKey = "Software" ?>
<?define SoftwareKeyX86 = "Software" ?>
<?define ProgramFilesFolder = "ProgramFilesFolder" ?>
<?define Suffix = "_X86" ?>
<?endif?>
<?define DisplayName = "Duplicati Agent" ?>
<Product Id="$(var.ProductCode)" Name="$(var.DisplayName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="405" Compressed="yes" Id="$(var.PackageCode)" InstallScope="perMachine" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<UIRef Id="WixUI_InstallDir"/>
<Property Id="FORSERVICE" Value="false" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder" Name="Programs"/>
<Directory Id="DesktopFolder" Name="Desktop"/>
<Directory Id="$(var.ProgramFilesFolder)">
<Directory Id="INSTALLLOCATION" Name="Duplicati Agent" />
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<Feature Id="DuplicatiCore" Title="Duplicati core files" Level="1" Description="Installs the required files for the Duplicati Agent." AllowAdvertise="no" Absent="disallow" ConfigurableDirectory="INSTALLLOCATION" >
<ComponentGroupRef Id="DUPLICATIBIN" />
</Feature>
<Feature Id="DuplicatiStartupShortCutFeature" Title="Launch Duplicati at startup" Level="1" Description ="Automatically launches Duplicati when you log on to the computer" Absent="allow" AllowAdvertise="no">
<ComponentRef Id="StartupMenuItem"/>
<Condition Level="0">FORSERVICE = "true"</Condition>
</Feature>
<!-- Launch duplicati setup -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Duplicati now" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="LaunchApplication" FileKey="Duplicati.Agent.exe" Impersonate="yes" ExeCommand="run" Return="asyncNoWait" />
<!-- Not suppored by wixl, so we do not validate the path -->
<!-- <CustomAction Id="WixUIValidatePath$(var.Suffix)" BinaryRef="WixUiCa$(var.Suffix)" DllEntry="ValidatePath" Return="ignore" Execute="immediate" /> -->
<Property Id="WIXUI_DONTVALIDATEPATH" Value="true" />
<!-- Set the Add/Remove icon -->
<Property Id="ARPPRODUCTICON" Value="DuplicatiIcon.exe" />
<!-- Remove old versions -->
<InstallExecuteSequence>
<!-- Note: This is suboptimal, but the ref counting is not working, so we use Early REP -->
<RemoveExistingProducts Before="CostInitialize" />
</InstallExecuteSequence>
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="2.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" Maximum="99.0.0.0" IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<Icon Id="DuplicatiIcon.exe" SourceFile="$(var.HarvestPath)Duplicati.Agent.exe" />
</Product>
</Wix>

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="ProgramMenuFolder">
<Directory Id="StartupFolder">
<Component Id="StartupMenuItem" Guid="1D4EA85B-26EF-4d6a-8C1F-2ABCE8DE79EA">
<Shortcut Id="DuplicatiStartupComponent"
Name="Duplicati Agent"
WorkingDirectory="INSTALLLOCATION"
Description="Launch Duplicati Agent"
Directory="StartupFolder"
Icon="DuplicatiIcon.exe"
IconIndex="0"
Target="[INSTALLLOCATION]Duplicati.Agent.exe"
Arguments="run"
/>
<RegistryKey Root="HKCU" Key="Software\DuplicatiTeam\Duplicati\StartupShortcut">
<RegistryValue
Value="Installed"
Type="string"
KeyPath="yes" />
</RegistryKey>
</Component>
</Directory>
</DirectoryRef>
</Fragment>
</Wix>
@@ -0,0 +1,17 @@
<Include>
<!-- Never change the UpgradeCode -->
<?define UpgradeCode="bc5a1c94-2bf2-4273-9d8f-780d162cb30e" ?>
<!-- Remember to change product version on each install -->
<?define ProductVersion="2.0.8.104" ?>
<?define Manufacturer="Duplicati Team" ?>
<!--
It must be a MAJOR upgrade, otherwise the user cannot doubleclick the MSI.
-->
<?define ProductCode="*" ?>
<?define PackageCode="*" ?>
</Include>
@@ -0,0 +1,21 @@
{\rtf1\ansi\ansicpg1252\cocoartf2761
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\froman\fcharset0 TimesNewRomanPSMT;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw12240\paperh15840\margl1440\margr1440\margb1417\margt1417\vieww13140\viewh16360\viewkind1
\deftab720
\pard\pardeftab720\ri0\sl380\sa240\partightenfactor0
\f0\fs25 \cf0 Copyright (c) 2024 Team Duplicati, https://duplicati.com, hello@duplicati.com
\f1\fs24 \
\pard\pardeftab720\ri0\sl380\sb240\sa240\partightenfactor0
\f0\fs25 \cf0 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
\f1\fs24 \
\f0\fs25 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
\f1\fs24 \
\f0\fs25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\f1\fs24 \
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 601 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@@ -3,7 +3,7 @@
<?define UpgradeCode="1c94bc5a-2bf2-4273-9d8f-2cb30e780d16" ?>
<!-- Remember to change product version on each install -->
<?define ProductVersion="2.0.8.106" ?>
<?define ProductVersion="2.0.8.104" ?>
<?define Manufacturer="Duplicati Team" ?>
@@ -0,0 +1,34 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
The use and distribution terms for this software are covered by the
Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
which can be found in the file CPL.TXT at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove this notice, or any other, from this software.
-->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<UI>
<Dialog Id="InstallDirDlg" Width="370" Height="270" Title="[ProductName] Setup)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg" />
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Destination Folder" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Destination Folder" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="Install [ProductName] to:" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="Change..." />
</Dialog>
</UI>
</Fragment>
</Wix>
@@ -0,0 +1,15 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<UI>
<Dialog Id="InvalidDirDlg" Width="260" Height="85" Title="[ProductName] Setup">
<Control Id="OK" Type="PushButton" X="102" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK">
<Publish Event="EndDialog" Value="Return" />
</Control>
<Control Id="Text" Type="Text" X="48" Y="22" Width="194" Height="30" Text="Installation directory must be on a local hard drive." />
<Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Info" />
</Dialog>
</UI>
</Fragment>
</Wix>
@@ -11,10 +11,13 @@ Also, the dialogs were modified to place the buttons as the first items in the d
The extra files are:
- [`BrowseDlg.wxs`](./ui/BrowseDlg.wxs)
- [`CustomizeDlg.wxs`](./ui/CustomizeDlg.wxs)
- [`DiskCostDlg.wxs`](./ui/DiskCostDlg.wxs)
- [`LicenseAgreementDlg.wxs`](./ui/LicenseAgreementDlg.wxs)
- [`WixUI_FeatureTree.wxs`](./ui/WixUI_FeatureTree.wxs)
- [`BrowseDlg.wxs`](./BrowseDlg.wxs)
- [`CustomizeDlg.wxs`](./CustomizeDlg.wxs)
- [`DiskCostDlg.wxs`](./DiskCostDlg.wxs)
- [`LicenseAgreementDlg.wxs`](./LicenseAgreementDlg.wxs)
- [`WixUI_FeatureTree.wxs`](./WixUI_FeatureTree.wxs)
- [`WixUI_InstallDir.wxs`](./WixUI_InstallDir.wxs)
- [`InstallDirDlg.wxs`](./InstallDirDlg.wxs)
- [`InvalidDirDlg.wxs`](./InvalidDirDlg.wxs)
The files are all licensed under the [MS-RL](https://opensource.org/licenses/ms-rl) license.