1
0
Fork 0
mirror of https://github.com/Corsinvest/cv4pve-pepper.git synced 2025-03-09 15:39:57 +00:00

Pass arguments to remote-viewer Close #14

Upgrade .Net 5
This commit is contained in:
Daniele Corsini 2021-07-19 16:49:55 +02:00
parent f90910fbab
commit 19c1eed6a1
4 changed files with 25 additions and 13 deletions

View file

@ -25,7 +25,8 @@ Options:
All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one. All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one.
By default, we return the node where the VM is currently running. By default, we return the node where the VM is currently running.
If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy. If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy.
--viewer Executable SPICE client remote viewer --viewer Executable SPICE client remote viewer.
--viewer-options Send options directly SPICE Viewer (quote value).
Commands: Commands:
app-check-update Check update application app-check-update Check update application
@ -69,6 +70,7 @@ this software aims to simplify run SPICE client from Proxmox VE using command li
* Support multiple host for HA in --host parameter es. host[:port],host1[:port],host2[:port] * Support multiple host for HA in --host parameter es. host[:port],host1[:port],host2[:port]
* Check-Update and Upgrade application * Check-Update and Upgrade application
* Use Api token --api-token parameter * Use Api token --api-token parameter
* Send options directly to viewer
## Api token ## Api token
@ -107,6 +109,11 @@ root@debian:~# cv4pve-pepper --host=192.168.0.100 --username=root@pam --password
* Linux /usr/bin/remote-viewer * Linux /usr/bin/remote-viewer
* Windows C:\Program Files\VirtViewer v?.?-???\bin\remote-viewer.exe * Windows C:\Program Files\VirtViewer v?.?-???\bin\remote-viewer.exe
## Options of remove viewer
Use --viewer-options to send options to viewer.
E.g. --viewer-options "-f" for full screen.
## Error ## Error
* **no spice port**: This error appears when you have not configured the display hardware on SPICE. * **no spice port**: This error appears when you have not configured the display hardware on SPICE.

View file

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<Version>1.4.0</Version> <Version>1.5 .0</Version>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>net5.0</TargetFramework>
<AssemblyName>cv4pve-pepper</AssemblyName> <AssemblyName>cv4pve-pepper</AssemblyName>
<Company>Corsinvest Srl</Company> <Company>Corsinvest Srl</Company>
<Authors>Daniele Corsini</Authors> <Authors>Daniele Corsini</Authors>
@ -19,9 +19,9 @@
<TrimmerRootAssembly Include="System.Net.WebClient" /> <TrimmerRootAssembly Include="System.Net.WebClient" />
<!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Shell\Corsinvest.ProxmoxVE.Api.Shell.csproj" /> --> <!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Shell\Corsinvest.ProxmoxVE.Api.Shell.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.8.0" /> <PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.8.1" />
</ItemGroup> </ItemGroup>
<Target Name="SpicNSpan" AfterTargets="Clean"> <Target Name="SpicNSpan" AfterTargets="Clean">
<RemoveDir Directories="$(TargetDir)" /> <RemoveDir Directories="$(TargetDir)" />
<RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" /> <RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" />

View file

@ -35,12 +35,12 @@ namespace Corsinvest.ProxmoxVE.Pepper
" If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy.", " If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy.",
CommandOptionType.SingleValue); CommandOptionType.SingleValue);
var optRemoteViewer = app.Option("--viewer", var optRemoteViewer = app.Option("--viewer", "Executable SPICE client remote viewer.", CommandOptionType.SingleValue)
"Executable SPICE client remote viewer",
CommandOptionType.SingleValue)
.DependOn(app, CommandOptionExtension.HOST_OPTION_NAME); .DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
optRemoteViewer.Accepts().ExistingFile(); optRemoteViewer.Accepts().ExistingFile();
var optViewerOptions = app.Option("--viewer-options", "Send options directly SPICE Viewer (quote value).", CommandOptionType.SingleValue);
app.OnExecute(() => app.OnExecute(() =>
{ {
var client = app.ClientTryLogin(); var client = app.ClientTryLogin();
@ -83,15 +83,17 @@ namespace Corsinvest.ProxmoxVE.Pepper
RedirectStandardOutput = false, RedirectStandardOutput = false,
}; };
var viewerOpts = optViewerOptions.Value() + "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{ {
startInfo.FileName = "/bin/bash"; startInfo.FileName = "/bin/bash";
startInfo.Arguments = $"-c \"{optRemoteViewer.Value()} {fileName}\""; startInfo.Arguments = $"-c \"{optRemoteViewer.Value()} {fileName} {viewerOpts}\"";
} }
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
startInfo.FileName = StringHelper.Quote(optRemoteViewer.Value()); startInfo.FileName = StringHelper.Quote(optRemoteViewer.Value());
startInfo.Arguments = StringHelper.Quote(fileName); startInfo.Arguments = $"\"{fileName}\" {viewerOpts}";
} }
var process = new Process var process = new Process

View file

@ -23,17 +23,20 @@ Write-Output "
== Build System == Build System
=========================================================" ========================================================="
$pathNet = "Bin\Release\netcoreapp3.1" $pathNet = "Bin\Release\net5.0"
Remove-Item -Path ".\$pathNet" -Recurse -Force Remove-Item -Path ".\$pathNet" -Recurse -Force
$rids = @("linux-x64", "linux-arm", "linux-arm64", "osx-x64", "win-x86", "win-x64", "win-arm", "win-arm64") $rids = @("linux-x64", "linux-arm", "linux-arm64", "osx-x64", "win-x86", "win-x64", "win-arm", "win-arm64")
foreach ($rid in $rids) { foreach ($rid in $rids) {
dotnet publish -r $rid -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true Write-Output "========================================="
Write-Output "== $rid"
Write-Output "========================================="
dotnet publish -r $rid -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:IncludeNativeLibrariesForSelfExtract=true
$path = "$pathNet\$rid\publish\" $path = "$pathNet\$rid\publish\"
$fileName = Get-ChildItem $path -Exclude *.pdb -name $fileName = Get-ChildItem $path -Exclude *.pdb -name
$fileDest = "$pathNet\$fileName-$rid.zip" $fileDest = "$pathNet\$fileName-$rid.zip"
Remove-Item $fileDest -ErrorAction SilentlyContinue Remove-Item $fileDest -ErrorAction SilentlyContinue
Compress-Archive $path\$fileName $fileDest Compress-Archive $path\$fileName $fileDest
} }