Skip to content

Commit 00331db

Browse files
committed
Corrections for Ubuntu launch, install and get OS name)
1 parent b8a6f8e commit 00331db

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

.vscode/launch.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
// "postDebugTask": "stop-all",
1616
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server",
1717
"linux": {
18-
"program": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/CodeProject.AI.Server.dll",
18+
// This is what you get from trusting ChatGPT
19+
// "program": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/CodeProject.AI.Server.dll",
20+
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server.dll",
21+
1922
},
2023
"args": [],
2124
"cwd": "${workspaceFolder}/src/server/",
@@ -84,7 +87,7 @@
8487
// "postDebugTask": "stop-all",
8588
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server",
8689
"linux": {
87-
"program": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/CodeProject.AI.Server.dll",
90+
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server.dll",
8891
},
8992
"args": [],
9093
"cwd": "${workspaceFolder}/src/server/",
@@ -140,7 +143,7 @@
140143
"request": "launch",
141144
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server",
142145
"linux": {
143-
"program": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/CodeProject.AI.Server.dll",
146+
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server.dll",
144147
},
145148
"args": [],
146149
"cwd": "${workspaceFolder}/src/server/",
@@ -190,12 +193,12 @@
190193
"preLaunchTask": "build-server",
191194
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server.exe",
192195
"linux": {
193-
"program": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/CodeProject.AI.Server.dll",
196+
"program": "${workspaceFolder}/src/server/bin/Debug/net9.0/CodeProject.AI.Server.dll",
194197
},
195198
"args": [
196199
"--ModuleOptions:LaunchModules=false"
197200
],
198-
"cwd": "${workspaceFolder}/src/server/bin/Debug/${env:dotNetTarget}/",
201+
"cwd": "${workspaceFolder}/src/server/bin/Debug/net9.0/",
199202
"stopAtEntry": false,
200203
/*
201204
"serverReadyAction": {
@@ -232,7 +235,7 @@
232235
"preLaunchTask": "build-yolo-net",
233236
"program": "${workspaceFolder}/modules/ObjectDetectionYOLOv5Net/bin/Debug/9.0/ObjectDetectionYOLOv5Net",
234237
"linux": {
235-
"program": "${workspaceFolder}/modules/ObjectDetectionYOLOv5Net/bin/Debug/${env:dotNetTarget}/ObjectDetectionYOLOv5Net.dll",
238+
"program": "${workspaceFolder}/modules/ObjectDetectionYOLOv5Net/bin/Debug/net9.0/ObjectDetectionYOLOv5Net.dll",
236239
},
237240
// "args": [ "--selftest" ],
238241
// "cwd": "${workspaceFolder}",
@@ -334,7 +337,7 @@
334337
"preLaunchTask": "build-parsejson",
335338
"program": "${workspaceFolder}/utils/ParseJSON/bin/Debug/9.0/ParseJSON",
336339
"linux": {
337-
"program": "${workspaceFolder}/utils/ParseJSON/bin/Debug/${env:dotNetTarget}/ParseJSON.dll",
340+
"program": "${workspaceFolder}/utils/ParseJSON/bin/Debug/net9.0/ParseJSON.dll",
338341
},
339342
"args": [ "$.Modules.ALPR.Platforms", "test.json" ],
340343
"cwd": "${workspaceFolder}/utils/ParseJSON/",
@@ -474,7 +477,7 @@
474477
"preLaunchTask": "build-json-client",
475478
"program": "${workspaceFolder}/src/demos/clients/Net/JsonAPI/bin/Debug/net9.0/JsonAPI",
476479
"linux": {
477-
"program": "${workspaceFolder}/src/demos/clients/Net/JsonAPI/bin/Debug/${env:dotNetTarget}/JsonAPI.dll",
480+
"program": "${workspaceFolder}/src/demos/clients/Net/JsonAPI/bin/Debug/net9.0/JsonAPI.dll",
478481
},
479482
"args": [],
480483
"cwd": "${workspaceFolder}/src/demos/clients/Net/JsonAPI/",
@@ -596,7 +599,7 @@
596599
"preLaunchTask": "build-demo-net",
597600
"program": "${workspaceFolder}/src/demos/modules/DotNetSimple/bin/Debug/net9.0/DotNetSimple",
598601
"linux": {
599-
"program": "${workspaceFolder}/src/demos/modules/DotNetSimple/bin/Debug/${env:dotNetTarget}/DotNetSimple.dll",
602+
"program": "${workspaceFolder}/src/demos/modules/DotNetSimple/bin/Debug/net9.0/DotNetSimple.dll",
600603
},
601604
// "args": [ "--selftest" ],
602605
// "cwd": "${workspaceFolder}",
@@ -623,7 +626,7 @@
623626
"preLaunchTask": "build-demo_module_dotnetlongprocess",
624627
"program": "${workspaceFolder}/src/demos/modules/DotNetLongProcess/bin/Debug/net9.0/DotNetLongProcess",
625628
"linux": {
626-
"program": "${workspaceFolder}/src/demos/modules/DotNetLongProcess/bin/Debug/${env:dotNetTarget}/DotNetLongProcess.dll",
629+
"program": "${workspaceFolder}/src/demos/modules/DotNetLongProcess/bin/Debug/net9.0/DotNetLongProcess.dll",
627630
},
628631
// "args": [ "--selftest" ],
629632
// "cwd": "${workspaceFolder}",

devops/install/dotnet-install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,9 @@ copy_files_or_dirs_from_list() {
979979
if [ "$osname" = "linux-musl" ]; then
980980
printf -- "-u";
981981
else
982-
printf -- "-n";
982+
# cp: warning: behavior of -n is non-portable and may change in future; use --update=none instead
983+
# printf -- "-n";
984+
printf -- "--update=none";
983985
fi
984986
fi)
985987

src/SDK/NET/Utils/SystemInfo.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,16 +1696,33 @@ private async static Task CheckOSVersionNameAsync()
16961696

16971697
if (IsLinux)
16981698
{
1699-
// Output is in the form:
17001699
var results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $NAME\"", null)
1701-
.ConfigureAwait(false);
1700+
.ConfigureAwait(false);
17021701
if (results is not null)
17031702
_osName = results["output"]?.Trim(); // eg "ubuntu", "debian"
17041703

1705-
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION_ID\"", null)
1706-
.ConfigureAwait(false);
1704+
// VERSION is in form "24.10 (Oracular Oriole)"
1705+
var pattern = @"(?<version>\d+\.\d+) \((?<name>[a-z\s]+)\)";
1706+
var options = RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
1707+
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION\"",
1708+
pattern, options).ConfigureAwait(false);
17071709
if (results is not null)
1708-
_osVersion = results["output"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
1710+
{
1711+
_osVersion = results["version"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
1712+
string? name = results["name"]?.Trim(); // eg. "Oracular Oriole" for Ubuntu 24.10
1713+
if (!string.IsNullOrWhiteSpace(name))
1714+
_osName += " (" + name + ")";
1715+
}
1716+
1717+
// Just in case above failed
1718+
if (string.IsNullOrWhiteSpace(_osVersion))
1719+
{
1720+
// VERSION_ID is in form "24.10"
1721+
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION_ID\"", null)
1722+
.ConfigureAwait(false);
1723+
if (results is not null)
1724+
_osVersion = results["output"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
1725+
}
17091726
}
17101727
else if (IsWindows)
17111728
{

0 commit comments

Comments
 (0)