diff --git a/.github/workflows/dotnet-osx-arm64.yml b/.github/workflows/dotnet-osx-arm64.yml index afe917b..e86edcb 100644 --- a/.github/workflows/dotnet-osx-arm64.yml +++ b/.github/workflows/dotnet-osx-arm64.yml @@ -50,7 +50,7 @@ jobs: run: | mkdir -p temp_publish cp -r src/MDriveSync.Client.API/bin/Release/net8.0/osx-arm64/publish/* temp_publish/ - cp scripts/run_app.sh temp_publish/ + cp scripts/run_app_osx.sh temp_publish/ - name: 压缩构建产物为 tar.gz run: | diff --git a/.github/workflows/dotnet-osx-x64.yml b/.github/workflows/dotnet-osx-x64.yml index 76b7e9b..01b4cec 100644 --- a/.github/workflows/dotnet-osx-x64.yml +++ b/.github/workflows/dotnet-osx-x64.yml @@ -50,7 +50,7 @@ jobs: run: | mkdir -p temp_publish cp -r src/MDriveSync.Client.API/bin/Release/net8.0/osx-x64/publish/* temp_publish/ - cp scripts/run_app.sh temp_publish/ + cp scripts/run_app_osx.sh temp_publish/ - name: 压缩构建产物为 tar.gz run: | diff --git a/README.md b/README.md index 580d8b8..fc09f54 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ d. 启动方式2: chmod +x run_app.sh && ./run_app.sh ```bash a. 通过 https://github.com/trueai-org/mdrive/releases 下载 macOS 最新免安装版,例如:MDrive-osx-x64.zip b. 解压到当前目录: tar -xzf MDrive-osx-x64-.tar.gz -c. 执行: run_app.sh -c. 启动方式1: sh run_app.sh -d. 启动方式2: chmod +x run_app.sh && ./run_app.sh +c. 执行: run_app_osx.sh +c. 启动方式1: sh run_app_osx.sh +d. 启动方式2: chmod +x run_app_osx.sh && ./run_app_osx.sh ``` ### 在线预览 diff --git a/scripts/run_app.sh b/scripts/run_app.sh index 0a2b995..11eead1 100644 --- a/scripts/run_app.sh +++ b/scripts/run_app.sh @@ -24,4 +24,4 @@ if [ $? -ne 0 ]; then exit 1 else echo "应用程序执行成功。" -fi +fi \ No newline at end of file diff --git a/scripts/run_app_osx.sh b/scripts/run_app_osx.sh new file mode 100644 index 0000000..3b279a5 --- /dev/null +++ b/scripts/run_app_osx.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# 获取脚本所在目录 +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# 应用程序名称 +APP_NAME="MDriveSync.Client.API" + +# 检查应用程序文件是否存在 +if [ ! -f "$DIR/$APP_NAME" ]; then + echo "错误:应用程序文件 $DIR/$APP_NAME 不存在。" + exit 1 +fi + +# 移除应用程序的隔离属性 +xattr -d com.apple.quarantine "$DIR/$APP_NAME" + +# 赋予应用程序执行权限 +chmod +x "$DIR/$APP_NAME" + +# 执行应用程序 +"$DIR/$APP_NAME" + +# 检查应用程序退出状态 +if [ $? -ne 0 ]; then + echo "错误:应用程序执行失败。" + exit 1 +else + echo "应用程序执行成功。" +fi \ No newline at end of file