From d8a16f9cdc14ef70dcefcc408ddc44d6f1cf2ba0 Mon Sep 17 00:00:00 2001 From: Frans van Dorsselaer <17404029+dorssel@users.noreply.github.com> Date: Wed, 17 Jan 2024 14:34:22 +0100 Subject: [PATCH] Improve installer - remove Heat harvest tool - remove unnecessary files from installer - fix execution rights for WSL README - fix control dimension - use uppercase WSL folder name --- Directory.Build.props | 1 + Directory.Packages.props | 1 - Installer/Drivers.wxs | 6 +-- Installer/HarvestTransform.xslt | 26 ------------- Installer/Installer.wixproj | 25 +----------- Installer/PowerShell.wxs | 32 +++++++++++++++ Installer/Product.wxs | 17 +++++--- Installer/Server.wxs | 10 +++++ Installer/UserInterface.wxs | 2 +- Installer/WSL.wxs | 60 +++++++++++++++++++++++++++++ Usbipd/{wsl => WSL}/README.md | 0 Usbipd/{wsl => WSL}/auto-attach.sh | 0 Usbipd/{wsl => WSL}/usbip | Bin Usbipd/{wsl => WSL}/usbip.license | 0 Usbipd/Wsl.cs | 18 ++++++--- 15 files changed, 133 insertions(+), 65 deletions(-) delete mode 100644 Installer/HarvestTransform.xslt create mode 100644 Installer/PowerShell.wxs create mode 100644 Installer/WSL.wxs rename Usbipd/{wsl => WSL}/README.md (100%) rename Usbipd/{wsl => WSL}/auto-attach.sh (100%) rename Usbipd/{wsl => WSL}/usbip (100%) rename Usbipd/{wsl => WSL}/usbip.license (100%) diff --git a/Directory.Build.props b/Directory.Build.props index 577ec318..2aaf6364 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -54,6 +54,7 @@ SPDX-License-Identifier: GPL-3.0-only false false false + false usbipd-win Frans van Dorsselaer diff --git a/Directory.Packages.props b/Directory.Packages.props index f1bbcc0e..fb24bb9e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -20,7 +20,6 @@ SPDX-License-Identifier: GPL-3.0-only - diff --git a/Installer/Drivers.wxs b/Installer/Drivers.wxs index 4269c21a..7e73d800 100644 --- a/Installer/Drivers.wxs +++ b/Installer/Drivers.wxs @@ -15,7 +15,7 @@ SPDX-License-Identifier: GPL-3.0-only - + @@ -54,7 +54,7 @@ SPDX-License-Identifier: GPL-3.0-only - + @@ -62,7 +62,7 @@ SPDX-License-Identifier: GPL-3.0-only - + diff --git a/Installer/HarvestTransform.xslt b/Installer/HarvestTransform.xslt deleted file mode 100644 index 27249459..00000000 --- a/Installer/HarvestTransform.xslt +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Installer/Installer.wixproj b/Installer/Installer.wixproj index b6ebe653..2f02095e 100644 --- a/Installer/Installer.wixproj +++ b/Installer/Installer.wixproj @@ -16,30 +16,9 @@ SPDX-License-Identifier: GPL-3.0-only 1130 true - - - - APPLICATIONFOLDER - true - true - true - Usbipd - var.PublishDir - HarvestTransform.xslt - - - PowerShell - true - true - true - PowerShell - var.PowerShellDir - - - @@ -74,8 +53,8 @@ SPDX-License-Identifier: GPL-3.0-only - - + + \ No newline at end of file diff --git a/Installer/PowerShell.wxs b/Installer/PowerShell.wxs new file mode 100644 index 00000000..636d9592 --- /dev/null +++ b/Installer/PowerShell.wxs @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Installer/Product.wxs b/Installer/Product.wxs index 99ca3016..79e288f6 100644 --- a/Installer/Product.wxs +++ b/Installer/Product.wxs @@ -110,8 +110,7 @@ SPDX-License-Identifier: GPL-3.0-only Title="Server" Description="The user mode server application, installed as a service." > - - + + + + - - - + diff --git a/Installer/Server.wxs b/Installer/Server.wxs index ba5c8e78..7ce680aa 100644 --- a/Installer/Server.wxs +++ b/Installer/Server.wxs @@ -73,6 +73,10 @@ SPDX-License-Identifier: GPL-3.0-only Value="[APPLICATIONFOLDER]" /> + + + + @@ -94,4 +98,10 @@ SPDX-License-Identifier: GPL-3.0-only + + + + + + diff --git a/Installer/UserInterface.wxs b/Installer/UserInterface.wxs index 138a1377..edb7f8d3 100644 --- a/Installer/UserInterface.wxs +++ b/Installer/UserInterface.wxs @@ -18,7 +18,7 @@ SPDX-License-Identifier: GPL-3.0-only - + diff --git a/Installer/WSL.wxs b/Installer/WSL.wxs new file mode 100644 index 00000000..59a77626 --- /dev/null +++ b/Installer/WSL.wxs @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Usbipd/wsl/README.md b/Usbipd/WSL/README.md similarity index 100% rename from Usbipd/wsl/README.md rename to Usbipd/WSL/README.md diff --git a/Usbipd/wsl/auto-attach.sh b/Usbipd/WSL/auto-attach.sh similarity index 100% rename from Usbipd/wsl/auto-attach.sh rename to Usbipd/WSL/auto-attach.sh diff --git a/Usbipd/wsl/usbip b/Usbipd/WSL/usbip similarity index 100% rename from Usbipd/wsl/usbip rename to Usbipd/WSL/usbip diff --git a/Usbipd/wsl/usbip.license b/Usbipd/WSL/usbip.license similarity index 100% rename from Usbipd/wsl/usbip.license rename to Usbipd/WSL/usbip.license diff --git a/Usbipd/Wsl.cs b/Usbipd/Wsl.cs index 3ff85e22..434a658e 100644 --- a/Usbipd/Wsl.cs +++ b/Usbipd/Wsl.cs @@ -150,6 +150,18 @@ async Task OnLine(StreamReader streamReader, bool isStandardError) /// public static async Task Attach(BusId busId, bool autoAttach, string? distribution, IConsole console, CancellationToken cancellationToken) { + var wslWindowsPath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath)!, "WSL"); + if (!Path.Exists(wslWindowsPath)) + { + console.ReportError($"WSL support was not installed; reinstall this application with the WSL feature enabled."); + return ExitCode.Failure; + } + if ((Path.GetPathRoot(wslWindowsPath) is not string wslWindowsPathRoot) || (!LocalDriveRegex().IsMatch(wslWindowsPathRoot))) + { + console.ReportError($"Option '--wsl' requires that this software is installed on a local drive."); + return ExitCode.Failure; + } + // Figure out which distribution to use. WSL can be in many states: // (a) not installed at all // (b) if the user specified one: @@ -279,12 +291,6 @@ public static async Task Attach(BusId busId, bool autoAttach, string? // NOTE: We don't know the shell type (for example, docker-desktop does not even have bash), // so be as portable as possible: single line, use 'test', quote all paths, etc. { - var wslWindowsPath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath)!, "wsl"); - if ((Path.GetPathRoot(wslWindowsPath) is not string wslWindowsPathRoot) || (!LocalDriveRegex().IsMatch(wslWindowsPathRoot))) - { - console.ReportError($"Option '--wsl' requires that this software is installed on a local drive."); - return ExitCode.Failure; - } var wslResult = await RunWslAsync((distribution, "/"), null, cancellationToken, "/bin/sh", "-c", $$""" if ! test -d "{{WslMountPoint}}"; then mkdir -m 0000 "{{WslMountPoint}}";