Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Conceição <Tiago_caza@hotmail.com>2022-10-30 08:37:47 +0300
committerTiago Conceição <Tiago_caza@hotmail.com>2022-10-30 08:37:47 +0300
commit6e0fda8e534cc68caab85fb824684655e16991e6 (patch)
tree2ba5adaa6f9762ea284d2b99e85a3dd08bba8ad5
parent35c63beebf2b478e1d0f93b2325474572bd6b89a (diff)
Better install, upgrade and run scripts
-rw-r--r--Scripts/install-uvtools.sh2
-rw-r--r--UVtools.WPF/Structures/AppVersionChecker.cs1
-rw-r--r--UVtools.WPF/UVtools.sh35
3 files changed, 35 insertions, 3 deletions
diff --git a/Scripts/install-uvtools.sh b/Scripts/install-uvtools.sh
index f79029b..a7ad134 100644
--- a/Scripts/install-uvtools.sh
+++ b/Scripts/install-uvtools.sh
@@ -140,7 +140,7 @@ echo "Error: UVtools.app not found on known paths"
echo ''
- if [ -f "$appPath/Contents/MacOS/UVtools.sh" ]; then
+ if [ "$arch" == "arm64" -a -f "$appPath/Contents/MacOS/UVtools.sh" ]; then
nohup bash "$appPath/Contents/MacOS/UVtools.sh" &> /dev/null &
disown
elif [ -d "$appPath" ]; then
diff --git a/UVtools.WPF/Structures/AppVersionChecker.cs b/UVtools.WPF/Structures/AppVersionChecker.cs
index 0652759..e0e18c1 100644
--- a/UVtools.WPF/Structures/AppVersionChecker.cs
+++ b/UVtools.WPF/Structures/AppVersionChecker.cs
@@ -249,6 +249,7 @@ public class AppVersionChecker : BindableBase
await stream.WriteLineAsync();
//await stream.WriteLineAsync($"cd '{App.ApplicationPath}'");
await stream.WriteLineAsync($"killall {About.Software}");
+ await stream.WriteLineAsync($"ps -ef | grep '.*dotnet.*{About.Software}.dll' | grep -v grep | awk '{{print $2}}' | xargs -r kill");
await stream.WriteLineAsync("sleep 1");
await stream.WriteLineAsync();
diff --git a/UVtools.WPF/UVtools.sh b/UVtools.WPF/UVtools.sh
index e4516b4..14446f6 100644
--- a/UVtools.WPF/UVtools.sh
+++ b/UVtools.WPF/UVtools.sh
@@ -1,3 +1,34 @@
#!/bin/bash
-cd "$(dirname "$0")"
-[ -f UVtools ] && ./UVtools || dotnet UVtools.dll
+path="$(dirname "$0")"
+arch="$(uname -m)" # x86_64 or arm64
+
+run_app_normal(){
+ "$path/UVtools"
+}
+
+run_app_dotnet(){
+ if [ -z "$(command -v dotnet)" ]; then
+ echo "$(uname) $arch requires dotnet in order to run."
+ echo 'Please use the auto installer script to install all the dependencies.'
+ exit -1
+ fi
+
+ if [ -f "$path/UVtools.dll" ]; then
+ dotnet "$path/UVtools.dll"
+ else
+ echo "Error: UVtools.dll not found."
+ exit -1
+ fi
+}
+
+if [ "${OSTYPE:0:6}" == "darwin" -a "$arch" == "arm64" ]; then
+ run_app_dotnet
+elif [ -f "$path/UVtools" ]; then
+ run_app_normal
+elif [ -f "$path/UVtools.dll" ]; then
+ run_app_dotnet
+else
+ echo 'Error: Unable to detect UVtools or to run it.'
+ echo 'Please use the auto installer script to re/install UVtools.'
+ exit -1
+fi